@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,169 +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
|
-
const DEFAULT_LABEL_PADDING = 7;
|
|
6
|
-
function groupByYValue(series, yAxis) {
|
|
7
|
-
const data = {};
|
|
8
|
-
series.forEach((s) => {
|
|
9
|
-
s.data.forEach((d) => {
|
|
10
|
-
const axisIndex = get(s, 'yAxis', 0);
|
|
11
|
-
const seriesYAxis = yAxis[axisIndex];
|
|
12
|
-
const categories = get(seriesYAxis, 'categories', []);
|
|
13
|
-
const key = seriesYAxis.type === 'category'
|
|
14
|
-
? getDataCategoryValue({ axisDirection: 'y', categories, data: d })
|
|
15
|
-
: d.y;
|
|
16
|
-
if (key) {
|
|
17
|
-
if (!data[key]) {
|
|
18
|
-
data[key] = {};
|
|
19
|
-
}
|
|
20
|
-
if (!data[key][s.stackId]) {
|
|
21
|
-
data[key][s.stackId] = [];
|
|
22
|
-
}
|
|
23
|
-
data[key][s.stackId].push({ data: d, series: s });
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
return data;
|
|
28
|
-
}
|
|
29
|
-
function getBandWidth(series, yAxis, yScale) {
|
|
30
|
-
let bandWidth = Infinity;
|
|
31
|
-
if (yAxis[0].type === 'category') {
|
|
32
|
-
bandWidth = yScale.bandwidth();
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
const scale = yScale;
|
|
36
|
-
const axisValues = series.reduce((acc, s) => {
|
|
37
|
-
s.data.forEach((dataItem) => acc.push(Number(dataItem.y)));
|
|
38
|
-
return acc;
|
|
39
|
-
}, []);
|
|
40
|
-
axisValues.sort().forEach((value, index) => {
|
|
41
|
-
if (index > 0 && value !== axisValues[index - 1]) {
|
|
42
|
-
const dist = scale(value) - scale(axisValues[index - 1]);
|
|
43
|
-
if (dist < bandWidth) {
|
|
44
|
-
bandWidth = dist;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
return bandWidth;
|
|
50
|
-
}
|
|
51
|
-
function setLabel(prepared) {
|
|
52
|
-
const dataLabels = prepared.series.dataLabels;
|
|
53
|
-
if (!dataLabels.enabled) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const data = prepared.data;
|
|
57
|
-
const content = String(data.label || data.x);
|
|
58
|
-
const { maxHeight: height, maxWidth: width } = getLabelsSize({
|
|
59
|
-
labels: [content],
|
|
60
|
-
style: dataLabels.style,
|
|
61
|
-
html: dataLabels.html,
|
|
62
|
-
});
|
|
63
|
-
const x = dataLabels.inside
|
|
64
|
-
? prepared.x + prepared.width / 2
|
|
65
|
-
: prepared.x + prepared.width + DEFAULT_LABEL_PADDING;
|
|
66
|
-
const y = prepared.y + prepared.height / 2;
|
|
67
|
-
if (dataLabels.html) {
|
|
68
|
-
prepared.htmlElements.push({
|
|
69
|
-
x,
|
|
70
|
-
y: y - height / 2,
|
|
71
|
-
content,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
prepared.label = {
|
|
76
|
-
x,
|
|
77
|
-
y: y + height / 2,
|
|
78
|
-
text: content,
|
|
79
|
-
textAnchor: dataLabels.inside ? 'middle' : 'right',
|
|
80
|
-
style: dataLabels.style,
|
|
81
|
-
series: prepared.series,
|
|
82
|
-
size: { width, height },
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
export const prepareBarYData = (args) => {
|
|
87
|
-
const { series, seriesOptions, yAxis, xScale, yScale: [yScale], } = args;
|
|
88
|
-
const xLinearScale = xScale;
|
|
89
|
-
const plotWidth = xLinearScale(xLinearScale.domain()[1]);
|
|
90
|
-
const barMaxWidth = get(seriesOptions, 'bar-y.barMaxWidth');
|
|
91
|
-
const barPadding = get(seriesOptions, 'bar-y.barPadding');
|
|
92
|
-
const groupPadding = get(seriesOptions, 'bar-y.groupPadding');
|
|
93
|
-
const sortingOptions = get(seriesOptions, 'bar-y.dataSorting');
|
|
94
|
-
const comparator = (sortingOptions === null || sortingOptions === void 0 ? void 0 : sortingOptions.direction) === 'desc' ? descending : ascending;
|
|
95
|
-
const sortKey = (() => {
|
|
96
|
-
switch (sortingOptions === null || sortingOptions === void 0 ? void 0 : sortingOptions.key) {
|
|
97
|
-
case 'x': {
|
|
98
|
-
return 'data.x';
|
|
99
|
-
}
|
|
100
|
-
case 'name': {
|
|
101
|
-
return 'series.name';
|
|
102
|
-
}
|
|
103
|
-
default: {
|
|
104
|
-
return undefined;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
})();
|
|
108
|
-
const groupedData = groupByYValue(series, yAxis);
|
|
109
|
-
const bandWidth = getBandWidth(series, yAxis, yScale);
|
|
110
|
-
const maxGroupSize = max(Object.values(groupedData), (d) => Object.values(d).length) || 1;
|
|
111
|
-
const groupGap = Math.max(bandWidth * groupPadding, MIN_BAR_GROUP_GAP);
|
|
112
|
-
const groupWidth = bandWidth - groupGap;
|
|
113
|
-
const rectGap = Math.max(bandWidth * barPadding, MIN_BAR_GAP);
|
|
114
|
-
const barHeight = Math.max(MIN_BAR_WIDTH, Math.min(groupWidth / maxGroupSize - rectGap, barMaxWidth));
|
|
115
|
-
const result = [];
|
|
116
|
-
Object.entries(groupedData).forEach(([yValue, val]) => {
|
|
117
|
-
const stacks = Object.values(val);
|
|
118
|
-
const currentBarHeight = barHeight * stacks.length + rectGap * (stacks.length - 1);
|
|
119
|
-
stacks.forEach((measureValues, groupItemIndex) => {
|
|
120
|
-
const base = xLinearScale(0);
|
|
121
|
-
let stackSum = base;
|
|
122
|
-
const stackItems = [];
|
|
123
|
-
const sortedData = sortKey
|
|
124
|
-
? sort(measureValues, (a, b) => comparator(get(a, sortKey), get(b, sortKey)))
|
|
125
|
-
: measureValues;
|
|
126
|
-
sortedData.forEach(({ data, series: s }) => {
|
|
127
|
-
let center;
|
|
128
|
-
if (yAxis[0].type === 'category') {
|
|
129
|
-
const bandScale = yScale;
|
|
130
|
-
center = (bandScale(yValue) || 0) + bandWidth / 2;
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
const scale = yScale;
|
|
134
|
-
center = scale(Number(yValue));
|
|
135
|
-
}
|
|
136
|
-
const y = center - currentBarHeight / 2 + (barHeight + rectGap) * groupItemIndex;
|
|
137
|
-
const xValue = Number(data.x);
|
|
138
|
-
const width = xValue > 0 ? xLinearScale(xValue) - base : base - xLinearScale(xValue);
|
|
139
|
-
const item = {
|
|
140
|
-
x: xValue > 0 ? stackSum : stackSum - width,
|
|
141
|
-
y,
|
|
142
|
-
width,
|
|
143
|
-
height: barHeight,
|
|
144
|
-
color: data.color || s.color,
|
|
145
|
-
opacity: get(data, 'opacity', null),
|
|
146
|
-
data,
|
|
147
|
-
series: s,
|
|
148
|
-
htmlElements: [],
|
|
149
|
-
};
|
|
150
|
-
stackItems.push(item);
|
|
151
|
-
stackSum += width + 1;
|
|
152
|
-
});
|
|
153
|
-
if (series.some((s) => s.stacking === 'percent')) {
|
|
154
|
-
let acc = 0;
|
|
155
|
-
const ratio = plotWidth / (stackSum - stackItems.length);
|
|
156
|
-
stackItems.forEach((item) => {
|
|
157
|
-
item.width = item.width * ratio;
|
|
158
|
-
item.x = acc;
|
|
159
|
-
acc += item.width;
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
result.push(...stackItems);
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
result.forEach((d) => {
|
|
166
|
-
setLabel(d);
|
|
167
|
-
});
|
|
168
|
-
return result;
|
|
169
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TooltipDataChunkBarX } from '../../../../../../types';
|
|
2
|
-
import { HtmlItem, LabelData } from '../../../types';
|
|
3
|
-
import { PreparedBarYSeries } from '../../useSeries/types';
|
|
4
|
-
export type PreparedBarYData = Omit<TooltipDataChunkBarX, 'series'> & {
|
|
5
|
-
x: number;
|
|
6
|
-
y: number;
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
color: string;
|
|
10
|
-
opacity: number | null;
|
|
11
|
-
series: PreparedBarYSeries;
|
|
12
|
-
label?: LabelData;
|
|
13
|
-
htmlElements: HtmlItem[];
|
|
14
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Dispatch } from 'd3';
|
|
3
|
-
import type { PreparedSeries, PreparedSeriesOptions, PreparedSplit } from '../';
|
|
4
|
-
import type { ChartScale } from '../useAxisScales';
|
|
5
|
-
import type { PreparedAxis } from '../useChartOptions/types';
|
|
6
|
-
import type { PreparedAreaData } from './area/types';
|
|
7
|
-
import type { PreparedBarXData } from './bar-x';
|
|
8
|
-
import type { PreparedBarYData } from './bar-y/types';
|
|
9
|
-
import type { PreparedLineData } from './line/types';
|
|
10
|
-
import type { PreparedPieData } from './pie/types';
|
|
11
|
-
import type { PreparedScatterData } from './scatter/types';
|
|
12
|
-
export type { PreparedBarXData } from './bar-x';
|
|
13
|
-
export type { PreparedScatterData } from './scatter/types';
|
|
14
|
-
import { PreparedWaterfallData } from './waterfall';
|
|
15
|
-
import './styles.css';
|
|
16
|
-
export type ShapeData = PreparedBarXData | PreparedBarYData | PreparedScatterData | PreparedLineData | PreparedPieData | PreparedAreaData | PreparedWaterfallData;
|
|
17
|
-
type Args = {
|
|
18
|
-
boundsWidth: number;
|
|
19
|
-
boundsHeight: number;
|
|
20
|
-
dispatcher: Dispatch<object>;
|
|
21
|
-
series: PreparedSeries[];
|
|
22
|
-
seriesOptions: PreparedSeriesOptions;
|
|
23
|
-
xAxis: PreparedAxis;
|
|
24
|
-
yAxis: PreparedAxis[];
|
|
25
|
-
xScale?: ChartScale;
|
|
26
|
-
yScale?: ChartScale[];
|
|
27
|
-
split: PreparedSplit;
|
|
28
|
-
htmlLayout: HTMLElement | null;
|
|
29
|
-
};
|
|
30
|
-
export declare const useShapes: (args: Args) => {
|
|
31
|
-
shapes: React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
|
|
32
|
-
shapesData: ShapeData[];
|
|
33
|
-
};
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { group } from 'd3';
|
|
3
|
-
import { getOnlyVisibleSeries } from '../../utils';
|
|
4
|
-
import { AreaSeriesShapes } from './area';
|
|
5
|
-
import { prepareAreaData } from './area/prepare-data';
|
|
6
|
-
import { BarXSeriesShapes, prepareBarXData } from './bar-x';
|
|
7
|
-
import { BarYSeriesShapes, prepareBarYData } from './bar-y';
|
|
8
|
-
import { LineSeriesShapes } from './line';
|
|
9
|
-
import { prepareLineData } from './line/prepare-data';
|
|
10
|
-
import { PieSeriesShapes } from './pie';
|
|
11
|
-
import { preparePieData } from './pie/prepare-data';
|
|
12
|
-
import { ScatterSeriesShape, prepareScatterData } from './scatter';
|
|
13
|
-
import { TreemapSeriesShape } from './treemap';
|
|
14
|
-
import { prepareTreemapData } from './treemap/prepare-data';
|
|
15
|
-
import { WaterfallSeriesShapes, prepareWaterfallData } from './waterfall';
|
|
16
|
-
import './styles.css';
|
|
17
|
-
export const useShapes = (args) => {
|
|
18
|
-
const { boundsWidth, boundsHeight, dispatcher, series, seriesOptions, xAxis, xScale, yAxis, yScale, split, htmlLayout, } = args;
|
|
19
|
-
const shapesComponents = React.useMemo(() => {
|
|
20
|
-
const visibleSeries = getOnlyVisibleSeries(series);
|
|
21
|
-
const groupedSeries = group(visibleSeries, (item) => item.type);
|
|
22
|
-
const shapesData = [];
|
|
23
|
-
const shapes = Array.from(groupedSeries).reduce((acc, item) => {
|
|
24
|
-
const [seriesType, chartSeries] = item;
|
|
25
|
-
switch (seriesType) {
|
|
26
|
-
case 'bar-x': {
|
|
27
|
-
if (xScale && yScale) {
|
|
28
|
-
const preparedData = prepareBarXData({
|
|
29
|
-
series: chartSeries,
|
|
30
|
-
seriesOptions,
|
|
31
|
-
xAxis,
|
|
32
|
-
xScale,
|
|
33
|
-
yAxis,
|
|
34
|
-
yScale,
|
|
35
|
-
boundsHeight,
|
|
36
|
-
});
|
|
37
|
-
acc.push(React.createElement(BarXSeriesShapes, { key: "bar-x", dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout }));
|
|
38
|
-
shapesData.push(...preparedData);
|
|
39
|
-
}
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
case 'bar-y': {
|
|
43
|
-
if (xScale && yScale) {
|
|
44
|
-
const preparedData = prepareBarYData({
|
|
45
|
-
series: chartSeries,
|
|
46
|
-
seriesOptions,
|
|
47
|
-
xAxis,
|
|
48
|
-
xScale,
|
|
49
|
-
yAxis,
|
|
50
|
-
yScale,
|
|
51
|
-
});
|
|
52
|
-
acc.push(React.createElement(BarYSeriesShapes, { key: "bar-y", dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout }));
|
|
53
|
-
shapesData.push(...preparedData);
|
|
54
|
-
}
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
case 'waterfall': {
|
|
58
|
-
if (xScale && yScale) {
|
|
59
|
-
const preparedData = prepareWaterfallData({
|
|
60
|
-
series: chartSeries,
|
|
61
|
-
seriesOptions,
|
|
62
|
-
xAxis,
|
|
63
|
-
xScale,
|
|
64
|
-
yAxis,
|
|
65
|
-
yScale,
|
|
66
|
-
});
|
|
67
|
-
acc.push(React.createElement(WaterfallSeriesShapes, { key: "waterfall", dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout }));
|
|
68
|
-
shapesData.push(...preparedData);
|
|
69
|
-
}
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
case 'line': {
|
|
73
|
-
if (xScale && yScale) {
|
|
74
|
-
const preparedData = prepareLineData({
|
|
75
|
-
series: chartSeries,
|
|
76
|
-
xAxis,
|
|
77
|
-
xScale,
|
|
78
|
-
yAxis,
|
|
79
|
-
yScale,
|
|
80
|
-
split,
|
|
81
|
-
});
|
|
82
|
-
acc.push(React.createElement(LineSeriesShapes, { key: "line", dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout }));
|
|
83
|
-
shapesData.push(...preparedData);
|
|
84
|
-
}
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
case 'area': {
|
|
88
|
-
if (xScale && yScale) {
|
|
89
|
-
const preparedData = prepareAreaData({
|
|
90
|
-
series: chartSeries,
|
|
91
|
-
xAxis,
|
|
92
|
-
xScale,
|
|
93
|
-
yAxis,
|
|
94
|
-
yScale,
|
|
95
|
-
boundsHeight,
|
|
96
|
-
});
|
|
97
|
-
acc.push(React.createElement(AreaSeriesShapes, { key: "area", dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout }));
|
|
98
|
-
shapesData.push(...preparedData);
|
|
99
|
-
}
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
case 'scatter': {
|
|
103
|
-
if (xScale && yScale) {
|
|
104
|
-
const preparedData = prepareScatterData({
|
|
105
|
-
series: chartSeries,
|
|
106
|
-
xAxis,
|
|
107
|
-
xScale,
|
|
108
|
-
yAxis,
|
|
109
|
-
yScale,
|
|
110
|
-
});
|
|
111
|
-
acc.push(React.createElement(ScatterSeriesShape, { key: "scatter", dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
|
|
112
|
-
shapesData.push(...preparedData);
|
|
113
|
-
}
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
case 'pie': {
|
|
117
|
-
const preparedData = preparePieData({
|
|
118
|
-
series: chartSeries,
|
|
119
|
-
boundsWidth,
|
|
120
|
-
boundsHeight,
|
|
121
|
-
});
|
|
122
|
-
acc.push(React.createElement(PieSeriesShapes, { key: "pie", dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
|
|
123
|
-
shapesData.push(...preparedData);
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
case 'treemap': {
|
|
127
|
-
const preparedData = prepareTreemapData({
|
|
128
|
-
// We should have exactly one series with "treemap" type
|
|
129
|
-
// Otherwise data validation should emit an error
|
|
130
|
-
series: chartSeries[0],
|
|
131
|
-
width: boundsWidth,
|
|
132
|
-
height: boundsHeight,
|
|
133
|
-
});
|
|
134
|
-
acc.push(React.createElement(TreemapSeriesShape, { key: "treemap", dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
|
|
135
|
-
shapesData.push(preparedData);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return acc;
|
|
139
|
-
}, []);
|
|
140
|
-
return { shapes, shapesData };
|
|
141
|
-
}, [
|
|
142
|
-
boundsWidth,
|
|
143
|
-
boundsHeight,
|
|
144
|
-
dispatcher,
|
|
145
|
-
series,
|
|
146
|
-
seriesOptions,
|
|
147
|
-
xAxis,
|
|
148
|
-
xScale,
|
|
149
|
-
yAxis,
|
|
150
|
-
yScale,
|
|
151
|
-
]);
|
|
152
|
-
return { shapes: shapesComponents.shapes, shapesData: shapesComponents.shapesData };
|
|
153
|
-
};
|
|
@@ -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 { PreparedLineData } from './types';
|
|
5
|
-
type Args = {
|
|
6
|
-
dispatcher: Dispatch<object>;
|
|
7
|
-
preparedData: PreparedLineData[];
|
|
8
|
-
seriesOptions: PreparedSeriesOptions;
|
|
9
|
-
htmlLayout: HTMLElement | null;
|
|
10
|
-
};
|
|
11
|
-
export declare const LineSeriesShapes: (args: Args) => React.JSX.Element;
|
|
12
|
-
export {};
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { color, line as lineGenerator, 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
|
-
import { getMarkerHaloVisibility, getMarkerVisibility, renderMarker, selectMarkerHalo, selectMarkerSymbol, setMarker, } from '../marker';
|
|
8
|
-
import { getLineDashArray, setActiveState } from '../utils';
|
|
9
|
-
const b = block('d3-line');
|
|
10
|
-
export const LineSeriesShapes = (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, 'line.states.hover');
|
|
20
|
-
const inactiveOptions = get(seriesOptions, 'line.states.inactive');
|
|
21
|
-
const line = lineGenerator()
|
|
22
|
-
.x((d) => d.x)
|
|
23
|
-
.y((d) => d.y);
|
|
24
|
-
svgElement.selectAll('*').remove();
|
|
25
|
-
const lineSelection = svgElement
|
|
26
|
-
.selectAll('path')
|
|
27
|
-
.data(preparedData)
|
|
28
|
-
.join('path')
|
|
29
|
-
.attr('d', (d) => line(d.points))
|
|
30
|
-
.attr('fill', 'none')
|
|
31
|
-
.attr('stroke', (d) => d.color)
|
|
32
|
-
.attr('stroke-width', (d) => d.width)
|
|
33
|
-
.attr('stroke-linejoin', (d) => d.linecap)
|
|
34
|
-
.attr('stroke-linecap', (d) => d.linecap)
|
|
35
|
-
.attr('stroke-dasharray', (d) => getLineDashArray(d.dashStyle, d.width))
|
|
36
|
-
.attr('opacity', (d) => d.opacity)
|
|
37
|
-
.attr('cursor', (d) => d.series.cursor);
|
|
38
|
-
let dataLabels = preparedData.reduce((acc, d) => {
|
|
39
|
-
return acc.concat(d.labels);
|
|
40
|
-
}, []);
|
|
41
|
-
if (!((_a = preparedData[0]) === null || _a === void 0 ? void 0 : _a.series.dataLabels.allowOverlap)) {
|
|
42
|
-
dataLabels = filterOverlappingLabels(dataLabels);
|
|
43
|
-
}
|
|
44
|
-
const labelsSelection = svgElement
|
|
45
|
-
.selectAll('text')
|
|
46
|
-
.data(dataLabels)
|
|
47
|
-
.join('text')
|
|
48
|
-
.text((d) => d.text)
|
|
49
|
-
.attr('class', b('label'))
|
|
50
|
-
.attr('x', (d) => d.x)
|
|
51
|
-
.attr('y', (d) => d.y)
|
|
52
|
-
.attr('text-anchor', (d) => d.textAnchor)
|
|
53
|
-
.style('font-size', (d) => d.style.fontSize)
|
|
54
|
-
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
55
|
-
.style('fill', (d) => d.style.fontColor || null);
|
|
56
|
-
const markers = preparedData.reduce((acc, d) => acc.concat(d.markers), []);
|
|
57
|
-
const markerSelection = svgElement
|
|
58
|
-
.selectAll('marker')
|
|
59
|
-
.data(markers)
|
|
60
|
-
.join('g')
|
|
61
|
-
.call(renderMarker);
|
|
62
|
-
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
63
|
-
const inactiveEnabled = inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled;
|
|
64
|
-
dispatcher.on('hover-shape.line', (data) => {
|
|
65
|
-
const selected = (data === null || data === void 0 ? void 0 : data.filter((d) => d.series.type === 'line')) || [];
|
|
66
|
-
const selectedDataItems = selected.map((d) => d.data);
|
|
67
|
-
const selectedSeriesIds = selected.map((d) => { var _a; return (_a = d.series) === null || _a === void 0 ? void 0 : _a.id; });
|
|
68
|
-
lineSelection.datum((d, index, list) => {
|
|
69
|
-
const elementSelection = select(list[index]);
|
|
70
|
-
const hovered = Boolean(hoverEnabled && selectedSeriesIds.includes(d.id));
|
|
71
|
-
if (d.hovered !== hovered) {
|
|
72
|
-
d.hovered = hovered;
|
|
73
|
-
elementSelection.attr('stroke', (d) => {
|
|
74
|
-
var _a;
|
|
75
|
-
const initialColor = d.color || '';
|
|
76
|
-
if (d.hovered) {
|
|
77
|
-
return (((_a = color(initialColor)) === null || _a === void 0 ? void 0 : _a.brighter(hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.brightness).toString()) || initialColor);
|
|
78
|
-
}
|
|
79
|
-
return initialColor;
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
return setActiveState({
|
|
83
|
-
element: list[index],
|
|
84
|
-
state: inactiveOptions,
|
|
85
|
-
active: Boolean(!inactiveEnabled ||
|
|
86
|
-
!selectedSeriesIds.length ||
|
|
87
|
-
selectedSeriesIds.includes(d.id)),
|
|
88
|
-
datum: d,
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
labelsSelection.datum((d, index, list) => {
|
|
92
|
-
return setActiveState({
|
|
93
|
-
element: list[index],
|
|
94
|
-
state: inactiveOptions,
|
|
95
|
-
active: Boolean(!inactiveEnabled ||
|
|
96
|
-
!selectedSeriesIds.length ||
|
|
97
|
-
selectedSeriesIds.includes(d.series.id)),
|
|
98
|
-
datum: d,
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
markerSelection.datum((d, index, list) => {
|
|
102
|
-
const elementSelection = select(list[index]);
|
|
103
|
-
const hovered = Boolean(hoverEnabled && selectedDataItems.includes(d.point.data));
|
|
104
|
-
if (d.hovered !== hovered) {
|
|
105
|
-
d.hovered = hovered;
|
|
106
|
-
elementSelection.attr('visibility', getMarkerVisibility(d));
|
|
107
|
-
selectMarkerHalo(elementSelection).attr('visibility', getMarkerHaloVisibility);
|
|
108
|
-
selectMarkerSymbol(elementSelection).call(setMarker, hovered ? 'hover' : 'normal');
|
|
109
|
-
}
|
|
110
|
-
if (d.point.series.marker.states.normal.enabled) {
|
|
111
|
-
const isActive = Boolean(!inactiveEnabled ||
|
|
112
|
-
!selectedSeriesIds.length ||
|
|
113
|
-
selectedSeriesIds.includes(d.point.series.id));
|
|
114
|
-
setActiveState({
|
|
115
|
-
element: list[index],
|
|
116
|
-
state: inactiveOptions,
|
|
117
|
-
active: isActive,
|
|
118
|
-
datum: d,
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
return d;
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
return () => {
|
|
125
|
-
dispatcher.on('hover-shape.line', null);
|
|
126
|
-
};
|
|
127
|
-
}, [dispatcher, preparedData, seriesOptions]);
|
|
128
|
-
return (React.createElement(React.Fragment, null,
|
|
129
|
-
React.createElement("g", { ref: ref, className: b() }),
|
|
130
|
-
React.createElement(HtmlLayer, { preparedData: preparedData, htmlLayout: htmlLayout })));
|
|
131
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ChartScale } from '../../useAxisScales';
|
|
2
|
-
import type { PreparedAxis } from '../../useChartOptions/types';
|
|
3
|
-
import type { PreparedLineSeries } from '../../useSeries/types';
|
|
4
|
-
import type { PreparedSplit } from '../../useSplit/types';
|
|
5
|
-
import type { PreparedLineData } from './types';
|
|
6
|
-
export declare const prepareLineData: (args: {
|
|
7
|
-
series: PreparedLineSeries[];
|
|
8
|
-
xAxis: PreparedAxis;
|
|
9
|
-
xScale: ChartScale;
|
|
10
|
-
yAxis: PreparedAxis[];
|
|
11
|
-
yScale: ChartScale[];
|
|
12
|
-
split: PreparedSplit;
|
|
13
|
-
}) => PreparedLineData[];
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { getLabelsSize, getLeftPosition } from '../../../utils';
|
|
2
|
-
import { getXValue, getYValue } from '../utils';
|
|
3
|
-
function getLabelData(point, series, xMax) {
|
|
4
|
-
const text = String(point.data.label || point.data.y);
|
|
5
|
-
const style = series.dataLabels.style;
|
|
6
|
-
const size = getLabelsSize({ labels: [text], style });
|
|
7
|
-
const labelData = {
|
|
8
|
-
text,
|
|
9
|
-
x: point.x,
|
|
10
|
-
y: point.y - series.dataLabels.padding,
|
|
11
|
-
style,
|
|
12
|
-
size: { width: size.maxWidth, height: size.maxHeight },
|
|
13
|
-
textAnchor: 'middle',
|
|
14
|
-
series: series,
|
|
15
|
-
active: true,
|
|
16
|
-
};
|
|
17
|
-
const left = getLeftPosition(labelData);
|
|
18
|
-
if (left < 0) {
|
|
19
|
-
labelData.x = labelData.x + Math.abs(left);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
const right = left + labelData.size.width;
|
|
23
|
-
if (right > xMax) {
|
|
24
|
-
labelData.x = labelData.x - xMax - right;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return labelData;
|
|
28
|
-
}
|
|
29
|
-
function getHtmlLabel(point, series, xMax) {
|
|
30
|
-
const content = String(point.data.label || point.data.y);
|
|
31
|
-
const size = getLabelsSize({ labels: [content], html: true });
|
|
32
|
-
return {
|
|
33
|
-
x: Math.min(xMax - size.maxWidth, Math.max(0, point.x)),
|
|
34
|
-
y: Math.max(0, point.y - series.dataLabels.padding - size.maxHeight),
|
|
35
|
-
content,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
export const prepareLineData = (args) => {
|
|
39
|
-
const { series, xAxis, yAxis, xScale, yScale, split } = args;
|
|
40
|
-
const [_xMin, xRangeMax] = xScale.range();
|
|
41
|
-
const xMax = xRangeMax / (1 - xAxis.maxPadding);
|
|
42
|
-
return series.reduce((acc, s) => {
|
|
43
|
-
var _a;
|
|
44
|
-
const yAxisIndex = s.yAxis;
|
|
45
|
-
const seriesYAxis = yAxis[yAxisIndex];
|
|
46
|
-
const yAxisTop = ((_a = split.plots[seriesYAxis.plotIndex]) === null || _a === void 0 ? void 0 : _a.top) || 0;
|
|
47
|
-
const seriesYScale = yScale[s.yAxis];
|
|
48
|
-
const points = s.data.map((d) => ({
|
|
49
|
-
x: getXValue({ point: d, xAxis, xScale }),
|
|
50
|
-
y: yAxisTop + getYValue({ point: d, yAxis: seriesYAxis, yScale: seriesYScale }),
|
|
51
|
-
active: true,
|
|
52
|
-
data: d,
|
|
53
|
-
series: s,
|
|
54
|
-
}));
|
|
55
|
-
const htmlElements = [];
|
|
56
|
-
let labels = [];
|
|
57
|
-
if (s.dataLabels.enabled) {
|
|
58
|
-
if (s.dataLabels.html) {
|
|
59
|
-
htmlElements.push(...points.map((p) => getHtmlLabel(p, s, xMax)));
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
labels = points.map((p) => getLabelData(p, s, xMax));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
let markers = [];
|
|
66
|
-
if (s.marker.states.normal.enabled || s.marker.states.hover.enabled) {
|
|
67
|
-
markers = points.map((p) => ({
|
|
68
|
-
point: p,
|
|
69
|
-
active: true,
|
|
70
|
-
hovered: false,
|
|
71
|
-
}));
|
|
72
|
-
}
|
|
73
|
-
const result = {
|
|
74
|
-
points,
|
|
75
|
-
markers,
|
|
76
|
-
labels,
|
|
77
|
-
color: s.color,
|
|
78
|
-
width: s.lineWidth,
|
|
79
|
-
series: s,
|
|
80
|
-
hovered: false,
|
|
81
|
-
active: true,
|
|
82
|
-
id: s.id,
|
|
83
|
-
dashStyle: s.dashStyle,
|
|
84
|
-
linecap: s.linecap,
|
|
85
|
-
opacity: s.opacity,
|
|
86
|
-
htmlElements,
|
|
87
|
-
};
|
|
88
|
-
acc.push(result);
|
|
89
|
-
return acc;
|
|
90
|
-
}, []);
|
|
91
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { DashStyle, LineCap } from '../../../../../../constants';
|
|
2
|
-
import { LineSeriesData } from '../../../../../../types';
|
|
3
|
-
import { HtmlItem, LabelData } from '../../../types';
|
|
4
|
-
import { PreparedLineSeries } from '../../useSeries/types';
|
|
5
|
-
export type PointData = {
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
8
|
-
data: LineSeriesData;
|
|
9
|
-
series: PreparedLineSeries;
|
|
10
|
-
};
|
|
11
|
-
export type MarkerData = {
|
|
12
|
-
point: PointData;
|
|
13
|
-
active: boolean;
|
|
14
|
-
hovered: boolean;
|
|
15
|
-
};
|
|
16
|
-
export type PreparedLineData = {
|
|
17
|
-
id: string;
|
|
18
|
-
points: PointData[];
|
|
19
|
-
markers: MarkerData[];
|
|
20
|
-
color: string;
|
|
21
|
-
width: number;
|
|
22
|
-
series: PreparedLineSeries;
|
|
23
|
-
hovered: boolean;
|
|
24
|
-
active: boolean;
|
|
25
|
-
labels: LabelData[];
|
|
26
|
-
dashStyle: DashStyle;
|
|
27
|
-
linecap: LineCap;
|
|
28
|
-
opacity: number | null;
|
|
29
|
-
htmlElements: HtmlItem[];
|
|
30
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|