@gravity-ui/chartkit 5.17.0 → 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/HighchartsComponent.js +1 -1
- 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,13 +0,0 @@
|
|
|
1
|
-
import { BaseType, Selection } from 'd3';
|
|
2
|
-
import { MarkerData as AreaMarkerData } from './area/types';
|
|
3
|
-
import { MarkerData as LineMarkerData } from './line/types';
|
|
4
|
-
import { MarkerData as ScatterMarkerData } from './scatter/types';
|
|
5
|
-
type MarkerData = LineMarkerData | AreaMarkerData | ScatterMarkerData;
|
|
6
|
-
export declare function renderMarker<T extends MarkerData>(selection: Selection<BaseType | SVGGElement, T, SVGGElement, unknown>): Selection<BaseType | SVGGElement, T, SVGGElement, unknown>;
|
|
7
|
-
export declare function getMarkerVisibility(d: MarkerData): "" | "hidden";
|
|
8
|
-
export declare function getMarkerHaloVisibility(d: MarkerData): "" | "hidden";
|
|
9
|
-
export declare function setMarker<T extends BaseType, D extends MarkerData>(selection: Selection<T, D, BaseType | null, unknown>, state: 'normal' | 'hover'): void;
|
|
10
|
-
export declare function getMarkerSymbol(type: "circle" | "diamond" | "square" | "triangle" | "triangle-down" | undefined, radius: number): string | null;
|
|
11
|
-
export declare function selectMarkerHalo<T>(parentSelection: Selection<BaseType, T, null, undefined>): Selection<BaseType, T, null, undefined>;
|
|
12
|
-
export declare function selectMarkerSymbol<T>(parentSelection: Selection<BaseType, T, null, undefined>): Selection<BaseType, T, null, undefined>;
|
|
13
|
-
export {};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { symbol } from 'd3';
|
|
2
|
-
import get from 'lodash/get';
|
|
3
|
-
import { SymbolType } from '../../../../../constants';
|
|
4
|
-
import { block } from '../../../../../utils/cn';
|
|
5
|
-
import { getSymbol } from '../../utils';
|
|
6
|
-
const b = block('d3-marker');
|
|
7
|
-
const haloClassName = b('halo');
|
|
8
|
-
const symbolClassName = b('symbol');
|
|
9
|
-
export function renderMarker(selection) {
|
|
10
|
-
const markerSelection = selection
|
|
11
|
-
.attr('class', b('wrapper'))
|
|
12
|
-
.attr('visibility', getMarkerVisibility)
|
|
13
|
-
.attr('transform', (d) => {
|
|
14
|
-
return `translate(${d.point.x},${d.point.y})`;
|
|
15
|
-
});
|
|
16
|
-
markerSelection
|
|
17
|
-
.append('path')
|
|
18
|
-
.attr('class', haloClassName)
|
|
19
|
-
.attr('d', (d) => {
|
|
20
|
-
const series = d.point.series;
|
|
21
|
-
const type = series.marker.states.normal.symbol;
|
|
22
|
-
const radius = get(d.point.data, 'radius', series.marker.states.hover.radius);
|
|
23
|
-
const haloSize = series.marker.states.hover.halo.size;
|
|
24
|
-
return getMarkerSymbol(type, radius + haloSize);
|
|
25
|
-
})
|
|
26
|
-
.attr('fill', (d) => d.point.series.color)
|
|
27
|
-
.attr('opacity', (d) => d.point.series.marker.states.hover.halo.opacity)
|
|
28
|
-
.attr('z-index', -1)
|
|
29
|
-
.attr('visibility', getMarkerHaloVisibility);
|
|
30
|
-
markerSelection
|
|
31
|
-
.append('path')
|
|
32
|
-
.attr('class', symbolClassName)
|
|
33
|
-
.call(setMarker, 'normal')
|
|
34
|
-
.attr('fill', (d) => d.point.series.color);
|
|
35
|
-
return markerSelection;
|
|
36
|
-
}
|
|
37
|
-
export function getMarkerVisibility(d) {
|
|
38
|
-
const markerStates = d.point.series.marker.states;
|
|
39
|
-
let enabled;
|
|
40
|
-
if (d.hovered) {
|
|
41
|
-
enabled = markerStates.hover.enabled && d.hovered;
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
enabled =
|
|
45
|
-
markerStates.normal.enabled || get(d.point.data, 'marker.states.normal.enabled', false);
|
|
46
|
-
}
|
|
47
|
-
return enabled ? '' : 'hidden';
|
|
48
|
-
}
|
|
49
|
-
export function getMarkerHaloVisibility(d) {
|
|
50
|
-
const markerStates = d.point.series.marker.states;
|
|
51
|
-
const enabled = markerStates.hover.halo.enabled && d.hovered;
|
|
52
|
-
return enabled ? '' : 'hidden';
|
|
53
|
-
}
|
|
54
|
-
export function setMarker(selection, state) {
|
|
55
|
-
selection
|
|
56
|
-
.attr('d', (d) => {
|
|
57
|
-
const series = d.point.series;
|
|
58
|
-
const type = series.marker.states.normal.symbol;
|
|
59
|
-
const radius = get(d.point.data, 'radius', series.marker.states[state].radius);
|
|
60
|
-
const size = radius + series.marker.states[state].borderWidth;
|
|
61
|
-
return getMarkerSymbol(type, size);
|
|
62
|
-
})
|
|
63
|
-
.attr('stroke-width', (d) => d.point.series.marker.states[state].borderWidth)
|
|
64
|
-
.attr('stroke', (d) => d.point.series.marker.states[state].borderColor);
|
|
65
|
-
}
|
|
66
|
-
export function getMarkerSymbol(type = SymbolType.Circle, radius) {
|
|
67
|
-
const symbolFn = getSymbol(type);
|
|
68
|
-
const size = Math.pow(radius, 2) * Math.PI;
|
|
69
|
-
return symbol(symbolFn, size)();
|
|
70
|
-
}
|
|
71
|
-
export function selectMarkerHalo(parentSelection) {
|
|
72
|
-
return parentSelection.select(`.${haloClassName}`);
|
|
73
|
-
}
|
|
74
|
-
export function selectMarkerSymbol(parentSelection) {
|
|
75
|
-
return parentSelection.select(`.${symbolClassName}`);
|
|
76
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Dispatch, PieArcDatum } from 'd3';
|
|
3
|
-
import { PreparedSeriesOptions } from '../../useSeries/types';
|
|
4
|
-
import { PreparedPieData, SegmentData } from './types';
|
|
5
|
-
type PreparePieSeriesArgs = {
|
|
6
|
-
dispatcher: Dispatch<object>;
|
|
7
|
-
preparedData: PreparedPieData[];
|
|
8
|
-
seriesOptions: PreparedSeriesOptions;
|
|
9
|
-
htmlLayout: HTMLElement | null;
|
|
10
|
-
};
|
|
11
|
-
export declare function getHaloVisibility(d: PieArcDatum<SegmentData>): "" | "hidden";
|
|
12
|
-
export declare function PieSeriesShapes(args: PreparePieSeriesArgs): React.JSX.Element;
|
|
13
|
-
export {};
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { arc, 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
|
-
import { setActiveState } from '../utils';
|
|
8
|
-
const b = block('d3-pie');
|
|
9
|
-
export function getHaloVisibility(d) {
|
|
10
|
-
const enabled = d.data.pie.halo.enabled && d.data.hovered;
|
|
11
|
-
return enabled ? '' : 'hidden';
|
|
12
|
-
}
|
|
13
|
-
export function PieSeriesShapes(args) {
|
|
14
|
-
const { dispatcher, preparedData, seriesOptions, htmlLayout } = args;
|
|
15
|
-
const ref = React.useRef(null);
|
|
16
|
-
React.useEffect(() => {
|
|
17
|
-
if (!ref.current) {
|
|
18
|
-
return () => { };
|
|
19
|
-
}
|
|
20
|
-
const svgElement = select(ref.current);
|
|
21
|
-
svgElement.selectAll('*').remove();
|
|
22
|
-
const segmentSelector = `.${b('segment')}`;
|
|
23
|
-
const connectorSelector = `.${b('connector')}`;
|
|
24
|
-
const shapesSelection = svgElement
|
|
25
|
-
.selectAll('pie')
|
|
26
|
-
.data(preparedData)
|
|
27
|
-
.join('g')
|
|
28
|
-
.attr('id', (pieData) => pieData.id)
|
|
29
|
-
.attr('class', b('item'))
|
|
30
|
-
.attr('transform', (pieData) => {
|
|
31
|
-
const [x, y] = pieData.center;
|
|
32
|
-
return `translate(${x}, ${y})`;
|
|
33
|
-
})
|
|
34
|
-
.style('stroke', (pieData) => pieData.borderColor)
|
|
35
|
-
.style('stroke-width', (pieData) => pieData.borderWidth)
|
|
36
|
-
.attr('cursor', (pieData) => pieData.series.cursor);
|
|
37
|
-
// Render halo appearing outside the hovered slice
|
|
38
|
-
shapesSelection
|
|
39
|
-
.selectAll('halo')
|
|
40
|
-
.data((pieData) => {
|
|
41
|
-
if (pieData.halo.enabled) {
|
|
42
|
-
return pieData.segments;
|
|
43
|
-
}
|
|
44
|
-
return [];
|
|
45
|
-
})
|
|
46
|
-
.join('path')
|
|
47
|
-
.attr('d', (d) => {
|
|
48
|
-
const arcGenerator = arc()
|
|
49
|
-
.innerRadius(d.data.pie.innerRadius)
|
|
50
|
-
.outerRadius(d.data.pie.radius + d.data.pie.halo.size)
|
|
51
|
-
.cornerRadius(d.data.pie.borderRadius);
|
|
52
|
-
return arcGenerator(d);
|
|
53
|
-
})
|
|
54
|
-
.attr('class', b('halo'))
|
|
55
|
-
.attr('fill', (d) => d.data.color)
|
|
56
|
-
.attr('opacity', (d) => d.data.pie.halo.opacity)
|
|
57
|
-
.attr('z-index', -1)
|
|
58
|
-
.attr('visibility', getHaloVisibility);
|
|
59
|
-
// Render segments
|
|
60
|
-
shapesSelection
|
|
61
|
-
.selectAll(segmentSelector)
|
|
62
|
-
.data((pieData) => pieData.segments)
|
|
63
|
-
.join('path')
|
|
64
|
-
.attr('d', (d) => {
|
|
65
|
-
const arcGenerator = arc()
|
|
66
|
-
.innerRadius(d.data.pie.innerRadius)
|
|
67
|
-
.outerRadius(d.data.pie.radius)
|
|
68
|
-
.cornerRadius(d.data.pie.borderRadius);
|
|
69
|
-
return arcGenerator(d);
|
|
70
|
-
})
|
|
71
|
-
.attr('class', b('segment'))
|
|
72
|
-
.attr('fill', (d) => d.data.color)
|
|
73
|
-
.attr('opacity', (d) => d.data.opacity);
|
|
74
|
-
// render Labels
|
|
75
|
-
shapesSelection
|
|
76
|
-
.selectAll('text')
|
|
77
|
-
.data((pieData) => pieData.labels)
|
|
78
|
-
.join('text')
|
|
79
|
-
.text((d) => d.text)
|
|
80
|
-
.attr('class', b('label'))
|
|
81
|
-
.attr('x', (d) => d.x)
|
|
82
|
-
.attr('y', (d) => d.y)
|
|
83
|
-
.attr('text-anchor', (d) => d.textAnchor)
|
|
84
|
-
.style('font-size', (d) => d.style.fontSize)
|
|
85
|
-
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
86
|
-
.style('fill', (d) => d.style.fontColor || null)
|
|
87
|
-
.call(setEllipsisForOverflowTexts, (d) => d.size.width > d.maxWidth ? d.maxWidth : Infinity);
|
|
88
|
-
// Add the polyline between chart and labels
|
|
89
|
-
shapesSelection
|
|
90
|
-
.selectAll(connectorSelector)
|
|
91
|
-
.data((pieData) => pieData.connectors)
|
|
92
|
-
.enter()
|
|
93
|
-
.append('path')
|
|
94
|
-
.attr('class', b('connector'))
|
|
95
|
-
.attr('d', (d) => d.path)
|
|
96
|
-
.attr('stroke', (d) => d.color)
|
|
97
|
-
.attr('stroke-width', 1)
|
|
98
|
-
.attr('stroke-linejoin', 'round')
|
|
99
|
-
.attr('stroke-linecap', 'round')
|
|
100
|
-
.style('fill', 'none');
|
|
101
|
-
// Render custom shapes if defined
|
|
102
|
-
shapesSelection.each(function (d, index, nodes) {
|
|
103
|
-
var _a, _b;
|
|
104
|
-
const customShape = (_b = (_a = d.series).renderCustomShape) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
105
|
-
series: {
|
|
106
|
-
innerRadius: d.innerRadius,
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
|
-
if (customShape) {
|
|
110
|
-
nodes[index].append(customShape);
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
const eventName = `hover-shape.pie`;
|
|
114
|
-
const hoverOptions = get(seriesOptions, 'pie.states.hover');
|
|
115
|
-
const inactiveOptions = get(seriesOptions, 'pie.states.inactive');
|
|
116
|
-
dispatcher.on(eventName, (data) => {
|
|
117
|
-
var _a, _b;
|
|
118
|
-
const selectedSeriesId = (_b = (_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.series) === null || _b === void 0 ? void 0 : _b.id;
|
|
119
|
-
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
120
|
-
const inactiveEnabled = inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled;
|
|
121
|
-
shapesSelection.datum((_d, index, list) => {
|
|
122
|
-
const pieSelection = select(list[index]);
|
|
123
|
-
const haloSelection = pieSelection.selectAll(`.${b('halo')}`);
|
|
124
|
-
pieSelection
|
|
125
|
-
.selectAll(segmentSelector)
|
|
126
|
-
.datum((d, i, elements) => {
|
|
127
|
-
const hovered = Boolean(hoverEnabled && d.data.series.id === selectedSeriesId);
|
|
128
|
-
if (d.data.hovered !== hovered) {
|
|
129
|
-
d.data.hovered = hovered;
|
|
130
|
-
select(elements[i]).attr('fill', () => {
|
|
131
|
-
var _a;
|
|
132
|
-
const initialColor = d.data.color;
|
|
133
|
-
if (d.data.hovered) {
|
|
134
|
-
return (((_a = color(initialColor)) === null || _a === void 0 ? void 0 : _a.brighter(hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.brightness).toString()) || initialColor);
|
|
135
|
-
}
|
|
136
|
-
return initialColor;
|
|
137
|
-
});
|
|
138
|
-
const currentSegmentHalo = haloSelection.nodes()[i];
|
|
139
|
-
select(currentSegmentHalo).attr('visibility', getHaloVisibility);
|
|
140
|
-
}
|
|
141
|
-
setActiveState({
|
|
142
|
-
element: elements[i],
|
|
143
|
-
state: inactiveOptions,
|
|
144
|
-
active: Boolean(!inactiveEnabled ||
|
|
145
|
-
!selectedSeriesId ||
|
|
146
|
-
selectedSeriesId === d.data.series.id),
|
|
147
|
-
datum: d.data,
|
|
148
|
-
});
|
|
149
|
-
return d;
|
|
150
|
-
});
|
|
151
|
-
const labelSelection = pieSelection.selectAll('tspan');
|
|
152
|
-
const connectorSelection = pieSelection.selectAll(connectorSelector);
|
|
153
|
-
labelSelection.merge(connectorSelection).datum((d, i, elements) => {
|
|
154
|
-
return setActiveState({
|
|
155
|
-
element: elements[i],
|
|
156
|
-
state: inactiveOptions,
|
|
157
|
-
active: Boolean(!inactiveEnabled ||
|
|
158
|
-
!selectedSeriesId ||
|
|
159
|
-
selectedSeriesId === d.series.id),
|
|
160
|
-
datum: d,
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
return () => {
|
|
166
|
-
dispatcher.on(eventName, null);
|
|
167
|
-
};
|
|
168
|
-
}, [dispatcher, preparedData, seriesOptions]);
|
|
169
|
-
return (React.createElement(React.Fragment, null,
|
|
170
|
-
React.createElement("g", { ref: ref, className: b(), style: { zIndex: 9 } }),
|
|
171
|
-
React.createElement(HtmlLayer, { preparedData: preparedData, htmlLayout: htmlLayout })));
|
|
172
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { PreparedPieSeries } from '../../useSeries/types';
|
|
2
|
-
import { PreparedPieData } from './types';
|
|
3
|
-
type Args = {
|
|
4
|
-
series: PreparedPieSeries[];
|
|
5
|
-
boundsWidth: number;
|
|
6
|
-
boundsHeight: number;
|
|
7
|
-
};
|
|
8
|
-
export declare function preparePieData(args: Args): PreparedPieData[];
|
|
9
|
-
export {};
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { arc, group, line as lineGenerator } from 'd3';
|
|
2
|
-
import { calculateNumericProperty, getLabelsSize, getLeftPosition, isLabelsOverlapping, } from '../../../utils';
|
|
3
|
-
import { getCurveFactory, pieGenerator } from './utils';
|
|
4
|
-
const FULL_CIRCLE = Math.PI * 2;
|
|
5
|
-
const getCenter = (boundsWidth, boundsHeight, center) => {
|
|
6
|
-
var _a, _b;
|
|
7
|
-
const defaultX = boundsWidth * 0.5;
|
|
8
|
-
const defaultY = boundsHeight * 0.5;
|
|
9
|
-
if (!center) {
|
|
10
|
-
return [defaultX, defaultY];
|
|
11
|
-
}
|
|
12
|
-
const [x, y] = center;
|
|
13
|
-
const resultX = (_a = calculateNumericProperty({ value: x, base: boundsWidth })) !== null && _a !== void 0 ? _a : defaultX;
|
|
14
|
-
const resultY = (_b = calculateNumericProperty({ value: y, base: boundsHeight })) !== null && _b !== void 0 ? _b : defaultY;
|
|
15
|
-
return [resultX, resultY];
|
|
16
|
-
};
|
|
17
|
-
export function preparePieData(args) {
|
|
18
|
-
const { series: preparedSeries, boundsWidth, boundsHeight } = args;
|
|
19
|
-
const maxRadius = Math.min(boundsWidth, boundsHeight) / 2;
|
|
20
|
-
const groupedPieSeries = group(preparedSeries, (pieSeries) => pieSeries.stackId);
|
|
21
|
-
return Array.from(groupedPieSeries).map(([stackId, items]) => {
|
|
22
|
-
var _a, _b, _c;
|
|
23
|
-
const series = items[0];
|
|
24
|
-
const { center, borderWidth, borderColor, borderRadius, radius: seriesRadius, innerRadius: seriesInnerRadius, dataLabels, } = series;
|
|
25
|
-
const radius = (_a = calculateNumericProperty({ value: seriesRadius, base: maxRadius })) !== null && _a !== void 0 ? _a : maxRadius;
|
|
26
|
-
const data = {
|
|
27
|
-
id: stackId,
|
|
28
|
-
center: getCenter(boundsWidth, boundsHeight, center),
|
|
29
|
-
innerRadius: (_b = calculateNumericProperty({ value: seriesInnerRadius, base: radius })) !== null && _b !== void 0 ? _b : 0,
|
|
30
|
-
radius,
|
|
31
|
-
segments: [],
|
|
32
|
-
labels: [],
|
|
33
|
-
connectors: [],
|
|
34
|
-
borderColor,
|
|
35
|
-
borderWidth,
|
|
36
|
-
borderRadius,
|
|
37
|
-
series: items[0],
|
|
38
|
-
connectorCurve: dataLabels.connectorCurve,
|
|
39
|
-
halo: {
|
|
40
|
-
enabled: series.states.hover.halo.enabled,
|
|
41
|
-
opacity: series.states.hover.halo.opacity,
|
|
42
|
-
size: series.states.hover.halo.size,
|
|
43
|
-
},
|
|
44
|
-
htmlElements: [],
|
|
45
|
-
};
|
|
46
|
-
const segments = items.map((item) => {
|
|
47
|
-
return {
|
|
48
|
-
value: item.value,
|
|
49
|
-
color: item.color,
|
|
50
|
-
opacity: item.opacity,
|
|
51
|
-
series: item,
|
|
52
|
-
hovered: false,
|
|
53
|
-
active: true,
|
|
54
|
-
pie: data,
|
|
55
|
-
};
|
|
56
|
-
});
|
|
57
|
-
data.segments = pieGenerator(segments);
|
|
58
|
-
let line = lineGenerator();
|
|
59
|
-
const curveFactory = getCurveFactory(data);
|
|
60
|
-
if (curveFactory) {
|
|
61
|
-
line = line.curve(curveFactory);
|
|
62
|
-
}
|
|
63
|
-
if (dataLabels.enabled) {
|
|
64
|
-
const { style, connectorPadding, distance } = dataLabels;
|
|
65
|
-
const { maxHeight: labelHeight } = getLabelsSize({ labels: ['Some Label'], style });
|
|
66
|
-
const minSegmentRadius = maxRadius - connectorPadding - distance - labelHeight;
|
|
67
|
-
if (data.radius > minSegmentRadius) {
|
|
68
|
-
data.radius = minSegmentRadius;
|
|
69
|
-
data.innerRadius =
|
|
70
|
-
(_c = calculateNumericProperty({ value: seriesInnerRadius, base: data.radius })) !== null && _c !== void 0 ? _c : 0;
|
|
71
|
-
}
|
|
72
|
-
const connectorStartPointGenerator = arc()
|
|
73
|
-
.innerRadius(data.radius)
|
|
74
|
-
.outerRadius(data.radius);
|
|
75
|
-
const connectorMidPointRadius = data.radius + distance / 2;
|
|
76
|
-
const connectorMidPointGenerator = arc()
|
|
77
|
-
.innerRadius(connectorMidPointRadius)
|
|
78
|
-
.outerRadius(connectorMidPointRadius);
|
|
79
|
-
const connectorArcRadius = data.radius + distance;
|
|
80
|
-
const connectorEndPointGenerator = arc()
|
|
81
|
-
.innerRadius(connectorArcRadius)
|
|
82
|
-
.outerRadius(connectorArcRadius);
|
|
83
|
-
const labelArcRadius = connectorArcRadius + connectorPadding;
|
|
84
|
-
const labelArcGenerator = arc()
|
|
85
|
-
.innerRadius(labelArcRadius)
|
|
86
|
-
.outerRadius(labelArcRadius);
|
|
87
|
-
const labels = [];
|
|
88
|
-
items.forEach((d, index) => {
|
|
89
|
-
const prevLabel = labels[labels.length - 1];
|
|
90
|
-
const text = String(d.data.label || d.data.value);
|
|
91
|
-
const shouldUseHtml = dataLabels.html;
|
|
92
|
-
const labelSize = getLabelsSize({ labels: [text], style, html: shouldUseHtml });
|
|
93
|
-
const labelWidth = labelSize.maxWidth;
|
|
94
|
-
const relatedSegment = data.segments[index];
|
|
95
|
-
const getLabelPosition = (angle) => {
|
|
96
|
-
let [x, y] = labelArcGenerator.centroid(Object.assign(Object.assign({}, relatedSegment), { startAngle: angle, endAngle: angle }));
|
|
97
|
-
y = y < 0 ? y - labelHeight : y;
|
|
98
|
-
if (shouldUseHtml) {
|
|
99
|
-
x = x < 0 ? x - labelWidth : x;
|
|
100
|
-
}
|
|
101
|
-
x = Math.max(-boundsWidth / 2, x);
|
|
102
|
-
return [x, y];
|
|
103
|
-
};
|
|
104
|
-
const getConnectorPoints = (angle) => {
|
|
105
|
-
const connectorStartPoint = connectorStartPointGenerator.centroid(relatedSegment);
|
|
106
|
-
const connectorEndPoint = connectorEndPointGenerator.centroid(Object.assign(Object.assign({}, relatedSegment), { startAngle: angle, endAngle: angle }));
|
|
107
|
-
if (dataLabels.connectorShape === 'straight-line') {
|
|
108
|
-
return [connectorStartPoint, connectorEndPoint];
|
|
109
|
-
}
|
|
110
|
-
const connectorMidPoint = connectorMidPointGenerator.centroid(relatedSegment);
|
|
111
|
-
return [connectorStartPoint, connectorMidPoint, connectorEndPoint];
|
|
112
|
-
};
|
|
113
|
-
const midAngle = Math.max((prevLabel === null || prevLabel === void 0 ? void 0 : prevLabel.angle) || 0, relatedSegment.startAngle +
|
|
114
|
-
(relatedSegment.endAngle - relatedSegment.startAngle) / 2);
|
|
115
|
-
const [x, y] = getLabelPosition(midAngle);
|
|
116
|
-
const label = {
|
|
117
|
-
text,
|
|
118
|
-
x,
|
|
119
|
-
y,
|
|
120
|
-
style,
|
|
121
|
-
size: { width: labelWidth, height: labelHeight },
|
|
122
|
-
maxWidth: labelWidth,
|
|
123
|
-
textAnchor: midAngle < Math.PI ? 'start' : 'end',
|
|
124
|
-
series: { id: d.id },
|
|
125
|
-
active: true,
|
|
126
|
-
segment: relatedSegment.data,
|
|
127
|
-
angle: midAngle,
|
|
128
|
-
};
|
|
129
|
-
let overlap = false;
|
|
130
|
-
if (prevLabel) {
|
|
131
|
-
overlap = isLabelsOverlapping(prevLabel, label, dataLabels.padding);
|
|
132
|
-
if (overlap) {
|
|
133
|
-
let shouldAdjustAngle = true;
|
|
134
|
-
const step = Math.PI / 180;
|
|
135
|
-
while (shouldAdjustAngle) {
|
|
136
|
-
const newAngle = label.angle + step;
|
|
137
|
-
if (newAngle > FULL_CIRCLE &&
|
|
138
|
-
newAngle % FULL_CIRCLE > labels[0].angle) {
|
|
139
|
-
shouldAdjustAngle = false;
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
label.angle = newAngle;
|
|
143
|
-
const [newX, newY] = getLabelPosition(newAngle);
|
|
144
|
-
label.x = newX;
|
|
145
|
-
label.y = newY;
|
|
146
|
-
if (!isLabelsOverlapping(prevLabel, label, dataLabels.padding)) {
|
|
147
|
-
shouldAdjustAngle = false;
|
|
148
|
-
overlap = false;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (dataLabels.allowOverlap || !overlap) {
|
|
155
|
-
const left = getLeftPosition(label);
|
|
156
|
-
if (Math.abs(left) > boundsWidth / 2) {
|
|
157
|
-
label.maxWidth = label.size.width - (Math.abs(left) - boundsWidth / 2);
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
const right = left + label.size.width;
|
|
161
|
-
if (right > boundsWidth / 2) {
|
|
162
|
-
label.maxWidth = label.size.width - (right - boundsWidth / 2);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
if (shouldUseHtml) {
|
|
166
|
-
data.htmlElements.push({
|
|
167
|
-
x: boundsWidth / 2 + label.x,
|
|
168
|
-
y: boundsHeight / 2 + label.y,
|
|
169
|
-
content: label.text,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
labels.push(label);
|
|
174
|
-
}
|
|
175
|
-
const connector = {
|
|
176
|
-
path: line(getConnectorPoints(midAngle)),
|
|
177
|
-
color: relatedSegment.data.color,
|
|
178
|
-
};
|
|
179
|
-
data.connectors.push(connector);
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
data.labels = labels;
|
|
183
|
-
}
|
|
184
|
-
return data;
|
|
185
|
-
});
|
|
186
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { PieArcDatum } from 'd3';
|
|
2
|
-
import { ConnectorCurve } from '../../../../../../types';
|
|
3
|
-
import { HtmlItem, LabelData } from '../../../types';
|
|
4
|
-
import { PreparedPieSeries } from '../../useSeries/types';
|
|
5
|
-
export type SegmentData = {
|
|
6
|
-
value: number;
|
|
7
|
-
color: string;
|
|
8
|
-
opacity: number | null;
|
|
9
|
-
series: PreparedPieSeries;
|
|
10
|
-
hovered: boolean;
|
|
11
|
-
active: boolean;
|
|
12
|
-
pie: PreparedPieData;
|
|
13
|
-
};
|
|
14
|
-
export type PieLabelData = LabelData & {
|
|
15
|
-
segment: SegmentData;
|
|
16
|
-
angle: number;
|
|
17
|
-
maxWidth: number;
|
|
18
|
-
};
|
|
19
|
-
export type PieConnectorData = {
|
|
20
|
-
path: string | null;
|
|
21
|
-
color: string;
|
|
22
|
-
};
|
|
23
|
-
export type PreparedPieData = {
|
|
24
|
-
id: string;
|
|
25
|
-
segments: PieArcDatum<SegmentData>[];
|
|
26
|
-
labels: PieLabelData[];
|
|
27
|
-
connectors: PieConnectorData[];
|
|
28
|
-
center: [number, number];
|
|
29
|
-
radius: number;
|
|
30
|
-
innerRadius: number;
|
|
31
|
-
borderRadius: number;
|
|
32
|
-
borderWidth: number;
|
|
33
|
-
borderColor: string;
|
|
34
|
-
series: PreparedPieSeries;
|
|
35
|
-
connectorCurve: ConnectorCurve;
|
|
36
|
-
halo: {
|
|
37
|
-
enabled: boolean;
|
|
38
|
-
opacity: number;
|
|
39
|
-
size: number;
|
|
40
|
-
};
|
|
41
|
-
htmlElements: HtmlItem[];
|
|
42
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { curveBasis, curveLinear, pie } from 'd3';
|
|
2
|
-
export const pieGenerator = pie()
|
|
3
|
-
.value((d) => d.value)
|
|
4
|
-
.sort(null);
|
|
5
|
-
export function getCurveFactory(data) {
|
|
6
|
-
switch (data.connectorCurve) {
|
|
7
|
-
case 'basic': {
|
|
8
|
-
return curveBasis;
|
|
9
|
-
}
|
|
10
|
-
case 'linear': {
|
|
11
|
-
return curveLinear;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Dispatch } from 'd3';
|
|
3
|
-
import { PreparedSeriesOptions } from '../../useSeries/types';
|
|
4
|
-
import type { PreparedScatterData } from './types';
|
|
5
|
-
export { prepareScatterData } from './prepare-data';
|
|
6
|
-
type ScatterSeriesShapeProps = {
|
|
7
|
-
dispatcher: Dispatch<object>;
|
|
8
|
-
preparedData: PreparedScatterData[];
|
|
9
|
-
seriesOptions: PreparedSeriesOptions;
|
|
10
|
-
htmlLayout: HTMLElement | null;
|
|
11
|
-
};
|
|
12
|
-
export declare function ScatterSeriesShape(props: ScatterSeriesShapeProps): React.JSX.Element;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { select } from 'd3';
|
|
3
|
-
import get from 'lodash/get';
|
|
4
|
-
import { block } from '../../../../../../utils/cn';
|
|
5
|
-
import { HtmlLayer } from '../HtmlLayer';
|
|
6
|
-
import { getMarkerHaloVisibility, renderMarker, selectMarkerHalo, selectMarkerSymbol, setMarker, } from '../marker';
|
|
7
|
-
import { setActiveState, shapeKey } from '../utils';
|
|
8
|
-
export { prepareScatterData } from './prepare-data';
|
|
9
|
-
const b = block('d3-scatter');
|
|
10
|
-
export function ScatterSeriesShape(props) {
|
|
11
|
-
const { dispatcher, preparedData, seriesOptions, htmlLayout } = props;
|
|
12
|
-
const ref = React.useRef(null);
|
|
13
|
-
React.useEffect(() => {
|
|
14
|
-
if (!ref.current) {
|
|
15
|
-
return () => { };
|
|
16
|
-
}
|
|
17
|
-
const svgElement = select(ref.current);
|
|
18
|
-
const hoverOptions = get(seriesOptions, 'scatter.states.hover');
|
|
19
|
-
const inactiveOptions = get(seriesOptions, 'scatter.states.inactive');
|
|
20
|
-
svgElement.selectAll('*').remove();
|
|
21
|
-
const selection = svgElement
|
|
22
|
-
.selectAll('path')
|
|
23
|
-
.data(preparedData, shapeKey)
|
|
24
|
-
.join('g')
|
|
25
|
-
.call(renderMarker)
|
|
26
|
-
.attr('fill', (d) => d.point.data.color || d.point.series.color || '')
|
|
27
|
-
.attr('opacity', (d) => d.point.opacity)
|
|
28
|
-
.attr('cursor', (d) => d.point.series.cursor);
|
|
29
|
-
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
30
|
-
const inactiveEnabled = inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled;
|
|
31
|
-
dispatcher.on('hover-shape.scatter', (data) => {
|
|
32
|
-
var _a;
|
|
33
|
-
const selected = data === null || data === void 0 ? void 0 : data.find((d) => d.series.type === 'scatter');
|
|
34
|
-
const selectedDataItem = selected === null || selected === void 0 ? void 0 : selected.data;
|
|
35
|
-
const selectedSeriesId = (_a = selected === null || selected === void 0 ? void 0 : selected.series) === null || _a === void 0 ? void 0 : _a.id;
|
|
36
|
-
selection.datum((d, index, list) => {
|
|
37
|
-
const elementSelection = select(list[index]);
|
|
38
|
-
const hovered = Boolean(hoverEnabled && d.point.data === selectedDataItem);
|
|
39
|
-
if (d.hovered !== hovered) {
|
|
40
|
-
d.hovered = hovered;
|
|
41
|
-
elementSelection.attr('z-index', hovered ? 999 : null);
|
|
42
|
-
selectMarkerHalo(elementSelection).attr('visibility', getMarkerHaloVisibility);
|
|
43
|
-
selectMarkerSymbol(elementSelection).call(setMarker, hovered ? 'hover' : 'normal');
|
|
44
|
-
}
|
|
45
|
-
if (hovered) {
|
|
46
|
-
elementSelection.raise();
|
|
47
|
-
}
|
|
48
|
-
if (d.point.series.marker.states.normal.enabled) {
|
|
49
|
-
const isActive = Boolean(!inactiveEnabled ||
|
|
50
|
-
!selectedSeriesId ||
|
|
51
|
-
selectedSeriesId === d.point.series.id);
|
|
52
|
-
setActiveState({
|
|
53
|
-
element: list[index],
|
|
54
|
-
state: inactiveOptions,
|
|
55
|
-
active: isActive,
|
|
56
|
-
datum: d,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
return d;
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
return () => {
|
|
63
|
-
dispatcher.on('hover-shape.scatter', null);
|
|
64
|
-
};
|
|
65
|
-
}, [dispatcher, preparedData, seriesOptions]);
|
|
66
|
-
return (React.createElement(React.Fragment, null,
|
|
67
|
-
React.createElement("g", { ref: ref, className: b() }),
|
|
68
|
-
React.createElement(HtmlLayer, { preparedData: preparedData, htmlLayout: htmlLayout })));
|
|
69
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ChartScale } from '../../useAxisScales';
|
|
2
|
-
import type { PreparedAxis } from '../../useChartOptions/types';
|
|
3
|
-
import { PreparedScatterSeries } from '../../useSeries/types';
|
|
4
|
-
import { PreparedScatterData } from './types';
|
|
5
|
-
export declare const prepareScatterData: (args: {
|
|
6
|
-
series: PreparedScatterSeries[];
|
|
7
|
-
xAxis: PreparedAxis;
|
|
8
|
-
xScale: ChartScale;
|
|
9
|
-
yAxis: PreparedAxis[];
|
|
10
|
-
yScale: ChartScale[];
|
|
11
|
-
}) => PreparedScatterData[];
|