@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,32 +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
|
-
function prepareData() {
|
|
7
|
-
const gamesByPlatform = groups(nintendoGames, (item) => item.platform);
|
|
8
|
-
return gamesByPlatform.map(([platform, games]) => ({
|
|
9
|
-
name: platform,
|
|
10
|
-
value: games.length,
|
|
11
|
-
}));
|
|
12
|
-
}
|
|
13
|
-
export const BasicPie = () => {
|
|
14
|
-
const data = prepareData();
|
|
15
|
-
const widgetData = {
|
|
16
|
-
series: {
|
|
17
|
-
data: [
|
|
18
|
-
{
|
|
19
|
-
type: 'pie',
|
|
20
|
-
data: data,
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
legend: { enabled: true },
|
|
25
|
-
title: {
|
|
26
|
-
text: 'Platforms',
|
|
27
|
-
style: { fontSize: '12px', fontWeight: 'normal' },
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
return (React.createElement(ExampleWrapper, null,
|
|
31
|
-
React.createElement(ChartKit, { type: "d3", data: widgetData })));
|
|
32
|
-
};
|
|
@@ -1,33 +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
|
-
function prepareData() {
|
|
7
|
-
const gamesByPlatform = groups(nintendoGames, (d) => d.esrb_rating || 'unknown');
|
|
8
|
-
return gamesByPlatform.map(([value, games]) => ({
|
|
9
|
-
name: value,
|
|
10
|
-
value: games.length,
|
|
11
|
-
}));
|
|
12
|
-
}
|
|
13
|
-
export const Donut = () => {
|
|
14
|
-
const data = prepareData();
|
|
15
|
-
const widgetData = {
|
|
16
|
-
series: {
|
|
17
|
-
data: [
|
|
18
|
-
{
|
|
19
|
-
type: 'pie',
|
|
20
|
-
innerRadius: '50%',
|
|
21
|
-
data: data,
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
legend: { enabled: true },
|
|
26
|
-
title: {
|
|
27
|
-
text: 'ESRB ratings',
|
|
28
|
-
style: { fontSize: '12px', fontWeight: 'normal' },
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
return (React.createElement(ExampleWrapper, null,
|
|
32
|
-
React.createElement(ChartKit, { type: "d3", data: widgetData })));
|
|
33
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { groups } from 'd3';
|
|
3
|
-
import { ChartKit } from '../../../../components/ChartKit';
|
|
4
|
-
import { CustomShapeRenderer } from '../../utils';
|
|
5
|
-
import { ExampleWrapper } from '../ExampleWrapper';
|
|
6
|
-
import nintendoGames from '../nintendoGames';
|
|
7
|
-
function prepareData() {
|
|
8
|
-
const gamesByPlatform = groups(nintendoGames, (d) => d.esrb_rating || 'unknown');
|
|
9
|
-
return gamesByPlatform.map(([value, games]) => ({
|
|
10
|
-
name: value,
|
|
11
|
-
value: games.length,
|
|
12
|
-
}));
|
|
13
|
-
}
|
|
14
|
-
export const DonutWithTotals = () => {
|
|
15
|
-
const data = prepareData();
|
|
16
|
-
const totals = data.reduce((sum, d) => sum + d.value, 0);
|
|
17
|
-
const widgetData = {
|
|
18
|
-
series: {
|
|
19
|
-
data: [
|
|
20
|
-
{
|
|
21
|
-
type: 'pie',
|
|
22
|
-
innerRadius: '50%',
|
|
23
|
-
data: data,
|
|
24
|
-
renderCustomShape: CustomShapeRenderer.pieCenterText(`${totals}`),
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
legend: { enabled: true },
|
|
29
|
-
title: {
|
|
30
|
-
text: 'ESRB ratings',
|
|
31
|
-
style: { fontSize: '12px', fontWeight: 'normal' },
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
return (React.createElement(ExampleWrapper, null,
|
|
35
|
-
React.createElement(ChartKit, { type: "d3", data: widgetData })));
|
|
36
|
-
};
|
|
@@ -1,47 +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 dataset = nintendoGames.filter((d) => d.date && d.user_score);
|
|
7
|
-
const data = dataset.map((d) => ({
|
|
8
|
-
x: d.date || undefined,
|
|
9
|
-
y: d.user_score || undefined,
|
|
10
|
-
custom: d,
|
|
11
|
-
}));
|
|
12
|
-
return {
|
|
13
|
-
series: [
|
|
14
|
-
{
|
|
15
|
-
data,
|
|
16
|
-
name: 'Nintendo games',
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export const Basic = () => {
|
|
22
|
-
const { series } = prepareData();
|
|
23
|
-
const widgetData = {
|
|
24
|
-
series: {
|
|
25
|
-
data: series.map((s) => ({
|
|
26
|
-
type: 'scatter',
|
|
27
|
-
data: s.data.filter((d) => d.x),
|
|
28
|
-
name: s.name,
|
|
29
|
-
})),
|
|
30
|
-
},
|
|
31
|
-
yAxis: [
|
|
32
|
-
{
|
|
33
|
-
title: {
|
|
34
|
-
text: 'User score',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
xAxis: {
|
|
39
|
-
type: 'datetime',
|
|
40
|
-
title: {
|
|
41
|
-
text: 'Release dates',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
return (React.createElement(ExampleWrapper, null,
|
|
46
|
-
React.createElement(ChartKit, { type: "d3", data: widgetData })));
|
|
47
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { dateTime } from '@gravity-ui/date-utils';
|
|
3
|
-
import { ChartKit } from '../../../../components/ChartKit';
|
|
4
|
-
import { ExampleWrapper } from '../ExampleWrapper';
|
|
5
|
-
import marsWeatherData from '../mars-weather';
|
|
6
|
-
export const TwoYAxis = () => {
|
|
7
|
-
const data = marsWeatherData;
|
|
8
|
-
const minTempData = data.map((d) => ({
|
|
9
|
-
x: dateTime({ input: d.terrestrial_date, format: 'YYYY-MM-DD' }).valueOf(),
|
|
10
|
-
y: d.min_temp,
|
|
11
|
-
}));
|
|
12
|
-
const maxTempData = data.map((d) => ({
|
|
13
|
-
x: dateTime({ input: d.terrestrial_date, format: 'YYYY-MM-DD' }).valueOf(),
|
|
14
|
-
y: d.max_temp,
|
|
15
|
-
}));
|
|
16
|
-
const widgetData = {
|
|
17
|
-
series: {
|
|
18
|
-
data: [
|
|
19
|
-
{
|
|
20
|
-
type: 'scatter',
|
|
21
|
-
data: minTempData,
|
|
22
|
-
name: 'Min Temperature',
|
|
23
|
-
yAxis: 0,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
type: 'scatter',
|
|
27
|
-
data: maxTempData,
|
|
28
|
-
name: 'Max Temperature',
|
|
29
|
-
yAxis: 1,
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
yAxis: [
|
|
34
|
-
{
|
|
35
|
-
title: {
|
|
36
|
-
text: 'Min',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
title: {
|
|
41
|
-
text: 'Max',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
xAxis: {
|
|
46
|
-
type: 'datetime',
|
|
47
|
-
title: {
|
|
48
|
-
text: 'Terrestrial date',
|
|
49
|
-
},
|
|
50
|
-
ticks: { pixelInterval: 200 },
|
|
51
|
-
},
|
|
52
|
-
title: {
|
|
53
|
-
text: 'Mars weather',
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
return (React.createElement(ExampleWrapper, null,
|
|
57
|
-
React.createElement(ChartKit, { type: "d3", data: widgetData })));
|
|
58
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ChartScale, PreparedAxis, PreparedSplit } from '../hooks';
|
|
3
|
-
type Props = {
|
|
4
|
-
axis: PreparedAxis;
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
scale: ChartScale;
|
|
8
|
-
split: PreparedSplit;
|
|
9
|
-
};
|
|
10
|
-
export declare function getTitlePosition(args: {
|
|
11
|
-
axis: PreparedAxis;
|
|
12
|
-
width: number;
|
|
13
|
-
rowCount: number;
|
|
14
|
-
}): {
|
|
15
|
-
x: number;
|
|
16
|
-
y: number;
|
|
17
|
-
};
|
|
18
|
-
export declare const AxisX: React.NamedExoticComponent<Props>;
|
|
19
|
-
export {};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { select } from 'd3';
|
|
3
|
-
import { block } from '../../../../utils/cn';
|
|
4
|
-
import { formatAxisTickLabel, getAxisTitleRows, getClosestPointsRange, getMaxTickCount, getScaleTicks, getTicksCount, handleOverflowingText, } from '../utils';
|
|
5
|
-
import { axisBottom } from '../utils/axis-generators';
|
|
6
|
-
const b = block('d3-axis');
|
|
7
|
-
function getLabelFormatter({ axis, scale }) {
|
|
8
|
-
const ticks = getScaleTicks(scale);
|
|
9
|
-
const tickStep = getClosestPointsRange(axis, ticks);
|
|
10
|
-
return (value) => {
|
|
11
|
-
if (!axis.labels.enabled) {
|
|
12
|
-
return '';
|
|
13
|
-
}
|
|
14
|
-
return formatAxisTickLabel({
|
|
15
|
-
axis,
|
|
16
|
-
value,
|
|
17
|
-
step: tickStep,
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export function getTitlePosition(args) {
|
|
22
|
-
const { axis, width, rowCount } = args;
|
|
23
|
-
if (rowCount < 1) {
|
|
24
|
-
return { x: 0, y: 0 };
|
|
25
|
-
}
|
|
26
|
-
let x;
|
|
27
|
-
const y = axis.title.height / rowCount + axis.title.margin + axis.labels.height + axis.labels.margin;
|
|
28
|
-
switch (axis.title.align) {
|
|
29
|
-
case 'left': {
|
|
30
|
-
x = axis.title.width / 2;
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
case 'right': {
|
|
34
|
-
x = width - axis.title.width / 2;
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
case 'center': {
|
|
38
|
-
x = width / 2;
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return { x, y };
|
|
43
|
-
}
|
|
44
|
-
export const AxisX = React.memo(function AxisX(props) {
|
|
45
|
-
const { axis, width, height: totalHeight, scale, split } = props;
|
|
46
|
-
const ref = React.useRef(null);
|
|
47
|
-
React.useEffect(() => {
|
|
48
|
-
if (!ref.current) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
let tickItems = [];
|
|
52
|
-
if (axis.grid.enabled) {
|
|
53
|
-
tickItems = new Array(split.plots.length || 1).fill(null).map((_, index) => {
|
|
54
|
-
var _a, _b;
|
|
55
|
-
const top = ((_a = split.plots[index]) === null || _a === void 0 ? void 0 : _a.top) || 0;
|
|
56
|
-
const height = ((_b = split.plots[index]) === null || _b === void 0 ? void 0 : _b.height) || totalHeight;
|
|
57
|
-
return [-top, -(top + height)];
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
const xAxisGenerator = axisBottom({
|
|
61
|
-
scale: scale,
|
|
62
|
-
ticks: {
|
|
63
|
-
items: tickItems,
|
|
64
|
-
labelFormat: getLabelFormatter({ axis, scale }),
|
|
65
|
-
labelsPaddings: axis.labels.padding,
|
|
66
|
-
labelsMargin: axis.labels.margin,
|
|
67
|
-
labelsStyle: axis.labels.style,
|
|
68
|
-
labelsMaxWidth: axis.labels.maxWidth,
|
|
69
|
-
labelsLineHeight: axis.labels.lineHeight,
|
|
70
|
-
count: getTicksCount({ axis, range: width }),
|
|
71
|
-
maxTickCount: getMaxTickCount({ axis, width }),
|
|
72
|
-
rotation: axis.labels.rotation,
|
|
73
|
-
},
|
|
74
|
-
domain: {
|
|
75
|
-
size: width,
|
|
76
|
-
color: axis.lineColor,
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
const svgElement = select(ref.current);
|
|
80
|
-
svgElement.selectAll('*').remove();
|
|
81
|
-
svgElement.call(xAxisGenerator).attr('class', b());
|
|
82
|
-
// add an axis header if necessary
|
|
83
|
-
if (axis.title.text) {
|
|
84
|
-
const titleRows = getAxisTitleRows({ axis, textMaxWidth: width });
|
|
85
|
-
svgElement
|
|
86
|
-
.append('text')
|
|
87
|
-
.attr('class', b('title'))
|
|
88
|
-
.attr('transform', () => {
|
|
89
|
-
const { x, y } = getTitlePosition({ axis, width, rowCount: titleRows.length });
|
|
90
|
-
return `translate(${x}, ${y})`;
|
|
91
|
-
})
|
|
92
|
-
.attr('font-size', axis.title.style.fontSize)
|
|
93
|
-
.attr('text-anchor', 'middle')
|
|
94
|
-
.selectAll('tspan')
|
|
95
|
-
.data(titleRows)
|
|
96
|
-
.join('tspan')
|
|
97
|
-
.attr('x', 0)
|
|
98
|
-
.attr('y', (d) => d.y)
|
|
99
|
-
.text((d) => d.text)
|
|
100
|
-
.each((_d, index, nodes) => {
|
|
101
|
-
if (index === axis.title.maxRowCount - 1) {
|
|
102
|
-
handleOverflowingText(nodes[index], width);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}, [axis, width, totalHeight, scale, split]);
|
|
107
|
-
return React.createElement("g", { ref: ref });
|
|
108
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ChartScale, PreparedAxis, PreparedSplit } from '../hooks';
|
|
3
|
-
type Props = {
|
|
4
|
-
axes: PreparedAxis[];
|
|
5
|
-
scale: ChartScale[];
|
|
6
|
-
width: number;
|
|
7
|
-
height: number;
|
|
8
|
-
split: PreparedSplit;
|
|
9
|
-
};
|
|
10
|
-
export declare const AxisY: (props: Props) => React.JSX.Element;
|
|
11
|
-
export {};
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { axisLeft, axisRight, line, select } from 'd3';
|
|
3
|
-
import { block } from '../../../../utils/cn';
|
|
4
|
-
import { calculateCos, calculateSin, formatAxisTickLabel, getAxisHeight, getAxisTitleRows, getClosestPointsRange, getScaleTicks, getTicksCount, handleOverflowingText, parseTransformStyle, setEllipsisForOverflowTexts, wrapText, } from '../utils';
|
|
5
|
-
const b = block('d3-axis');
|
|
6
|
-
function transformLabel(args) {
|
|
7
|
-
const { node, axis } = args;
|
|
8
|
-
let topOffset = axis.labels.lineHeight / 2;
|
|
9
|
-
let leftOffset = axis.labels.margin;
|
|
10
|
-
if (axis.position === 'left') {
|
|
11
|
-
leftOffset = leftOffset * -1;
|
|
12
|
-
}
|
|
13
|
-
if (axis.labels.rotation) {
|
|
14
|
-
if (axis.labels.rotation > 0) {
|
|
15
|
-
leftOffset -= axis.labels.lineHeight * calculateSin(axis.labels.rotation);
|
|
16
|
-
topOffset = axis.labels.lineHeight * calculateCos(axis.labels.rotation);
|
|
17
|
-
if (axis.labels.rotation % 360 === 90) {
|
|
18
|
-
topOffset = ((node === null || node === void 0 ? void 0 : node.getBoundingClientRect().width) || 0) / 2;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
topOffset = 0;
|
|
23
|
-
if (axis.labels.rotation % 360 === -90) {
|
|
24
|
-
topOffset = -((node === null || node === void 0 ? void 0 : node.getBoundingClientRect().width) || 0) / 2;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return `translate(${leftOffset}px, ${topOffset}px) rotate(${axis.labels.rotation}deg)`;
|
|
28
|
-
}
|
|
29
|
-
return `translate(${leftOffset}px, ${topOffset}px)`;
|
|
30
|
-
}
|
|
31
|
-
function getAxisGenerator(args) {
|
|
32
|
-
const { preparedAxis, axisGenerator: generator, width, height, scale } = args;
|
|
33
|
-
const tickSize = preparedAxis.grid.enabled ? width * -1 : 0;
|
|
34
|
-
const step = getClosestPointsRange(preparedAxis, getScaleTicks(scale));
|
|
35
|
-
let axisGenerator = generator
|
|
36
|
-
.tickSize(tickSize)
|
|
37
|
-
.tickPadding(preparedAxis.labels.margin)
|
|
38
|
-
.tickFormat((value) => {
|
|
39
|
-
if (!preparedAxis.labels.enabled) {
|
|
40
|
-
return '';
|
|
41
|
-
}
|
|
42
|
-
return formatAxisTickLabel({
|
|
43
|
-
axis: preparedAxis,
|
|
44
|
-
value,
|
|
45
|
-
step,
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
const ticksCount = getTicksCount({ axis: preparedAxis, range: height });
|
|
49
|
-
if (ticksCount) {
|
|
50
|
-
axisGenerator = axisGenerator.ticks(ticksCount);
|
|
51
|
-
}
|
|
52
|
-
return axisGenerator;
|
|
53
|
-
}
|
|
54
|
-
function getTitlePosition(args) {
|
|
55
|
-
const { axis, axisHeight, rowCount } = args;
|
|
56
|
-
if (rowCount < 1) {
|
|
57
|
-
return { x: 0, y: 0 };
|
|
58
|
-
}
|
|
59
|
-
const x = -(axis.title.height -
|
|
60
|
-
axis.title.height / rowCount +
|
|
61
|
-
axis.title.margin +
|
|
62
|
-
axis.labels.margin +
|
|
63
|
-
axis.labels.width);
|
|
64
|
-
let y;
|
|
65
|
-
switch (axis.title.align) {
|
|
66
|
-
case 'left': {
|
|
67
|
-
y = axisHeight - axis.title.width / 2;
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
case 'right': {
|
|
71
|
-
y = axis.title.width / 2;
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
case 'center': {
|
|
75
|
-
y = axisHeight / 2;
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return { x, y };
|
|
80
|
-
}
|
|
81
|
-
export const AxisY = (props) => {
|
|
82
|
-
const { axes, width, height: totalHeight, scale, split } = props;
|
|
83
|
-
const height = getAxisHeight({ split, boundsHeight: totalHeight });
|
|
84
|
-
const ref = React.useRef(null);
|
|
85
|
-
React.useEffect(() => {
|
|
86
|
-
if (!ref.current) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
const svgElement = select(ref.current);
|
|
90
|
-
svgElement.selectAll('*').remove();
|
|
91
|
-
const axisSelection = svgElement
|
|
92
|
-
.selectAll('axis')
|
|
93
|
-
.data(axes)
|
|
94
|
-
.join('g')
|
|
95
|
-
.attr('class', b())
|
|
96
|
-
.style('transform', (d) => {
|
|
97
|
-
var _a;
|
|
98
|
-
const top = ((_a = split.plots[d.plotIndex]) === null || _a === void 0 ? void 0 : _a.top) || 0;
|
|
99
|
-
if (d.position === 'left') {
|
|
100
|
-
return `translate(0, ${top}px)`;
|
|
101
|
-
}
|
|
102
|
-
return `translate(${width}px, 0)`;
|
|
103
|
-
});
|
|
104
|
-
axisSelection.each((d, index, node) => {
|
|
105
|
-
const seriesScale = scale[index];
|
|
106
|
-
const axisItem = select(node[index]);
|
|
107
|
-
const yAxisGenerator = getAxisGenerator({
|
|
108
|
-
axisGenerator: d.position === 'left'
|
|
109
|
-
? axisLeft(seriesScale)
|
|
110
|
-
: axisRight(seriesScale),
|
|
111
|
-
preparedAxis: d,
|
|
112
|
-
height,
|
|
113
|
-
width,
|
|
114
|
-
scale: seriesScale,
|
|
115
|
-
});
|
|
116
|
-
yAxisGenerator(axisItem);
|
|
117
|
-
if (d.labels.enabled) {
|
|
118
|
-
const tickTexts = axisItem
|
|
119
|
-
.selectAll('.tick text')
|
|
120
|
-
// The offset must be applied before the labels are rotated.
|
|
121
|
-
// Therefore, we reset the values and make an offset in transform attribute.
|
|
122
|
-
// FIXME: give up axisLeft(d3) and switch to our own generation method
|
|
123
|
-
.attr('x', null)
|
|
124
|
-
.attr('dy', null)
|
|
125
|
-
.style('font-size', d.labels.style.fontSize)
|
|
126
|
-
.style('transform', function () {
|
|
127
|
-
return transformLabel({ node: this, axis: d });
|
|
128
|
-
});
|
|
129
|
-
const textMaxWidth = !d.labels.rotation || Math.abs(d.labels.rotation) % 360 !== 90
|
|
130
|
-
? d.labels.maxWidth
|
|
131
|
-
: (height - d.labels.padding * (tickTexts.size() - 1)) / tickTexts.size();
|
|
132
|
-
tickTexts.call(setEllipsisForOverflowTexts, textMaxWidth);
|
|
133
|
-
}
|
|
134
|
-
// remove overlapping ticks
|
|
135
|
-
// Note: this method do not prepared for rotated labels
|
|
136
|
-
if (!d.labels.rotation) {
|
|
137
|
-
let elementY = 0;
|
|
138
|
-
axisItem
|
|
139
|
-
.selectAll('.tick')
|
|
140
|
-
.filter(function (_d, tickIndex) {
|
|
141
|
-
const tickNode = this;
|
|
142
|
-
const r = tickNode.getBoundingClientRect();
|
|
143
|
-
if (r.bottom > elementY && tickIndex !== 0) {
|
|
144
|
-
return true;
|
|
145
|
-
}
|
|
146
|
-
elementY = r.top - d.labels.padding;
|
|
147
|
-
return false;
|
|
148
|
-
})
|
|
149
|
-
.remove();
|
|
150
|
-
}
|
|
151
|
-
return axisItem;
|
|
152
|
-
});
|
|
153
|
-
axisSelection
|
|
154
|
-
.select('.domain')
|
|
155
|
-
.attr('d', () => {
|
|
156
|
-
const points = [
|
|
157
|
-
[0, 0],
|
|
158
|
-
[0, height],
|
|
159
|
-
];
|
|
160
|
-
return line()(points);
|
|
161
|
-
})
|
|
162
|
-
.style('stroke', (d) => d.lineColor || '');
|
|
163
|
-
svgElement.selectAll('.tick').each((_d, index, nodes) => {
|
|
164
|
-
const tickNode = select(nodes[index]);
|
|
165
|
-
if (parseTransformStyle(tickNode.attr('transform')).y === height) {
|
|
166
|
-
// Remove stroke from tick that has the same y coordinate like domain
|
|
167
|
-
tickNode.select('line').style('stroke', 'none');
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
axisSelection
|
|
171
|
-
.append('text')
|
|
172
|
-
.attr('class', b('title'))
|
|
173
|
-
.attr('text-anchor', 'middle')
|
|
174
|
-
.attr('font-size', (d) => d.title.style.fontSize)
|
|
175
|
-
.attr('transform', (d) => {
|
|
176
|
-
const titleRows = wrapText({
|
|
177
|
-
text: d.title.text,
|
|
178
|
-
style: d.title.style,
|
|
179
|
-
width: height,
|
|
180
|
-
});
|
|
181
|
-
const rowCount = Math.min(titleRows.length, d.title.maxRowCount);
|
|
182
|
-
const { x, y } = getTitlePosition({ axis: d, axisHeight: height, rowCount });
|
|
183
|
-
const angle = d.position === 'left' ? -90 : 90;
|
|
184
|
-
return `translate(${x}, ${y}) rotate(${angle})`;
|
|
185
|
-
})
|
|
186
|
-
.selectAll('tspan')
|
|
187
|
-
.data((d) => getAxisTitleRows({ axis: d, textMaxWidth: height }))
|
|
188
|
-
.join('tspan')
|
|
189
|
-
.attr('x', 0)
|
|
190
|
-
.attr('y', (d) => d.y)
|
|
191
|
-
.text((d) => d.text)
|
|
192
|
-
.each((_d, index, nodes) => {
|
|
193
|
-
if (index === nodes.length - 1) {
|
|
194
|
-
handleOverflowingText(nodes[index], height);
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
}, [axes, width, height, scale, split]);
|
|
198
|
-
return React.createElement("g", { ref: ref, className: b('container') });
|
|
199
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ChartKitWidgetData } from '../../../../types';
|
|
3
|
-
import './styles.css';
|
|
4
|
-
type Props = {
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
data: ChartKitWidgetData;
|
|
8
|
-
};
|
|
9
|
-
export declare const Chart: (props: Props) => React.JSX.Element;
|
|
10
|
-
export {};
|