@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,81 +1,46 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Chart } from '@gravity-ui/charts';
|
|
2
3
|
import afterFrame from 'afterframe';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { validateData } from './validation';
|
|
4
|
+
import { settings } from '../../../libs';
|
|
5
|
+
import { measurePerformance } from '../../../utils';
|
|
6
|
+
import { withSplitPane } from './withSplitPane/withSplitPane';
|
|
7
|
+
const ChartWithSplitPane = withSplitPane(Chart);
|
|
8
8
|
const D3Widget = React.forwardRef(function D3Widget(props, forwardedRef) {
|
|
9
|
-
const { data, onLoad, onRender, onChartLoad } = props;
|
|
10
|
-
const
|
|
11
|
-
const ref = React.useRef(null);
|
|
12
|
-
const debounced = React.useRef();
|
|
13
|
-
const [dimensions, setDimensions] = React.useState();
|
|
9
|
+
const { data, tooltip, onLoad, onRender, onChartLoad } = props;
|
|
10
|
+
const lang = settings.get('lang');
|
|
14
11
|
const performanceMeasure = React.useRef(measurePerformance());
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
setDimensions({ width, height });
|
|
12
|
+
const chartRef = React.useRef(null);
|
|
13
|
+
const ChartComponent = (tooltip === null || tooltip === void 0 ? void 0 : tooltip.splitted) ? ChartWithSplitPane : Chart;
|
|
14
|
+
const handleResize = React.useCallback(({ dimensions }) => {
|
|
15
|
+
if (!dimensions) {
|
|
16
|
+
return;
|
|
21
17
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
if (!performanceMeasure.current) {
|
|
19
|
+
performanceMeasure.current = measurePerformance();
|
|
20
|
+
}
|
|
21
|
+
afterFrame(() => {
|
|
22
|
+
var _a;
|
|
23
|
+
const renderTime = (_a = performanceMeasure.current) === null || _a === void 0 ? void 0 : _a.end();
|
|
24
|
+
onRender === null || onRender === void 0 ? void 0 : onRender({
|
|
25
|
+
renderTime,
|
|
26
|
+
});
|
|
27
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad({
|
|
28
|
+
widgetRendering: renderTime,
|
|
29
|
+
});
|
|
30
|
+
performanceMeasure.current = null;
|
|
31
|
+
});
|
|
32
|
+
}, [onRender, onLoad]);
|
|
29
33
|
React.useImperativeHandle(forwardedRef, () => ({
|
|
30
34
|
reflow() {
|
|
31
|
-
|
|
35
|
+
var _a;
|
|
36
|
+
(_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.reflow();
|
|
32
37
|
},
|
|
33
|
-
}), [
|
|
34
|
-
React.useEffect(() => {
|
|
35
|
-
const selection = select(window);
|
|
36
|
-
// https://github.com/d3/d3-selection/blob/main/README.md#handling-events
|
|
37
|
-
const eventName = `resize.${getRandomCKId()}`;
|
|
38
|
-
selection.on(eventName, debuncedHandleResize);
|
|
39
|
-
return () => {
|
|
40
|
-
// https://d3js.org/d3-selection/events#selection_on
|
|
41
|
-
selection.on(eventName, null);
|
|
42
|
-
};
|
|
43
|
-
}, [debuncedHandleResize]);
|
|
44
|
-
React.useEffect(() => {
|
|
45
|
-
// dimensions initialize
|
|
46
|
-
debuncedHandleResize();
|
|
47
|
-
}, [debuncedHandleResize]);
|
|
48
|
-
if (validatedData.current !== data) {
|
|
49
|
-
validateData(data);
|
|
50
|
-
validatedData.current = data;
|
|
51
|
-
}
|
|
38
|
+
}), []);
|
|
52
39
|
React.useLayoutEffect(() => {
|
|
53
40
|
if (onChartLoad) {
|
|
54
41
|
onChartLoad({});
|
|
55
42
|
}
|
|
56
43
|
}, [onChartLoad]);
|
|
57
|
-
React.
|
|
58
|
-
if (dimensions === null || dimensions === void 0 ? void 0 : dimensions.width) {
|
|
59
|
-
if (!performanceMeasure.current) {
|
|
60
|
-
performanceMeasure.current = measurePerformance();
|
|
61
|
-
}
|
|
62
|
-
afterFrame(() => {
|
|
63
|
-
var _a;
|
|
64
|
-
const renderTime = (_a = performanceMeasure.current) === null || _a === void 0 ? void 0 : _a.end();
|
|
65
|
-
onRender === null || onRender === void 0 ? void 0 : onRender({
|
|
66
|
-
renderTime,
|
|
67
|
-
});
|
|
68
|
-
onLoad === null || onLoad === void 0 ? void 0 : onLoad({
|
|
69
|
-
widgetRendering: renderTime,
|
|
70
|
-
});
|
|
71
|
-
performanceMeasure.current = null;
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}, [data, onRender, onLoad, dimensions]);
|
|
75
|
-
return (React.createElement("div", { ref: ref, style: {
|
|
76
|
-
width: (dimensions === null || dimensions === void 0 ? void 0 : dimensions.width) || '100%',
|
|
77
|
-
height: (dimensions === null || dimensions === void 0 ? void 0 : dimensions.height) || '100%',
|
|
78
|
-
position: 'relative',
|
|
79
|
-
} }, (dimensions === null || dimensions === void 0 ? void 0 : dimensions.width) && (dimensions === null || dimensions === void 0 ? void 0 : dimensions.height) && (React.createElement(Chart, { width: dimensions.width, height: dimensions.height, data: data }))));
|
|
44
|
+
return React.createElement(ChartComponent, { ref: chartRef, data: data, lang: lang, onResize: handleResize });
|
|
80
45
|
});
|
|
81
46
|
export default D3Widget;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ChartTooltipContentProps } from '@gravity-ui/charts';
|
|
3
|
+
export type TooltipContentRef = {
|
|
4
|
+
redraw: (updates?: Omit<ChartTooltipContentProps, 'renderer'>) => void;
|
|
5
|
+
};
|
|
6
|
+
type TooltipContentProps = Pick<ChartTooltipContentProps, 'renderer'>;
|
|
7
|
+
export declare const TooltipContent: React.ForwardRefExoticComponent<TooltipContentProps & React.RefAttributes<TooltipContentRef>>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChartTooltipContent } from '@gravity-ui/charts';
|
|
3
|
+
export const TooltipContent = React.forwardRef(function TooltipContent(props, forwardedRef) {
|
|
4
|
+
const { renderer } = props;
|
|
5
|
+
const [tooltipProps, setTooltipProps] = React.useState();
|
|
6
|
+
React.useImperativeHandle(forwardedRef, () => ({
|
|
7
|
+
redraw(updates) {
|
|
8
|
+
setTooltipProps(updates);
|
|
9
|
+
},
|
|
10
|
+
}), []);
|
|
11
|
+
return React.createElement(ChartTooltipContent, Object.assign({}, tooltipProps, { renderer: renderer }));
|
|
12
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SplitLayoutType } from '../../../../components/SplitPane';
|
|
2
|
+
export declare const RESIZER_HEIGHT = 24;
|
|
3
|
+
type WithSplitPaneState = {
|
|
4
|
+
allowResize: boolean;
|
|
5
|
+
tooltipHeight: number;
|
|
6
|
+
setTooltipHeight: (value: number) => void;
|
|
7
|
+
split: SplitLayoutType;
|
|
8
|
+
setSplit: (value: SplitLayoutType) => void;
|
|
9
|
+
size: number | string;
|
|
10
|
+
setSize: (value: number | string) => void;
|
|
11
|
+
maxSize?: number;
|
|
12
|
+
minSize?: number;
|
|
13
|
+
};
|
|
14
|
+
type UseWithSplitPaneProps = {
|
|
15
|
+
container: HTMLDivElement | null;
|
|
16
|
+
};
|
|
17
|
+
export declare function getVerticalSize(): number;
|
|
18
|
+
export declare function useWithSplitPaneState(props: UseWithSplitPaneProps): WithSplitPaneState;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SplitLayout } from '../../../../components/SplitPane';
|
|
3
|
+
import { IS_WINDOW_AVAILABLE } from '../../../../constants';
|
|
4
|
+
const CHART_SECTION_PERCENTAGE = 0.6;
|
|
5
|
+
export const RESIZER_HEIGHT = 24;
|
|
6
|
+
function getInitialSplit() {
|
|
7
|
+
if (!IS_WINDOW_AVAILABLE) {
|
|
8
|
+
return SplitLayout.HORIZONTAL;
|
|
9
|
+
}
|
|
10
|
+
return window.innerWidth > window.innerHeight ? SplitLayout.VERTICAL : SplitLayout.HORIZONTAL;
|
|
11
|
+
}
|
|
12
|
+
export function getVerticalSize() {
|
|
13
|
+
return window.innerWidth * CHART_SECTION_PERCENTAGE;
|
|
14
|
+
}
|
|
15
|
+
function getInitialSize(split) {
|
|
16
|
+
const defaultSize = `calc(100% - ${RESIZER_HEIGHT}px)`;
|
|
17
|
+
if (!IS_WINDOW_AVAILABLE) {
|
|
18
|
+
return defaultSize;
|
|
19
|
+
}
|
|
20
|
+
return split === SplitLayout.VERTICAL ? getVerticalSize() : defaultSize;
|
|
21
|
+
}
|
|
22
|
+
export function useWithSplitPaneState(props) {
|
|
23
|
+
const { container } = props;
|
|
24
|
+
const [tooltipHeight, setTooltipHeight] = React.useState(0);
|
|
25
|
+
const [split, setSplit] = React.useState(getInitialSplit());
|
|
26
|
+
const [size, setSize] = React.useState(getInitialSize(split));
|
|
27
|
+
const allowResize = split === SplitLayout.HORIZONTAL;
|
|
28
|
+
let maxSize;
|
|
29
|
+
let minSize;
|
|
30
|
+
if (IS_WINDOW_AVAILABLE && container && split === SplitLayout.HORIZONTAL) {
|
|
31
|
+
const containerHeight = container.getBoundingClientRect().height;
|
|
32
|
+
maxSize = containerHeight - RESIZER_HEIGHT - tooltipHeight;
|
|
33
|
+
minSize = containerHeight / 3;
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
allowResize,
|
|
37
|
+
maxSize,
|
|
38
|
+
minSize,
|
|
39
|
+
tooltipHeight,
|
|
40
|
+
setTooltipHeight,
|
|
41
|
+
split,
|
|
42
|
+
setSplit,
|
|
43
|
+
size,
|
|
44
|
+
setSize,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Chart } from '@gravity-ui/charts';
|
|
3
|
+
import type { ChartProps, ChartRef } from '@gravity-ui/charts';
|
|
4
|
+
export declare function withSplitPane(ChartComponent: typeof Chart): React.ForwardRefExoticComponent<ChartProps & React.RefAttributes<ChartRef>>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { getComponentName, useResizeObserver } from '@gravity-ui/uikit';
|
|
4
|
+
import { SplitLayout, StyledSplitPane, mapScreenOrientationTypeToSplitLayout, } from '../../../../components/SplitPane';
|
|
5
|
+
import { IS_SCREEN_ORIENTATION_AVAILABLE, IS_WINDOW_AVAILABLE } from '../../../../constants';
|
|
6
|
+
import { usePrevious } from '../../../../hooks';
|
|
7
|
+
import { isScreenOrientationEventType } from '../../../../utils';
|
|
8
|
+
import { TooltipContent } from './TooltipContent';
|
|
9
|
+
import { RESIZER_HEIGHT, getVerticalSize, useWithSplitPaneState } from './useWithSplitPaneState';
|
|
10
|
+
export function withSplitPane(ChartComponent) {
|
|
11
|
+
const componentName = getComponentName(ChartComponent);
|
|
12
|
+
const component = React.forwardRef(function WithSplitPaneComponent(props, _ref) {
|
|
13
|
+
var _a;
|
|
14
|
+
const { data } = props, restProps = __rest(props, ["data"]);
|
|
15
|
+
const containerRef = React.useRef(null);
|
|
16
|
+
const tooltipContainerRef = React.useRef(null);
|
|
17
|
+
const chartRef = React.useRef(null);
|
|
18
|
+
const tooltipRef = React.useRef(null);
|
|
19
|
+
const { allowResize, minSize, maxSize, tooltipHeight, split, size, setTooltipHeight, setSplit, setSize, } = useWithSplitPaneState({
|
|
20
|
+
container: containerRef.current,
|
|
21
|
+
});
|
|
22
|
+
const prevTooltipHeight = usePrevious(tooltipHeight);
|
|
23
|
+
const prevSplit = usePrevious(split);
|
|
24
|
+
if (prevSplit && split !== prevSplit && split === SplitLayout.VERTICAL) {
|
|
25
|
+
setSize(getVerticalSize());
|
|
26
|
+
}
|
|
27
|
+
else if (split === SplitLayout.HORIZONTAL &&
|
|
28
|
+
containerRef.current &&
|
|
29
|
+
prevTooltipHeight === 0 &&
|
|
30
|
+
tooltipHeight !== prevTooltipHeight) {
|
|
31
|
+
const containerHeight = containerRef.current.getBoundingClientRect().height;
|
|
32
|
+
if (containerHeight - RESIZER_HEIGHT === size) {
|
|
33
|
+
setSize(containerHeight - RESIZER_HEIGHT - tooltipHeight);
|
|
34
|
+
(_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.reflow();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const handleTooltipContentResize = React.useCallback(() => {
|
|
38
|
+
if (!tooltipContainerRef.current) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const nextTooltipHeight = tooltipContainerRef.current.getBoundingClientRect().height;
|
|
42
|
+
setTooltipHeight(nextTooltipHeight);
|
|
43
|
+
}, [setTooltipHeight]);
|
|
44
|
+
useResizeObserver({
|
|
45
|
+
ref: tooltipContainerRef,
|
|
46
|
+
onResize: handleTooltipContentResize,
|
|
47
|
+
});
|
|
48
|
+
const resultData = React.useMemo(() => {
|
|
49
|
+
var _a, _b, _c;
|
|
50
|
+
const userPointerMoveHandler = (_b = (_a = data.chart) === null || _a === void 0 ? void 0 : _a.events) === null || _b === void 0 ? void 0 : _b.pointermove;
|
|
51
|
+
const pointerMoveHandler = (pointerMoveData, event) => {
|
|
52
|
+
var _a;
|
|
53
|
+
(_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.redraw(pointerMoveData);
|
|
54
|
+
userPointerMoveHandler === null || userPointerMoveHandler === void 0 ? void 0 : userPointerMoveHandler(pointerMoveData, event);
|
|
55
|
+
};
|
|
56
|
+
return Object.assign(Object.assign({}, data), { chart: Object.assign(Object.assign({}, data.chart), { events: Object.assign(Object.assign({}, (_c = data.chart) === null || _c === void 0 ? void 0 : _c.events), { pointermove: pointerMoveHandler }) }), tooltip: Object.assign(Object.assign({}, data.tooltip), { enabled: false }) });
|
|
57
|
+
}, [data]);
|
|
58
|
+
const handleOrientationChange = React.useCallback(() => {
|
|
59
|
+
const deviceWidth = window.innerWidth;
|
|
60
|
+
const deviceHeight = window.innerHeight;
|
|
61
|
+
const nextSplit = deviceWidth > deviceHeight ? SplitLayout.VERTICAL : SplitLayout.HORIZONTAL;
|
|
62
|
+
setSplit(nextSplit);
|
|
63
|
+
}, [setSplit]);
|
|
64
|
+
const handleScreenOrientationChange = React.useCallback((e) => {
|
|
65
|
+
const type = e.target && 'type' in e.target && e.target.type;
|
|
66
|
+
if (!isScreenOrientationEventType(type)) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
setSplit(mapScreenOrientationTypeToSplitLayout(type));
|
|
70
|
+
}, [setSplit]);
|
|
71
|
+
const handleSizeChange = React.useCallback((nextSize) => {
|
|
72
|
+
var _a;
|
|
73
|
+
(_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.reflow();
|
|
74
|
+
if (split === SplitLayout.HORIZONTAL) {
|
|
75
|
+
setSize(nextSize);
|
|
76
|
+
}
|
|
77
|
+
}, [split, setSize]);
|
|
78
|
+
React.useLayoutEffect(() => {
|
|
79
|
+
if (IS_SCREEN_ORIENTATION_AVAILABLE) {
|
|
80
|
+
screen.orientation.addEventListener('change', handleScreenOrientationChange);
|
|
81
|
+
}
|
|
82
|
+
else if (IS_WINDOW_AVAILABLE) {
|
|
83
|
+
window.addEventListener('orientationchange', handleOrientationChange);
|
|
84
|
+
}
|
|
85
|
+
return () => {
|
|
86
|
+
if (IS_SCREEN_ORIENTATION_AVAILABLE) {
|
|
87
|
+
screen.orientation.removeEventListener('change', handleScreenOrientationChange);
|
|
88
|
+
}
|
|
89
|
+
else if (IS_WINDOW_AVAILABLE) {
|
|
90
|
+
window.removeEventListener('orientationchange', handleOrientationChange);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}, [handleOrientationChange, handleScreenOrientationChange]);
|
|
94
|
+
return (React.createElement("div", { ref: containerRef, style: { position: 'relative', height: '100%' } },
|
|
95
|
+
React.createElement(StyledSplitPane, { allowResize: allowResize, maxSize: maxSize, minSize: minSize, size: size, split: split, onChange: handleSizeChange, paneOneRender: () => (React.createElement(ChartComponent, Object.assign({}, restProps, { ref: chartRef, data: resultData }))), paneTwoRender: () => (React.createElement("div", { ref: tooltipContainerRef },
|
|
96
|
+
React.createElement(TooltipContent, { ref: tooltipRef, renderer: resultData.tooltip.renderer }))) })));
|
|
97
|
+
});
|
|
98
|
+
component.displayName = `withSplitPane(${componentName})`;
|
|
99
|
+
return component;
|
|
100
|
+
}
|
|
@@ -15,8 +15,8 @@ declare const HighchartsWidget: React.ForwardRefExoticComponent<{
|
|
|
15
15
|
hoistConfigError?: boolean | undefined;
|
|
16
16
|
nonBodyScroll?: boolean | undefined;
|
|
17
17
|
splitTooltip?: boolean | undefined;
|
|
18
|
-
paneSplitOrientation?: import("
|
|
19
|
-
onSplitPaneOrientationChange?: ((orientation: import("
|
|
18
|
+
paneSplitOrientation?: import("../../../components/SplitPane").SplitLayoutType | undefined;
|
|
19
|
+
onSplitPaneOrientationChange?: ((orientation: import("../../../components/SplitPane").SplitLayoutType) => void) | undefined;
|
|
20
20
|
onChange?: ((data: {
|
|
21
21
|
type: "PARAMS_CHANGED";
|
|
22
22
|
data: {
|
|
@@ -119,7 +119,7 @@ export class HighchartsComponent extends React.PureComponent {
|
|
|
119
119
|
return null;
|
|
120
120
|
}
|
|
121
121
|
markChartPerformance(this.getId(true));
|
|
122
|
-
return (React.createElement(Component, { key: Math.random(), options: options, highcharts: Highcharts, onSplitPaneMountCallback: this.state.callback || undefined, onSplitPaneOrientationChange: this.props.onSplitPaneOrientationChange, paneSplitOrientation: this.props.paneSplitOrientation, callback: this.extendChartInstance, constructorType: (options === null || options === void 0 ? void 0 : options.useHighStock) ? 'stockChart' : 'chart', containerProps: { className: 'chartkit-graph' }, ref: this.chartComponent, onRender: this.needRenderCallback()
|
|
122
|
+
return (React.createElement(Component, { key: Math.random(), options: options, highcharts: Highcharts, onSplitPaneMountCallback: this.state.callback || undefined, onSplitPaneOrientationChange: this.props.onSplitPaneOrientationChange, paneSplitOrientation: this.props.paneSplitOrientation, callback: this.extendChartInstance, constructorType: (options === null || options === void 0 ? void 0 : options.useHighStock) ? 'stockChart' : 'chart', containerProps: { className: 'chartkit-graph' }, ref: this.chartComponent, onRender: this.needRenderCallback() ? this.props.onRender : undefined }));
|
|
123
123
|
}
|
|
124
124
|
getId(refresh = false) {
|
|
125
125
|
if (refresh) {
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import debounce from 'lodash/debounce';
|
|
4
4
|
import get from 'lodash/get';
|
|
5
|
+
import { StyledSplitPane } from '../../../../../components/SplitPane';
|
|
5
6
|
import { getRandomCKId } from '../../../../../utils';
|
|
6
7
|
import { cn } from '../../../../../utils/cn';
|
|
7
8
|
import { chartTypesWithoutCrosshair } from '../../helpers/config/config';
|
|
8
|
-
import { StyledSplitPane } from '../StyledSplitPane/StyledSplitPane';
|
|
9
9
|
import './WithSplitPane.css';
|
|
10
10
|
const b = cn('with-split-pane');
|
|
11
11
|
const PANE_RESIZER_HEIGHT = 24;
|
package/build/types/index.js
CHANGED
package/build/types/widget.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { SplitLayoutType } from '../components/SplitPane/types';
|
|
3
3
|
import type { Highcharts, HighchartsWidgetData, StringParams } from '../plugins/highcharts/types';
|
|
4
4
|
import type { IndicatorWidgetData } from '../plugins/indicator/types';
|
|
5
5
|
import type { CustomTooltipProps, Yagr, YagrWidgetData } from '../plugins/yagr/types';
|
|
@@ -21,8 +21,8 @@ export interface ChartKitWidget {
|
|
|
21
21
|
hoistConfigError?: boolean;
|
|
22
22
|
nonBodyScroll?: boolean;
|
|
23
23
|
splitTooltip?: boolean;
|
|
24
|
-
paneSplitOrientation?:
|
|
25
|
-
onSplitPaneOrientationChange?: (orientation:
|
|
24
|
+
paneSplitOrientation?: SplitLayoutType;
|
|
25
|
+
onSplitPaneOrientationChange?: (orientation: SplitLayoutType) => void;
|
|
26
26
|
onChange?: (data: {
|
|
27
27
|
type: 'PARAMS_CHANGED';
|
|
28
28
|
data: {
|
|
@@ -35,5 +35,8 @@ export interface ChartKitWidget {
|
|
|
35
35
|
d3: {
|
|
36
36
|
data: ChartKitWidgetData;
|
|
37
37
|
widget: never;
|
|
38
|
+
tooltip?: {
|
|
39
|
+
splitted?: boolean;
|
|
40
|
+
};
|
|
38
41
|
};
|
|
39
42
|
}
|
package/build/utils/index.d.ts
CHANGED
package/build/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/chartkit",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.18.0",
|
|
4
4
|
"description": "React component used to render charts based on any sources you need",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "git@github.com:gravity-ui/ChartKit.git",
|
|
@@ -47,13 +47,12 @@
|
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@bem-react/classname": "^1.6.0",
|
|
50
|
+
"@gravity-ui/charts": "^0.4.0",
|
|
50
51
|
"@gravity-ui/date-utils": "^2.1.0",
|
|
51
52
|
"@gravity-ui/i18n": "^1.0.0",
|
|
52
53
|
"@gravity-ui/yagr": "^4.3.4",
|
|
53
54
|
"afterframe": "^1.0.2",
|
|
54
|
-
"d3": "^7.8.5",
|
|
55
55
|
"lodash": "^4.17.21",
|
|
56
|
-
"react-split-pane": "^0.1.92",
|
|
57
56
|
"tslib": "^2.6.2"
|
|
58
57
|
},
|
|
59
58
|
"devDependencies": {
|
|
@@ -64,7 +63,7 @@
|
|
|
64
63
|
"@gravity-ui/prettier-config": "^1.1.0",
|
|
65
64
|
"@gravity-ui/stylelint-config": "^4.0.1",
|
|
66
65
|
"@gravity-ui/tsconfig": "^1.0.0",
|
|
67
|
-
"@gravity-ui/uikit": "^6.
|
|
66
|
+
"@gravity-ui/uikit": "^6.35.2",
|
|
68
67
|
"@jest/types": "^29.6.3",
|
|
69
68
|
"@playwright/experimental-ct-react17": "^1.41.1",
|
|
70
69
|
"@storybook/addon-actions": "^7.6.14",
|
|
@@ -84,6 +83,7 @@
|
|
|
84
83
|
"@typescript-eslint/eslint-plugin": "^5.31.0",
|
|
85
84
|
"cross-env": "^7.0.3",
|
|
86
85
|
"css-loader": "^5.2.7",
|
|
86
|
+
"d3": "^7.9.0",
|
|
87
87
|
"eslint": "^8.56.0",
|
|
88
88
|
"gulp": "^4.0.2",
|
|
89
89
|
"gulp-cli": "^2.3.0",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ChartKit } from '../../../../components/ChartKit';
|
|
3
|
-
import { ExampleWrapper } from '../ExampleWrapper';
|
|
4
|
-
import nintendoGames from '../nintendoGames';
|
|
5
|
-
function prepareData() {
|
|
6
|
-
const games = nintendoGames.filter((d) => {
|
|
7
|
-
return d.date && d.user_score && d.genres.includes('Puzzle');
|
|
8
|
-
});
|
|
9
|
-
return [
|
|
10
|
-
{
|
|
11
|
-
name: 'User score',
|
|
12
|
-
type: 'area',
|
|
13
|
-
data: games.map((d) => {
|
|
14
|
-
return {
|
|
15
|
-
x: Number(d.date),
|
|
16
|
-
y: Number(d.user_score),
|
|
17
|
-
};
|
|
18
|
-
}),
|
|
19
|
-
},
|
|
20
|
-
];
|
|
21
|
-
}
|
|
22
|
-
export const Basic = () => {
|
|
23
|
-
const series = prepareData();
|
|
24
|
-
const widgetData = {
|
|
25
|
-
series: {
|
|
26
|
-
data: series,
|
|
27
|
-
},
|
|
28
|
-
xAxis: {
|
|
29
|
-
type: 'datetime',
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
return (React.createElement(ExampleWrapper, null,
|
|
33
|
-
React.createElement(ChartKit, { type: "d3", data: widgetData })));
|
|
34
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ChartKit } from '../../../../components/ChartKit';
|
|
3
|
-
import { ExampleWrapper } from '../ExampleWrapper';
|
|
4
|
-
export const NegativeValues = () => {
|
|
5
|
-
const data = [
|
|
6
|
-
{ x: 0, y: 10 },
|
|
7
|
-
{ x: 1, y: 20 },
|
|
8
|
-
{ x: 2, y: -30 },
|
|
9
|
-
{ x: 3, y: 100 },
|
|
10
|
-
];
|
|
11
|
-
const widgetData = {
|
|
12
|
-
series: {
|
|
13
|
-
data: [
|
|
14
|
-
{
|
|
15
|
-
type: 'area',
|
|
16
|
-
data: data,
|
|
17
|
-
name: 'Min temperature',
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
return (React.createElement(ExampleWrapper, null,
|
|
23
|
-
React.createElement(ChartKit, { type: "d3", data: widgetData })));
|
|
24
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { groups } from 'd3';
|
|
3
|
-
import { ChartKit } from '../../../../components/ChartKit';
|
|
4
|
-
import { ExampleWrapper } from '../ExampleWrapper';
|
|
5
|
-
import nintendoGames from '../nintendoGames';
|
|
6
|
-
const years = Array.from(new Set(nintendoGames.map((d) => d.date ? String(new Date(d.date).getFullYear()) : 'unknown'))).sort();
|
|
7
|
-
function prepareData() {
|
|
8
|
-
const grouped = groups(nintendoGames, (d) => d.platform, (d) => (d.date ? String(new Date(d.date).getFullYear()) : 'unknown'));
|
|
9
|
-
const series = grouped.map(([platform, gamesByYear]) => {
|
|
10
|
-
const platformGames = Object.fromEntries(gamesByYear) || {};
|
|
11
|
-
return {
|
|
12
|
-
name: platform,
|
|
13
|
-
data: years.reduce((acc, year) => {
|
|
14
|
-
if (year in platformGames) {
|
|
15
|
-
acc.push({
|
|
16
|
-
x: year,
|
|
17
|
-
y: platformGames[year].length,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return acc;
|
|
21
|
-
}, []),
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
return { series };
|
|
25
|
-
}
|
|
26
|
-
export const PercentStackingArea = () => {
|
|
27
|
-
const { series } = prepareData();
|
|
28
|
-
const data = series.map((s) => {
|
|
29
|
-
return {
|
|
30
|
-
type: 'area',
|
|
31
|
-
stacking: 'percent',
|
|
32
|
-
name: s.name,
|
|
33
|
-
data: s.data,
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
const widgetData = {
|
|
37
|
-
series: {
|
|
38
|
-
data: data,
|
|
39
|
-
},
|
|
40
|
-
xAxis: {
|
|
41
|
-
type: 'category',
|
|
42
|
-
categories: years,
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
return (React.createElement(ExampleWrapper, null,
|
|
46
|
-
React.createElement(ChartKit, { type: "d3", data: widgetData })));
|
|
47
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { groups } from 'd3';
|
|
3
|
-
import { ChartKit } from '../../../../components/ChartKit';
|
|
4
|
-
import { ExampleWrapper } from '../ExampleWrapper';
|
|
5
|
-
import nintendoGames from '../nintendoGames';
|
|
6
|
-
const years = Array.from(new Set(nintendoGames.map((d) => d.date ? String(new Date(d.date).getFullYear()) : 'unknown'))).sort();
|
|
7
|
-
function prepareData() {
|
|
8
|
-
const grouped = groups(nintendoGames, (d) => d.platform, (d) => (d.date ? String(new Date(d.date).getFullYear()) : 'unknown'));
|
|
9
|
-
const series = grouped.map(([platform, gamesByYear]) => {
|
|
10
|
-
const platformGames = Object.fromEntries(gamesByYear) || {};
|
|
11
|
-
return {
|
|
12
|
-
name: platform,
|
|
13
|
-
data: years.reduce((acc, year) => {
|
|
14
|
-
if (year in platformGames) {
|
|
15
|
-
acc.push({
|
|
16
|
-
x: year,
|
|
17
|
-
y: platformGames[year].length,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return acc;
|
|
21
|
-
}, []),
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
return { series };
|
|
25
|
-
}
|
|
26
|
-
export const StackedArea = () => {
|
|
27
|
-
const { series } = prepareData();
|
|
28
|
-
const data = series.map((s) => {
|
|
29
|
-
return {
|
|
30
|
-
type: 'area',
|
|
31
|
-
stacking: 'normal',
|
|
32
|
-
name: s.name,
|
|
33
|
-
data: s.data,
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
const widgetData = {
|
|
37
|
-
series: {
|
|
38
|
-
data: data,
|
|
39
|
-
},
|
|
40
|
-
xAxis: {
|
|
41
|
-
type: 'category',
|
|
42
|
-
categories: years,
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
return (React.createElement(ExampleWrapper, null,
|
|
46
|
-
React.createElement(ChartKit, { type: "d3", data: widgetData })));
|
|
47
|
-
};
|