@gravity-ui/chartkit 5.17.1 → 5.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/ChartKit.css +0 -1
- package/build/components/SplitPane/Pane.d.ts +14 -0
- package/build/components/SplitPane/Pane.js +26 -0
- package/build/components/SplitPane/Resizer.d.ts +18 -0
- package/build/components/SplitPane/Resizer.js +26 -0
- package/build/components/SplitPane/SplitPane.d.ts +59 -0
- package/build/components/SplitPane/SplitPane.js +235 -0
- package/build/{plugins/highcharts/renderer/components/StyledSplitPane → components/SplitPane}/StyledSplitPane.css +0 -1
- package/build/{plugins/highcharts/renderer/components/StyledSplitPane → components/SplitPane}/StyledSplitPane.d.ts +1 -1
- package/build/{plugins/highcharts/renderer/components/StyledSplitPane → components/SplitPane}/StyledSplitPane.js +3 -3
- package/build/components/SplitPane/constants.d.ts +4 -0
- package/build/components/SplitPane/constants.js +4 -0
- package/build/components/SplitPane/index.d.ts +8 -0
- package/build/components/SplitPane/index.js +18 -0
- package/build/components/SplitPane/types.d.ts +2 -0
- package/build/constants/index.d.ts +1 -0
- package/build/constants/index.js +1 -0
- package/build/constants/misc.d.ts +10 -0
- package/build/constants/misc.js +19 -0
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/misc.d.ts +1 -0
- package/build/hooks/misc.js +8 -0
- package/build/plugins/d3/index.d.ts +1 -1
- package/build/plugins/d3/index.js +2 -1
- package/build/plugins/d3/renderer/D3Widget.d.ts +5 -1
- package/build/plugins/d3/renderer/D3Widget.js +31 -66
- package/build/plugins/d3/renderer/withSplitPane/TooltipContent.d.ts +8 -0
- package/build/plugins/d3/renderer/withSplitPane/TooltipContent.js +12 -0
- package/build/plugins/d3/renderer/withSplitPane/useWithSplitPaneState.d.ts +19 -0
- package/build/plugins/d3/renderer/withSplitPane/useWithSplitPaneState.js +46 -0
- package/build/plugins/d3/renderer/withSplitPane/withSplitPane.d.ts +4 -0
- package/build/plugins/d3/renderer/withSplitPane/withSplitPane.js +100 -0
- package/build/plugins/d3/types.d.ts +2 -2
- package/build/plugins/highcharts/renderer/HighchartsWidget.d.ts +2 -2
- package/build/plugins/highcharts/renderer/components/withSplitPane/withSplitPane.js +1 -1
- package/build/types/index.js +1 -0
- package/build/types/widget-data/pie.d.ts +1 -1
- package/build/types/widget.d.ts +6 -3
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/build/utils/misc.d.ts +2 -0
- package/build/utils/misc.js +7 -0
- package/package.json +4 -4
- package/build/plugins/d3/examples/ExampleWrapper.d.ts +0 -7
- package/build/plugins/d3/examples/ExampleWrapper.js +0 -5
- package/build/plugins/d3/examples/area/Basic.d.ts +0 -2
- package/build/plugins/d3/examples/area/Basic.js +0 -34
- package/build/plugins/d3/examples/area/NegativeValues.d.ts +0 -2
- package/build/plugins/d3/examples/area/NegativeValues.js +0 -24
- package/build/plugins/d3/examples/area/PercentStacking.d.ts +0 -2
- package/build/plugins/d3/examples/area/PercentStacking.js +0 -47
- package/build/plugins/d3/examples/area/StackedArea.d.ts +0 -2
- package/build/plugins/d3/examples/area/StackedArea.js +0 -47
- package/build/plugins/d3/examples/area/TwoYAxis.d.ts +0 -2
- package/build/plugins/d3/examples/area/TwoYAxis.js +0 -58
- package/build/plugins/d3/examples/bar-x/Basic.d.ts +0 -4
- package/build/plugins/d3/examples/bar-x/Basic.js +0 -88
- package/build/plugins/d3/examples/bar-x/DataLabels.d.ts +0 -2
- package/build/plugins/d3/examples/bar-x/DataLabels.js +0 -48
- package/build/plugins/d3/examples/bar-x/GroupedColumns.d.ts +0 -2
- package/build/plugins/d3/examples/bar-x/GroupedColumns.js +0 -48
- package/build/plugins/d3/examples/bar-x/NegativeValues.d.ts +0 -2
- package/build/plugins/d3/examples/bar-x/NegativeValues.js +0 -41
- package/build/plugins/d3/examples/bar-x/PercentStack.d.ts +0 -2
- package/build/plugins/d3/examples/bar-x/PercentStack.js +0 -47
- package/build/plugins/d3/examples/bar-x/StackedColumns.d.ts +0 -2
- package/build/plugins/d3/examples/bar-x/StackedColumns.js +0 -47
- package/build/plugins/d3/examples/bar-x/TwoYAxis.d.ts +0 -2
- package/build/plugins/d3/examples/bar-x/TwoYAxis.js +0 -58
- package/build/plugins/d3/examples/bar-y/Basic.d.ts +0 -2
- package/build/plugins/d3/examples/bar-y/Basic.js +0 -45
- package/build/plugins/d3/examples/bar-y/GroupedColumns.d.ts +0 -2
- package/build/plugins/d3/examples/bar-y/GroupedColumns.js +0 -50
- package/build/plugins/d3/examples/bar-y/NegativeValues.d.ts +0 -2
- package/build/plugins/d3/examples/bar-y/NegativeValues.js +0 -40
- package/build/plugins/d3/examples/bar-y/PercentStacking.d.ts +0 -2
- package/build/plugins/d3/examples/bar-y/PercentStacking.js +0 -49
- package/build/plugins/d3/examples/bar-y/StackedColumns.d.ts +0 -2
- package/build/plugins/d3/examples/bar-y/StackedColumns.js +0 -49
- package/build/plugins/d3/examples/combined/LineAndBarX.d.ts +0 -2
- package/build/plugins/d3/examples/combined/LineAndBarX.js +0 -63
- package/build/plugins/d3/examples/line/Basic.d.ts +0 -2
- package/build/plugins/d3/examples/line/Basic.js +0 -68
- package/build/plugins/d3/examples/line/DataLabels.d.ts +0 -2
- package/build/plugins/d3/examples/line/DataLabels.js +0 -91
- package/build/plugins/d3/examples/line/LineWithMarkers.d.ts +0 -2
- package/build/plugins/d3/examples/line/LineWithMarkers.js +0 -69
- package/build/plugins/d3/examples/line/LogarithmicAxis.d.ts +0 -2
- package/build/plugins/d3/examples/line/LogarithmicAxis.js +0 -38
- package/build/plugins/d3/examples/line/Shapes.d.ts +0 -2
- package/build/plugins/d3/examples/line/Shapes.js +0 -93
- package/build/plugins/d3/examples/line/TwoYAxis.d.ts +0 -2
- package/build/plugins/d3/examples/line/TwoYAxis.js +0 -58
- package/build/plugins/d3/examples/mars-weather.d.ts +0 -13
- package/build/plugins/d3/examples/mars-weather.js +0 -1203
- package/build/plugins/d3/examples/nintendoGames.d.ts +0 -92
- package/build/plugins/d3/examples/nintendoGames.js +0 -12264
- package/build/plugins/d3/examples/pie/Basic.d.ts +0 -2
- package/build/plugins/d3/examples/pie/Basic.js +0 -32
- package/build/plugins/d3/examples/pie/Donut.d.ts +0 -2
- package/build/plugins/d3/examples/pie/Donut.js +0 -33
- package/build/plugins/d3/examples/pie/DonutWithTotals.d.ts +0 -2
- package/build/plugins/d3/examples/pie/DonutWithTotals.js +0 -36
- package/build/plugins/d3/examples/scatter/Basic.d.ts +0 -2
- package/build/plugins/d3/examples/scatter/Basic.js +0 -47
- package/build/plugins/d3/examples/scatter/TwoYAxis.d.ts +0 -2
- package/build/plugins/d3/examples/scatter/TwoYAxis.js +0 -58
- package/build/plugins/d3/renderer/components/AxisX.d.ts +0 -19
- package/build/plugins/d3/renderer/components/AxisX.js +0 -108
- package/build/plugins/d3/renderer/components/AxisY.d.ts +0 -11
- package/build/plugins/d3/renderer/components/AxisY.js +0 -199
- package/build/plugins/d3/renderer/components/Chart.d.ts +0 -10
- package/build/plugins/d3/renderer/components/Chart.js +0 -145
- package/build/plugins/d3/renderer/components/Legend.d.ts +0 -12
- package/build/plugins/d3/renderer/components/Legend.js +0 -278
- package/build/plugins/d3/renderer/components/PlotTitle.d.ts +0 -7
- package/build/plugins/d3/renderer/components/PlotTitle.js +0 -12
- package/build/plugins/d3/renderer/components/Title.d.ts +0 -7
- package/build/plugins/d3/renderer/components/Title.js +0 -8
- package/build/plugins/d3/renderer/components/Tooltip/DefaultContent.d.ts +0 -10
- package/build/plugins/d3/renderer/components/Tooltip/DefaultContent.js +0 -102
- package/build/plugins/d3/renderer/components/Tooltip/index.d.ts +0 -12
- package/build/plugins/d3/renderer/components/Tooltip/index.js +0 -28
- package/build/plugins/d3/renderer/components/index.d.ts +0 -1
- package/build/plugins/d3/renderer/components/index.js +0 -1
- package/build/plugins/d3/renderer/components/styles.css +0 -140
- package/build/plugins/d3/renderer/constants/defaults/axis.d.ts +0 -14
- package/build/plugins/d3/renderer/constants/defaults/axis.js +0 -18
- package/build/plugins/d3/renderer/constants/defaults/index.d.ts +0 -3
- package/build/plugins/d3/renderer/constants/defaults/index.js +0 -3
- package/build/plugins/d3/renderer/constants/defaults/legend.d.ts +0 -12
- package/build/plugins/d3/renderer/constants/defaults/legend.js +0 -12
- package/build/plugins/d3/renderer/constants/defaults/series-options.d.ts +0 -24
- package/build/plugins/d3/renderer/constants/defaults/series-options.js +0 -106
- package/build/plugins/d3/renderer/constants/index.d.ts +0 -3
- package/build/plugins/d3/renderer/constants/index.js +0 -24
- package/build/plugins/d3/renderer/d3-dispatcher.d.ts +0 -1
- package/build/plugins/d3/renderer/d3-dispatcher.js +0 -4
- package/build/plugins/d3/renderer/hooks/index.d.ts +0 -10
- package/build/plugins/d3/renderer/hooks/index.js +0 -10
- package/build/plugins/d3/renderer/hooks/useAxisScales/index.d.ts +0 -25
- package/build/plugins/d3/renderer/hooks/useAxisScales/index.js +0 -183
- package/build/plugins/d3/renderer/hooks/useChartDimensions/index.d.ts +0 -16
- package/build/plugins/d3/renderer/hooks/useChartDimensions/index.js +0 -34
- package/build/plugins/d3/renderer/hooks/useChartDimensions/utils.d.ts +0 -10
- package/build/plugins/d3/renderer/hooks/useChartDimensions/utils.js +0 -32
- package/build/plugins/d3/renderer/hooks/useChartOptions/chart.d.ts +0 -6
- package/build/plugins/d3/renderer/hooks/useChartOptions/chart.js +0 -28
- package/build/plugins/d3/renderer/hooks/useChartOptions/index.d.ts +0 -7
- package/build/plugins/d3/renderer/hooks/useChartOptions/index.js +0 -21
- package/build/plugins/d3/renderer/hooks/useChartOptions/title.d.ts +0 -5
- package/build/plugins/d3/renderer/hooks/useChartOptions/title.js +0 -18
- package/build/plugins/d3/renderer/hooks/useChartOptions/tooltip.d.ts +0 -5
- package/build/plugins/d3/renderer/hooks/useChartOptions/tooltip.js +0 -5
- package/build/plugins/d3/renderer/hooks/useChartOptions/types.d.ts +0 -47
- package/build/plugins/d3/renderer/hooks/useChartOptions/x-axis.d.ts +0 -7
- package/build/plugins/d3/renderer/hooks/useChartOptions/x-axis.js +0 -114
- package/build/plugins/d3/renderer/hooks/useChartOptions/y-axis.d.ts +0 -7
- package/build/plugins/d3/renderer/hooks/useChartOptions/y-axis.js +0 -116
- package/build/plugins/d3/renderer/hooks/useSeries/constants.d.ts +0 -8
- package/build/plugins/d3/renderer/hooks/useSeries/constants.js +0 -19
- package/build/plugins/d3/renderer/hooks/useSeries/index.d.ts +0 -29
- package/build/plugins/d3/renderer/hooks/useSeries/index.js +0 -82
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-area.d.ts +0 -19
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-area.js +0 -63
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-x.d.ts +0 -10
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-x.js +0 -38
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-y.d.ts +0 -10
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-y.js +0 -49
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-legend.d.ts +0 -27
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-legend.js +0 -144
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-line.d.ts +0 -22
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-line.js +0 -82
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-options.d.ts +0 -3
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-options.js +0 -5
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-pie.d.ts +0 -9
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-pie.js +0 -62
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-scatter.d.ts +0 -11
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-scatter.js +0 -47
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-treemap.d.ts +0 -11
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-treemap.js +0 -38
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-waterfall.d.ts +0 -10
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-waterfall.js +0 -37
- package/build/plugins/d3/renderer/hooks/useSeries/prepareSeries.d.ts +0 -10
- package/build/plugins/d3/renderer/hooks/useSeries/prepareSeries.js +0 -65
- package/build/plugins/d3/renderer/hooks/useSeries/types.d.ts +0 -254
- package/build/plugins/d3/renderer/hooks/useSeries/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useSeries/utils.d.ts +0 -7
- package/build/plugins/d3/renderer/hooks/useSeries/utils.js +0 -33
- package/build/plugins/d3/renderer/hooks/useShapes/HtmlLayer.d.ts +0 -8
- package/build/plugins/d3/renderer/hooks/useShapes/HtmlLayer.js +0 -22
- package/build/plugins/d3/renderer/hooks/useShapes/area/index.d.ts +0 -12
- package/build/plugins/d3/renderer/hooks/useShapes/area/index.js +0 -144
- package/build/plugins/d3/renderer/hooks/useShapes/area/prepare-data.d.ts +0 -12
- package/build/plugins/d3/renderer/hooks/useShapes/area/prepare-data.js +0 -158
- package/build/plugins/d3/renderer/hooks/useShapes/area/types.d.ts +0 -28
- package/build/plugins/d3/renderer/hooks/useShapes/area/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useShapes/bar-x/index.d.ts +0 -13
- package/build/plugins/d3/renderer/hooks/useShapes/bar-x/index.js +0 -96
- package/build/plugins/d3/renderer/hooks/useShapes/bar-x/prepare-data.d.ts +0 -13
- package/build/plugins/d3/renderer/hooks/useShapes/bar-x/prepare-data.js +0 -160
- package/build/plugins/d3/renderer/hooks/useShapes/bar-x/types.d.ts +0 -13
- package/build/plugins/d3/renderer/hooks/useShapes/bar-x/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/index.d.ts +0 -12
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/index.js +0 -84
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/prepare-data.d.ts +0 -12
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/prepare-data.js +0 -169
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/types.d.ts +0 -14
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useShapes/constants.d.ts +0 -3
- package/build/plugins/d3/renderer/hooks/useShapes/constants.js +0 -3
- package/build/plugins/d3/renderer/hooks/useShapes/index.d.ts +0 -33
- package/build/plugins/d3/renderer/hooks/useShapes/index.js +0 -153
- package/build/plugins/d3/renderer/hooks/useShapes/line/index.d.ts +0 -12
- package/build/plugins/d3/renderer/hooks/useShapes/line/index.js +0 -131
- package/build/plugins/d3/renderer/hooks/useShapes/line/prepare-data.d.ts +0 -13
- package/build/plugins/d3/renderer/hooks/useShapes/line/prepare-data.js +0 -91
- package/build/plugins/d3/renderer/hooks/useShapes/line/types.d.ts +0 -30
- package/build/plugins/d3/renderer/hooks/useShapes/line/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useShapes/marker.d.ts +0 -13
- package/build/plugins/d3/renderer/hooks/useShapes/marker.js +0 -76
- package/build/plugins/d3/renderer/hooks/useShapes/pie/index.d.ts +0 -13
- package/build/plugins/d3/renderer/hooks/useShapes/pie/index.js +0 -172
- package/build/plugins/d3/renderer/hooks/useShapes/pie/prepare-data.d.ts +0 -9
- package/build/plugins/d3/renderer/hooks/useShapes/pie/prepare-data.js +0 -186
- package/build/plugins/d3/renderer/hooks/useShapes/pie/types.d.ts +0 -42
- package/build/plugins/d3/renderer/hooks/useShapes/pie/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useShapes/pie/utils.d.ts +0 -4
- package/build/plugins/d3/renderer/hooks/useShapes/pie/utils.js +0 -15
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/index.d.ts +0 -12
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/index.js +0 -69
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/prepare-data.d.ts +0 -11
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/prepare-data.js +0 -31
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/types.d.ts +0 -18
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useShapes/styles.css +0 -36
- package/build/plugins/d3/renderer/hooks/useShapes/treemap/index.d.ts +0 -12
- package/build/plugins/d3/renderer/hooks/useShapes/treemap/index.js +0 -99
- package/build/plugins/d3/renderer/hooks/useShapes/treemap/prepare-data.d.ts +0 -7
- package/build/plugins/d3/renderer/hooks/useShapes/treemap/prepare-data.js +0 -114
- package/build/plugins/d3/renderer/hooks/useShapes/treemap/types.d.ts +0 -17
- package/build/plugins/d3/renderer/hooks/useShapes/treemap/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useShapes/utils.d.ts +0 -29
- package/build/plugins/d3/renderer/hooks/useShapes/utils.js +0 -53
- package/build/plugins/d3/renderer/hooks/useShapes/waterfall/index.d.ts +0 -13
- package/build/plugins/d3/renderer/hooks/useShapes/waterfall/index.js +0 -128
- package/build/plugins/d3/renderer/hooks/useShapes/waterfall/prepare-data.d.ts +0 -12
- package/build/plugins/d3/renderer/hooks/useShapes/waterfall/prepare-data.js +0 -133
- package/build/plugins/d3/renderer/hooks/useShapes/waterfall/types.d.ts +0 -15
- package/build/plugins/d3/renderer/hooks/useShapes/waterfall/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useSplit/index.d.ts +0 -14
- package/build/plugins/d3/renderer/hooks/useSplit/index.js +0 -57
- package/build/plugins/d3/renderer/hooks/useSplit/types.d.ts +0 -17
- package/build/plugins/d3/renderer/hooks/useSplit/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useTooltip/index.d.ts +0 -13
- package/build/plugins/d3/renderer/hooks/useTooltip/index.js +0 -17
- package/build/plugins/d3/renderer/hooks/useTooltip/types.d.ts +0 -1
- package/build/plugins/d3/renderer/hooks/useTooltip/types.js +0 -1
- package/build/plugins/d3/renderer/types/index.d.ts +0 -24
- package/build/plugins/d3/renderer/types/index.js +0 -1
- package/build/plugins/d3/renderer/utils/axis-generators/bottom.d.ts +0 -24
- package/build/plugins/d3/renderer/utils/axis-generators/bottom.js +0 -126
- package/build/plugins/d3/renderer/utils/axis-generators/index.d.ts +0 -1
- package/build/plugins/d3/renderer/utils/axis-generators/index.js +0 -1
- package/build/plugins/d3/renderer/utils/axis.d.ts +0 -31
- package/build/plugins/d3/renderer/utils/axis.js +0 -71
- package/build/plugins/d3/renderer/utils/color.d.ts +0 -10
- package/build/plugins/d3/renderer/utils/color.js +0 -43
- package/build/plugins/d3/renderer/utils/get-closest-data.d.ts +0 -15
- package/build/plugins/d3/renderer/utils/get-closest-data.js +0 -172
- package/build/plugins/d3/renderer/utils/index.d.ts +0 -78
- package/build/plugins/d3/renderer/utils/index.js +0 -211
- package/build/plugins/d3/renderer/utils/labels.d.ts +0 -6
- package/build/plugins/d3/renderer/utils/labels.js +0 -44
- package/build/plugins/d3/renderer/utils/legend.d.ts +0 -8
- package/build/plugins/d3/renderer/utils/legend.js +0 -23
- package/build/plugins/d3/renderer/utils/math.d.ts +0 -25
- package/build/plugins/d3/renderer/utils/math.js +0 -51
- package/build/plugins/d3/renderer/utils/series/index.d.ts +0 -1
- package/build/plugins/d3/renderer/utils/series/index.js +0 -1
- package/build/plugins/d3/renderer/utils/series/waterfall.d.ts +0 -4
- package/build/plugins/d3/renderer/utils/series/waterfall.js +0 -25
- package/build/plugins/d3/renderer/utils/symbol.d.ts +0 -3
- package/build/plugins/d3/renderer/utils/symbol.js +0 -36
- package/build/plugins/d3/renderer/utils/text.d.ts +0 -29
- package/build/plugins/d3/renderer/utils/text.js +0 -139
- package/build/plugins/d3/renderer/utils/time.d.ts +0 -3
- package/build/plugins/d3/renderer/utils/time.js +0 -34
- package/build/plugins/d3/renderer/validation/__mocks__/index.d.ts +0 -3
- package/build/plugins/d3/renderer/validation/__mocks__/index.js +0 -44
- package/build/plugins/d3/renderer/validation/index.d.ts +0 -2
- package/build/plugins/d3/renderer/validation/index.js +0 -221
- package/build/plugins/d3/utils/index.d.ts +0 -4
- package/build/plugins/d3/utils/index.js +0 -4
- package/build/plugins/d3/utils/pie-center-text.d.ts +0 -7
- package/build/plugins/d3/utils/pie-center-text.js +0 -23
- /package/build/{plugins/d3/renderer/hooks/useChartOptions → components/SplitPane}/types.js +0 -0
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { pointer } from 'd3';
|
|
3
|
-
import throttle from 'lodash/throttle';
|
|
4
|
-
import { block } from '../../../../utils/cn';
|
|
5
|
-
import { getD3Dispatcher } from '../d3-dispatcher';
|
|
6
|
-
import { useAxisScales, useChartDimensions, useChartOptions, useSeries, useShapes } from '../hooks';
|
|
7
|
-
import { getYAxisWidth } from '../hooks/useChartDimensions/utils';
|
|
8
|
-
import { getPreparedXAxis } from '../hooks/useChartOptions/x-axis';
|
|
9
|
-
import { getPreparedYAxis } from '../hooks/useChartOptions/y-axis';
|
|
10
|
-
import { useSplit } from '../hooks/useSplit';
|
|
11
|
-
import { getClosestPoints } from '../utils/get-closest-data';
|
|
12
|
-
import { AxisX } from './AxisX';
|
|
13
|
-
import { AxisY } from './AxisY';
|
|
14
|
-
import { Legend } from './Legend';
|
|
15
|
-
import { PlotTitle } from './PlotTitle';
|
|
16
|
-
import { Title } from './Title';
|
|
17
|
-
import { Tooltip } from './Tooltip';
|
|
18
|
-
import './styles.css';
|
|
19
|
-
const b = block('d3');
|
|
20
|
-
const THROTTLE_DELAY = 50;
|
|
21
|
-
export const Chart = (props) => {
|
|
22
|
-
var _a, _b;
|
|
23
|
-
const { width, height, data } = props;
|
|
24
|
-
const svgRef = React.useRef(null);
|
|
25
|
-
const htmlLayerRef = React.useRef(null);
|
|
26
|
-
const dispatcher = React.useMemo(() => {
|
|
27
|
-
return getD3Dispatcher();
|
|
28
|
-
}, []);
|
|
29
|
-
const { chart, title, tooltip } = useChartOptions({
|
|
30
|
-
data,
|
|
31
|
-
});
|
|
32
|
-
const xAxis = React.useMemo(() => getPreparedXAxis({ xAxis: data.xAxis, width, series: data.series.data }), [data, width]);
|
|
33
|
-
const yAxis = React.useMemo(() => getPreparedYAxis({
|
|
34
|
-
series: data.series.data,
|
|
35
|
-
yAxis: data.yAxis,
|
|
36
|
-
height,
|
|
37
|
-
}), [data, height]);
|
|
38
|
-
const { legendItems, legendConfig, preparedSeries, preparedSeriesOptions, preparedLegend, handleLegendItemClick, } = useSeries({
|
|
39
|
-
chartWidth: width,
|
|
40
|
-
chartHeight: height,
|
|
41
|
-
chartMargin: chart.margin,
|
|
42
|
-
series: data.series,
|
|
43
|
-
legend: data.legend,
|
|
44
|
-
preparedYAxis: yAxis,
|
|
45
|
-
});
|
|
46
|
-
const { boundsWidth, boundsHeight } = useChartDimensions({
|
|
47
|
-
width,
|
|
48
|
-
height,
|
|
49
|
-
margin: chart.margin,
|
|
50
|
-
preparedLegend,
|
|
51
|
-
preparedXAxis: xAxis,
|
|
52
|
-
preparedYAxis: yAxis,
|
|
53
|
-
preparedSeries: preparedSeries,
|
|
54
|
-
});
|
|
55
|
-
const preparedSplit = useSplit({ split: data.split, boundsHeight, chartWidth: width });
|
|
56
|
-
const { xScale, yScale } = useAxisScales({
|
|
57
|
-
boundsWidth,
|
|
58
|
-
boundsHeight,
|
|
59
|
-
series: preparedSeries,
|
|
60
|
-
xAxis,
|
|
61
|
-
yAxis,
|
|
62
|
-
split: preparedSplit,
|
|
63
|
-
});
|
|
64
|
-
const { shapes, shapesData } = useShapes({
|
|
65
|
-
boundsWidth,
|
|
66
|
-
boundsHeight,
|
|
67
|
-
dispatcher,
|
|
68
|
-
series: preparedSeries,
|
|
69
|
-
seriesOptions: preparedSeriesOptions,
|
|
70
|
-
xAxis,
|
|
71
|
-
xScale,
|
|
72
|
-
yAxis,
|
|
73
|
-
yScale,
|
|
74
|
-
split: preparedSplit,
|
|
75
|
-
htmlLayout: htmlLayerRef.current,
|
|
76
|
-
});
|
|
77
|
-
const clickHandler = (_b = (_a = data.chart) === null || _a === void 0 ? void 0 : _a.events) === null || _b === void 0 ? void 0 : _b.click;
|
|
78
|
-
React.useEffect(() => {
|
|
79
|
-
if (clickHandler) {
|
|
80
|
-
dispatcher.on('click-chart', clickHandler);
|
|
81
|
-
}
|
|
82
|
-
return () => {
|
|
83
|
-
dispatcher.on('click-chart', null);
|
|
84
|
-
};
|
|
85
|
-
}, [dispatcher, clickHandler]);
|
|
86
|
-
const boundsOffsetTop = chart.margin.top;
|
|
87
|
-
// We only need to consider the width of the first left axis
|
|
88
|
-
const boundsOffsetLeft = chart.margin.left + getYAxisWidth(yAxis[0]);
|
|
89
|
-
const isOutsideBounds = React.useCallback((x, y) => {
|
|
90
|
-
return x < 0 || x > boundsWidth || y < 0 || y > boundsHeight;
|
|
91
|
-
}, [boundsHeight, boundsWidth]);
|
|
92
|
-
const handleMouseMove = (event) => {
|
|
93
|
-
const [pointerX, pointerY] = pointer(event, svgRef.current);
|
|
94
|
-
const x = pointerX - boundsOffsetLeft;
|
|
95
|
-
const y = pointerY - boundsOffsetTop;
|
|
96
|
-
if (isOutsideBounds(x, y)) {
|
|
97
|
-
dispatcher.call('hover-shape', {}, undefined);
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
const closest = getClosestPoints({
|
|
101
|
-
position: [x, y],
|
|
102
|
-
shapesData,
|
|
103
|
-
});
|
|
104
|
-
dispatcher.call('hover-shape', event.target, closest, [pointerX, pointerY]);
|
|
105
|
-
};
|
|
106
|
-
const throttledHandleMouseMove = throttle(handleMouseMove, THROTTLE_DELAY);
|
|
107
|
-
const handleMouseLeave = () => {
|
|
108
|
-
throttledHandleMouseMove.cancel();
|
|
109
|
-
dispatcher.call('hover-shape', {}, undefined);
|
|
110
|
-
};
|
|
111
|
-
const handleChartClick = React.useCallback((event) => {
|
|
112
|
-
const [pointerX, pointerY] = pointer(event, svgRef.current);
|
|
113
|
-
const x = pointerX - boundsOffsetLeft;
|
|
114
|
-
const y = pointerY - boundsOffsetTop;
|
|
115
|
-
if (isOutsideBounds(x, y)) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
const items = getClosestPoints({
|
|
119
|
-
position: [x, y],
|
|
120
|
-
shapesData,
|
|
121
|
-
});
|
|
122
|
-
const selected = items === null || items === void 0 ? void 0 : items.find((item) => item.closest);
|
|
123
|
-
if (!selected) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
dispatcher.call('click-chart', undefined, { point: selected.data, series: selected.series }, event);
|
|
127
|
-
}, [boundsOffsetLeft, boundsOffsetTop, dispatcher, isOutsideBounds, shapesData]);
|
|
128
|
-
return (React.createElement(React.Fragment, null,
|
|
129
|
-
React.createElement("svg", { ref: svgRef, className: b(), width: width, height: height, onMouseMove: throttledHandleMouseMove, onMouseLeave: handleMouseLeave, onClick: handleChartClick },
|
|
130
|
-
title && React.createElement(Title, Object.assign({}, title, { chartWidth: width })),
|
|
131
|
-
React.createElement("g", { transform: `translate(0, ${boundsOffsetTop})` }, preparedSplit.plots.map((plot, index) => {
|
|
132
|
-
return React.createElement(PlotTitle, { key: `plot-${index}`, title: plot.title });
|
|
133
|
-
})),
|
|
134
|
-
React.createElement("g", { width: boundsWidth, height: boundsHeight, transform: `translate(${[boundsOffsetLeft, boundsOffsetTop].join(',')})` },
|
|
135
|
-
xScale && (yScale === null || yScale === void 0 ? void 0 : yScale.length) && (React.createElement(React.Fragment, null,
|
|
136
|
-
React.createElement(AxisY, { axes: yAxis, width: boundsWidth, height: boundsHeight, scale: yScale, split: preparedSplit }),
|
|
137
|
-
React.createElement("g", { transform: `translate(0, ${boundsHeight})` },
|
|
138
|
-
React.createElement(AxisX, { axis: xAxis, width: boundsWidth, height: boundsHeight, scale: xScale, split: preparedSplit })))),
|
|
139
|
-
shapes),
|
|
140
|
-
preparedLegend.enabled && (React.createElement(Legend, { chartSeries: preparedSeries, boundsWidth: boundsWidth, legend: preparedLegend, items: legendItems, config: legendConfig, onItemClick: handleLegendItemClick }))),
|
|
141
|
-
React.createElement("div", { className: b('html-layer'), ref: htmlLayerRef, style: {
|
|
142
|
-
transform: `translate(${boundsOffsetLeft}px, ${boundsOffsetTop}px)`,
|
|
143
|
-
} }),
|
|
144
|
-
React.createElement(Tooltip, { dispatcher: dispatcher, tooltip: tooltip, svgContainer: svgRef.current, xAxis: xAxis, yAxis: yAxis[0] })));
|
|
145
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { LegendConfig, LegendItem, OnLegendItemClick, PreparedLegend, PreparedSeries } from '../hooks';
|
|
3
|
-
type Props = {
|
|
4
|
-
boundsWidth: number;
|
|
5
|
-
chartSeries: PreparedSeries[];
|
|
6
|
-
legend: PreparedLegend;
|
|
7
|
-
items: LegendItem[][];
|
|
8
|
-
config: LegendConfig;
|
|
9
|
-
onItemClick: OnLegendItemClick;
|
|
10
|
-
};
|
|
11
|
-
export declare const Legend: (props: Props) => React.JSX.Element;
|
|
12
|
-
export {};
|
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { line as lineGenerator, scaleLinear, select, symbol } from 'd3';
|
|
3
|
-
import { block } from '../../../../utils/cn';
|
|
4
|
-
import { CONTINUOUS_LEGEND_SIZE } from '../constants';
|
|
5
|
-
import { getLineDashArray } from '../hooks/useShapes/utils';
|
|
6
|
-
import { createGradientRect, getContinuesColorFn, getLabelsSize, getSymbol } from '../utils';
|
|
7
|
-
import { axisBottom } from '../utils/axis-generators';
|
|
8
|
-
const b = block('d3-legend');
|
|
9
|
-
const getLegendPosition = (args) => {
|
|
10
|
-
const { align, offsetWidth, width, contentWidth } = args;
|
|
11
|
-
const top = 0;
|
|
12
|
-
if (align === 'left') {
|
|
13
|
-
return { top, left: offsetWidth };
|
|
14
|
-
}
|
|
15
|
-
if (align === 'right') {
|
|
16
|
-
return { top, left: offsetWidth + width - contentWidth };
|
|
17
|
-
}
|
|
18
|
-
return { top, left: offsetWidth + width / 2 - contentWidth / 2 };
|
|
19
|
-
};
|
|
20
|
-
const appendPaginator = (args) => {
|
|
21
|
-
const { container, offset, maxPage, legend, transform, onArrowClick } = args;
|
|
22
|
-
const paginationLine = container.append('g').attr('class', b('pagination'));
|
|
23
|
-
let computedWidth = 0;
|
|
24
|
-
paginationLine
|
|
25
|
-
.append('text')
|
|
26
|
-
.text('▲')
|
|
27
|
-
.attr('class', function () {
|
|
28
|
-
return b('pagination-arrow', { inactive: offset === 0 });
|
|
29
|
-
})
|
|
30
|
-
.style('font-size', legend.itemStyle.fontSize)
|
|
31
|
-
.each(function () {
|
|
32
|
-
computedWidth += this.getComputedTextLength();
|
|
33
|
-
})
|
|
34
|
-
.on('click', function () {
|
|
35
|
-
if (offset - 1 >= 0) {
|
|
36
|
-
onArrowClick(offset - 1);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
paginationLine
|
|
40
|
-
.append('text')
|
|
41
|
-
.text(`${offset + 1}/${maxPage}`)
|
|
42
|
-
.attr('class', b('pagination-counter'))
|
|
43
|
-
.attr('x', computedWidth)
|
|
44
|
-
.style('font-size', legend.itemStyle.fontSize)
|
|
45
|
-
.each(function () {
|
|
46
|
-
computedWidth += this.getComputedTextLength();
|
|
47
|
-
});
|
|
48
|
-
paginationLine
|
|
49
|
-
.append('text')
|
|
50
|
-
.text('▼')
|
|
51
|
-
.attr('class', function () {
|
|
52
|
-
return b('pagination-arrow', { inactive: offset === maxPage - 1 });
|
|
53
|
-
})
|
|
54
|
-
.attr('x', computedWidth)
|
|
55
|
-
.style('font-size', legend.itemStyle.fontSize)
|
|
56
|
-
.on('click', function () {
|
|
57
|
-
if (offset + 1 < maxPage) {
|
|
58
|
-
onArrowClick(offset + 1);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
paginationLine.attr('transform', transform);
|
|
62
|
-
};
|
|
63
|
-
const legendSymbolGenerator = lineGenerator()
|
|
64
|
-
.x((d) => d.x)
|
|
65
|
-
.y((d) => d.y);
|
|
66
|
-
function renderLegendSymbol(args) {
|
|
67
|
-
const { selection, legend } = args;
|
|
68
|
-
const line = selection.data();
|
|
69
|
-
const getXPosition = (i) => {
|
|
70
|
-
return line.slice(0, i).reduce((acc, legendItem) => {
|
|
71
|
-
return (acc +
|
|
72
|
-
legendItem.symbol.width +
|
|
73
|
-
legendItem.symbol.padding +
|
|
74
|
-
legendItem.textWidth +
|
|
75
|
-
legend.itemDistance);
|
|
76
|
-
}, 0);
|
|
77
|
-
};
|
|
78
|
-
selection.each(function (d, i) {
|
|
79
|
-
const element = select(this);
|
|
80
|
-
const x = getXPosition(i);
|
|
81
|
-
const className = b('item-symbol', { shape: d.symbol.shape, unselected: !d.visible });
|
|
82
|
-
const color = d.visible ? d.color : '';
|
|
83
|
-
switch (d.symbol.shape) {
|
|
84
|
-
case 'path': {
|
|
85
|
-
const y = legend.lineHeight / 2;
|
|
86
|
-
const points = [
|
|
87
|
-
{ x: x, y },
|
|
88
|
-
{ x: x + d.symbol.width, y },
|
|
89
|
-
];
|
|
90
|
-
element
|
|
91
|
-
.append('path')
|
|
92
|
-
.attr('d', legendSymbolGenerator(points))
|
|
93
|
-
.attr('fill', 'none')
|
|
94
|
-
.attr('stroke-width', d.symbol.strokeWidth)
|
|
95
|
-
.attr('class', className)
|
|
96
|
-
.style('stroke', color);
|
|
97
|
-
if (d.dashStyle) {
|
|
98
|
-
element.attr('stroke-dasharray', getLineDashArray(d.dashStyle, d.symbol.strokeWidth));
|
|
99
|
-
}
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
case 'rect': {
|
|
103
|
-
const y = (legend.lineHeight - d.symbol.height) / 2;
|
|
104
|
-
element
|
|
105
|
-
.append('rect')
|
|
106
|
-
.attr('x', x)
|
|
107
|
-
.attr('y', y)
|
|
108
|
-
.attr('width', d.symbol.width)
|
|
109
|
-
.attr('height', d.symbol.height)
|
|
110
|
-
.attr('rx', d.symbol.radius)
|
|
111
|
-
.attr('class', className)
|
|
112
|
-
.style('fill', color);
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
case 'symbol': {
|
|
116
|
-
const y = legend.lineHeight / 2;
|
|
117
|
-
element
|
|
118
|
-
.append('svg:path')
|
|
119
|
-
.attr('d', () => {
|
|
120
|
-
const scatterSymbol = getSymbol(d.symbol.symbolType);
|
|
121
|
-
// D3 takes size as square pixels, so we need to make square pixels size by multiplying
|
|
122
|
-
// https://d3js.org/d3-shape/symbol#symbol
|
|
123
|
-
return symbol(scatterSymbol, d.symbol.width * d.symbol.width)();
|
|
124
|
-
})
|
|
125
|
-
.attr('transform', () => {
|
|
126
|
-
return 'translate(' + x + ',' + y + ')';
|
|
127
|
-
})
|
|
128
|
-
.attr('class', className)
|
|
129
|
-
.style('fill', color);
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
export const Legend = (props) => {
|
|
136
|
-
const { boundsWidth, chartSeries, legend, items, config, onItemClick } = props;
|
|
137
|
-
const ref = React.useRef(null);
|
|
138
|
-
const [paginationOffset, setPaginationOffset] = React.useState(0);
|
|
139
|
-
React.useEffect(() => {
|
|
140
|
-
setPaginationOffset(0);
|
|
141
|
-
}, [boundsWidth]);
|
|
142
|
-
React.useEffect(() => {
|
|
143
|
-
var _a, _b, _c, _d, _e;
|
|
144
|
-
if (!ref.current) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
const svgElement = select(ref.current);
|
|
148
|
-
svgElement.selectAll('*').remove();
|
|
149
|
-
let legendWidth = 0;
|
|
150
|
-
if (legend.type === 'discrete') {
|
|
151
|
-
const limit = (_a = config.pagination) === null || _a === void 0 ? void 0 : _a.limit;
|
|
152
|
-
const pageItems = typeof limit === 'number'
|
|
153
|
-
? items.slice(paginationOffset * limit, paginationOffset * limit + limit)
|
|
154
|
-
: items;
|
|
155
|
-
pageItems.forEach((line, lineIndex) => {
|
|
156
|
-
var _a;
|
|
157
|
-
const legendLine = svgElement.append('g').attr('class', b('line'));
|
|
158
|
-
const legendItemTemplate = legendLine
|
|
159
|
-
.selectAll('legend-history')
|
|
160
|
-
.data(line)
|
|
161
|
-
.enter()
|
|
162
|
-
.append('g')
|
|
163
|
-
.attr('class', b('item'))
|
|
164
|
-
.on('click', function (e, d) {
|
|
165
|
-
onItemClick({ name: d.name, metaKey: e.metaKey });
|
|
166
|
-
});
|
|
167
|
-
const getXPosition = (i) => {
|
|
168
|
-
return line.slice(0, i).reduce((acc, legendItem) => {
|
|
169
|
-
return (acc +
|
|
170
|
-
legendItem.symbol.width +
|
|
171
|
-
legendItem.symbol.padding +
|
|
172
|
-
legendItem.textWidth +
|
|
173
|
-
legend.itemDistance);
|
|
174
|
-
}, 0);
|
|
175
|
-
};
|
|
176
|
-
renderLegendSymbol({ selection: legendItemTemplate, legend });
|
|
177
|
-
legendItemTemplate
|
|
178
|
-
.append('text')
|
|
179
|
-
.attr('x', function (legendItem, i) {
|
|
180
|
-
return (getXPosition(i) + legendItem.symbol.width + legendItem.symbol.padding);
|
|
181
|
-
})
|
|
182
|
-
.attr('height', legend.lineHeight)
|
|
183
|
-
.attr('class', function (d) {
|
|
184
|
-
const mods = { selected: d.visible, unselected: !d.visible };
|
|
185
|
-
return b('item-text', mods);
|
|
186
|
-
})
|
|
187
|
-
.text(function (d) {
|
|
188
|
-
return ('name' in d && d.name);
|
|
189
|
-
})
|
|
190
|
-
.style('font-size', legend.itemStyle.fontSize);
|
|
191
|
-
const contentWidth = ((_a = legendLine.node()) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width) || 0;
|
|
192
|
-
const { left } = getLegendPosition({
|
|
193
|
-
align: legend.align,
|
|
194
|
-
width: boundsWidth,
|
|
195
|
-
offsetWidth: 0,
|
|
196
|
-
contentWidth,
|
|
197
|
-
});
|
|
198
|
-
const top = legend.lineHeight * lineIndex;
|
|
199
|
-
legendLine.attr('transform', `translate(${[left, top].join(',')})`);
|
|
200
|
-
});
|
|
201
|
-
legendWidth = boundsWidth;
|
|
202
|
-
if (config.pagination) {
|
|
203
|
-
const transform = `translate(${[
|
|
204
|
-
0,
|
|
205
|
-
legend.lineHeight * config.pagination.limit + legend.lineHeight / 2,
|
|
206
|
-
].join(',')})`;
|
|
207
|
-
appendPaginator({
|
|
208
|
-
container: svgElement,
|
|
209
|
-
offset: paginationOffset,
|
|
210
|
-
maxPage: config.pagination.maxPage,
|
|
211
|
-
legend,
|
|
212
|
-
transform,
|
|
213
|
-
onArrowClick: setPaginationOffset,
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
else {
|
|
218
|
-
// gradient rect
|
|
219
|
-
const domain = (_b = legend.colorScale.domain) !== null && _b !== void 0 ? _b : [];
|
|
220
|
-
const rectHeight = CONTINUOUS_LEGEND_SIZE.height;
|
|
221
|
-
svgElement.call(createGradientRect, {
|
|
222
|
-
y: legend.title.height + legend.title.margin,
|
|
223
|
-
height: rectHeight,
|
|
224
|
-
width: legend.width,
|
|
225
|
-
interpolator: getContinuesColorFn({
|
|
226
|
-
values: [0, 1],
|
|
227
|
-
colors: legend.colorScale.colors,
|
|
228
|
-
stops: legend.colorScale.stops,
|
|
229
|
-
}),
|
|
230
|
-
});
|
|
231
|
-
// ticks
|
|
232
|
-
const xAxisGenerator = axisBottom({
|
|
233
|
-
scale: scaleLinear(domain, [0, legend.width]),
|
|
234
|
-
ticks: {
|
|
235
|
-
items: [[0, -rectHeight]],
|
|
236
|
-
labelsMargin: legend.ticks.labelsMargin,
|
|
237
|
-
labelsLineHeight: legend.ticks.labelsLineHeight,
|
|
238
|
-
maxTickCount: 4,
|
|
239
|
-
tickColor: '#fff',
|
|
240
|
-
},
|
|
241
|
-
domain: {
|
|
242
|
-
size: legend.width,
|
|
243
|
-
color: 'transparent',
|
|
244
|
-
},
|
|
245
|
-
});
|
|
246
|
-
const tickTop = legend.title.height + legend.title.margin + rectHeight;
|
|
247
|
-
svgElement
|
|
248
|
-
.append('g')
|
|
249
|
-
.attr('transform', `translate(0, ${tickTop})`)
|
|
250
|
-
.call(xAxisGenerator);
|
|
251
|
-
legendWidth = legend.width;
|
|
252
|
-
}
|
|
253
|
-
if (legend.title.enable) {
|
|
254
|
-
const { maxWidth: labelWidth } = getLabelsSize({
|
|
255
|
-
labels: [legend.title.text],
|
|
256
|
-
style: legend.title.style,
|
|
257
|
-
});
|
|
258
|
-
svgElement
|
|
259
|
-
.append('g')
|
|
260
|
-
.attr('class', b('title'))
|
|
261
|
-
.append('text')
|
|
262
|
-
.attr('dx', legend.width / 2 - labelWidth / 2)
|
|
263
|
-
.attr('font-weight', (_c = legend.title.style.fontWeight) !== null && _c !== void 0 ? _c : null)
|
|
264
|
-
.attr('font-size', (_d = legend.title.style.fontSize) !== null && _d !== void 0 ? _d : null)
|
|
265
|
-
.attr('fill', (_e = legend.title.style.fontColor) !== null && _e !== void 0 ? _e : null)
|
|
266
|
-
.style('alignment-baseline', 'before-edge')
|
|
267
|
-
.text(legend.title.text);
|
|
268
|
-
}
|
|
269
|
-
const { left } = getLegendPosition({
|
|
270
|
-
align: legend.align,
|
|
271
|
-
width: boundsWidth,
|
|
272
|
-
offsetWidth: config.offset.left,
|
|
273
|
-
contentWidth: legendWidth,
|
|
274
|
-
});
|
|
275
|
-
svgElement.attr('transform', `translate(${[left, config.offset.top].join(',')})`);
|
|
276
|
-
}, [boundsWidth, chartSeries, onItemClick, legend, items, config, paginationOffset]);
|
|
277
|
-
return React.createElement("g", { className: b(), ref: ref, width: boundsWidth, height: legend.height });
|
|
278
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { block } from '../../../../utils/cn';
|
|
3
|
-
const b = block('d3-plot-title');
|
|
4
|
-
export const PlotTitle = (props) => {
|
|
5
|
-
const { title } = props;
|
|
6
|
-
if (!title) {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
const { x, y, text, style, height } = title;
|
|
10
|
-
return (React.createElement("text", { className: b(), dx: x, dy: y, dominantBaseline: "middle", textAnchor: "middle", style: Object.assign({ lineHeight: `${height}px` }, style) },
|
|
11
|
-
React.createElement("tspan", null, text)));
|
|
12
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { block } from '../../../../utils/cn';
|
|
3
|
-
const b = block('d3-title');
|
|
4
|
-
export const Title = (props) => {
|
|
5
|
-
const { chartWidth, text, height, style } = props;
|
|
6
|
-
return (React.createElement("text", { className: b(), dx: chartWidth / 2, dy: height / 2, dominantBaseline: "middle", textAnchor: "middle", style: Object.assign({ lineHeight: `${height}px` }, style) },
|
|
7
|
-
React.createElement("tspan", null, text)));
|
|
8
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { TooltipDataChunk } from '../../../../../types';
|
|
3
|
-
import type { PreparedAxis } from '../../hooks';
|
|
4
|
-
type Props = {
|
|
5
|
-
hovered: TooltipDataChunk[];
|
|
6
|
-
xAxis: PreparedAxis;
|
|
7
|
-
yAxis: PreparedAxis;
|
|
8
|
-
};
|
|
9
|
-
export declare const DefaultContent: ({ hovered, xAxis, yAxis }: Props) => React.JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { dateTime } from '@gravity-ui/date-utils';
|
|
3
|
-
import get from 'lodash/get';
|
|
4
|
-
import { block } from '../../../../../utils/cn';
|
|
5
|
-
import { formatNumber } from '../../../../shared';
|
|
6
|
-
import { getDataCategoryValue, getWaterfallPointSubtotal } from '../../utils';
|
|
7
|
-
const b = block('d3-tooltip');
|
|
8
|
-
const DEFAULT_DATE_FORMAT = 'DD.MM.YY';
|
|
9
|
-
const getRowData = (fieldName, axis, data) => {
|
|
10
|
-
switch (axis.type) {
|
|
11
|
-
case 'category': {
|
|
12
|
-
const categories = get(axis, 'categories', []);
|
|
13
|
-
return getDataCategoryValue({ axisDirection: fieldName, categories, data });
|
|
14
|
-
}
|
|
15
|
-
case 'datetime': {
|
|
16
|
-
const value = get(data, fieldName);
|
|
17
|
-
if (!value) {
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
return dateTime({ input: value }).format(DEFAULT_DATE_FORMAT);
|
|
21
|
-
}
|
|
22
|
-
case 'linear':
|
|
23
|
-
default: {
|
|
24
|
-
const value = get(data, fieldName);
|
|
25
|
-
return formatNumber(value);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
const getXRowData = (xAxis, data) => getRowData('x', xAxis, data);
|
|
30
|
-
const getYRowData = (yAxis, data) => getRowData('y', yAxis, data);
|
|
31
|
-
const getMeasureValue = (data, xAxis, yAxis) => {
|
|
32
|
-
var _a, _b;
|
|
33
|
-
if (data.every((item) => ['pie', 'treemap', 'waterfall'].includes(item.series.type))) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
if (data.some((item) => item.series.type === 'bar-y')) {
|
|
37
|
-
return getYRowData(yAxis, (_a = data[0]) === null || _a === void 0 ? void 0 : _a.data);
|
|
38
|
-
}
|
|
39
|
-
return getXRowData(xAxis, (_b = data[0]) === null || _b === void 0 ? void 0 : _b.data);
|
|
40
|
-
};
|
|
41
|
-
export const DefaultContent = ({ hovered, xAxis, yAxis }) => {
|
|
42
|
-
const measureValue = getMeasureValue(hovered, xAxis, yAxis);
|
|
43
|
-
return (React.createElement(React.Fragment, null,
|
|
44
|
-
measureValue && React.createElement("div", null, measureValue),
|
|
45
|
-
hovered.map(({ data, series, closest }, i) => {
|
|
46
|
-
const id = `${get(series, 'id')}_${i}`;
|
|
47
|
-
const color = get(series, 'color');
|
|
48
|
-
switch (series.type) {
|
|
49
|
-
case 'scatter':
|
|
50
|
-
case 'line':
|
|
51
|
-
case 'area':
|
|
52
|
-
case 'bar-x': {
|
|
53
|
-
const value = (React.createElement(React.Fragment, null,
|
|
54
|
-
series.name,
|
|
55
|
-
": ",
|
|
56
|
-
getYRowData(yAxis, data)));
|
|
57
|
-
return (React.createElement("div", { key: id, className: b('content-row') },
|
|
58
|
-
React.createElement("div", { className: b('color'), style: { backgroundColor: color } }),
|
|
59
|
-
React.createElement("div", null, closest ? React.createElement("b", null, value) : React.createElement("span", null, value))));
|
|
60
|
-
}
|
|
61
|
-
case 'waterfall': {
|
|
62
|
-
const isTotal = get(data, 'total', false);
|
|
63
|
-
const subTotal = getWaterfallPointSubtotal(data, series);
|
|
64
|
-
return (React.createElement("div", { key: `${id}_${get(data, 'x')}` },
|
|
65
|
-
!isTotal && (React.createElement(React.Fragment, null,
|
|
66
|
-
React.createElement("div", { key: id, className: b('content-row') },
|
|
67
|
-
React.createElement("b", null, getXRowData(xAxis, data))),
|
|
68
|
-
React.createElement("div", { className: b('content-row') },
|
|
69
|
-
React.createElement("span", null,
|
|
70
|
-
series.name,
|
|
71
|
-
"\u00A0"),
|
|
72
|
-
React.createElement("span", null, getYRowData(yAxis, data))))),
|
|
73
|
-
React.createElement("div", { key: id, className: b('content-row') },
|
|
74
|
-
isTotal ? 'Total' : 'Subtotal',
|
|
75
|
-
": ",
|
|
76
|
-
subTotal)));
|
|
77
|
-
}
|
|
78
|
-
case 'bar-y': {
|
|
79
|
-
const value = (React.createElement(React.Fragment, null,
|
|
80
|
-
series.name,
|
|
81
|
-
": ",
|
|
82
|
-
getXRowData(xAxis, data)));
|
|
83
|
-
return (React.createElement("div", { key: id, className: b('content-row') },
|
|
84
|
-
React.createElement("div", { className: b('color'), style: { backgroundColor: color } }),
|
|
85
|
-
React.createElement("div", null, closest ? React.createElement("b", null, value) : React.createElement("span", null, value))));
|
|
86
|
-
}
|
|
87
|
-
case 'pie':
|
|
88
|
-
case 'treemap': {
|
|
89
|
-
const seriesData = data;
|
|
90
|
-
return (React.createElement("div", { key: id, className: b('content-row') },
|
|
91
|
-
React.createElement("div", { className: b('color'), style: { backgroundColor: color } }),
|
|
92
|
-
React.createElement("span", null,
|
|
93
|
-
seriesData.name || seriesData.id,
|
|
94
|
-
"\u00A0"),
|
|
95
|
-
React.createElement("span", null, seriesData.value)));
|
|
96
|
-
}
|
|
97
|
-
default: {
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
})));
|
|
102
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Dispatch } from 'd3';
|
|
3
|
-
import type { PreparedAxis, PreparedTooltip } from '../../hooks';
|
|
4
|
-
type TooltipProps = {
|
|
5
|
-
dispatcher: Dispatch<object>;
|
|
6
|
-
tooltip: PreparedTooltip;
|
|
7
|
-
svgContainer: SVGSVGElement | null;
|
|
8
|
-
xAxis: PreparedAxis;
|
|
9
|
-
yAxis: PreparedAxis;
|
|
10
|
-
};
|
|
11
|
-
export declare const Tooltip: (props: TooltipProps) => React.JSX.Element | null;
|
|
12
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Popup, useVirtualElementRef } from '@gravity-ui/uikit';
|
|
3
|
-
import isNil from 'lodash/isNil';
|
|
4
|
-
import { block } from '../../../../../utils/cn';
|
|
5
|
-
import { useTooltip } from '../../hooks';
|
|
6
|
-
import { DefaultContent } from './DefaultContent';
|
|
7
|
-
const b = block('d3-tooltip');
|
|
8
|
-
export const Tooltip = (props) => {
|
|
9
|
-
const { tooltip, xAxis, yAxis, svgContainer, dispatcher } = props;
|
|
10
|
-
const { hovered, pointerPosition } = useTooltip({ dispatcher, tooltip });
|
|
11
|
-
const containerRect = (svgContainer === null || svgContainer === void 0 ? void 0 : svgContainer.getBoundingClientRect()) || { left: 0, top: 0 };
|
|
12
|
-
const left = ((pointerPosition === null || pointerPosition === void 0 ? void 0 : pointerPosition[0]) || 0) + containerRect.left;
|
|
13
|
-
const top = ((pointerPosition === null || pointerPosition === void 0 ? void 0 : pointerPosition[1]) || 0) + containerRect.top;
|
|
14
|
-
const anchorRef = useVirtualElementRef({ rect: { top, left } });
|
|
15
|
-
const content = React.useMemo(() => {
|
|
16
|
-
var _a;
|
|
17
|
-
if (!hovered) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
const customTooltip = (_a = tooltip.renderer) === null || _a === void 0 ? void 0 : _a.call(tooltip, { hovered });
|
|
21
|
-
return isNil(customTooltip) ? (React.createElement(DefaultContent, { hovered: hovered, xAxis: xAxis, yAxis: yAxis })) : (customTooltip);
|
|
22
|
-
}, [hovered, tooltip, xAxis, yAxis]);
|
|
23
|
-
React.useEffect(() => {
|
|
24
|
-
window.dispatchEvent(new CustomEvent('scroll'));
|
|
25
|
-
}, [left, top]);
|
|
26
|
-
return (hovered === null || hovered === void 0 ? void 0 : hovered.length) ? (React.createElement(Popup, { className: b(), open: true, anchorRef: anchorRef, offset: [0, 20], placement: ['right', 'left', 'top', 'bottom'], modifiers: [{ name: 'preventOverflow', options: { padding: 10, altAxis: true } }] },
|
|
27
|
-
React.createElement("div", { className: b('content') }, content))) : null;
|
|
28
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Chart } from './Chart';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Chart } from './Chart';
|