@gravity-ui/chartkit 5.17.1 → 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/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,36 +0,0 @@
|
|
|
1
|
-
import { symbolCircle, symbolDiamond2, symbolSquare, symbolTriangle2 } from 'd3';
|
|
2
|
-
import { SymbolType } from '../../../../constants';
|
|
3
|
-
export const getSymbolType = (index) => {
|
|
4
|
-
const scatterStyles = Object.values(SymbolType);
|
|
5
|
-
return scatterStyles[index % scatterStyles.length];
|
|
6
|
-
};
|
|
7
|
-
// This is an inverted triangle
|
|
8
|
-
// Based on https://github.com/d3/d3-shape/blob/main/src/symbol/triangle2.js
|
|
9
|
-
const sqrt3 = Math.sqrt(3);
|
|
10
|
-
const triangleDown = {
|
|
11
|
-
draw: (context, size) => {
|
|
12
|
-
const s = Math.sqrt(size) * 0.6824;
|
|
13
|
-
const t = s / 2;
|
|
14
|
-
const u = (s * sqrt3) / 2;
|
|
15
|
-
context.moveTo(0, s);
|
|
16
|
-
context.lineTo(u, -t);
|
|
17
|
-
context.lineTo(-u, -t);
|
|
18
|
-
context.closePath();
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
export const getSymbol = (symbolType) => {
|
|
22
|
-
switch (symbolType) {
|
|
23
|
-
case SymbolType.Diamond:
|
|
24
|
-
return symbolDiamond2;
|
|
25
|
-
case SymbolType.Circle:
|
|
26
|
-
return symbolCircle;
|
|
27
|
-
case SymbolType.Square:
|
|
28
|
-
return symbolSquare;
|
|
29
|
-
case SymbolType.Triangle:
|
|
30
|
-
return symbolTriangle2;
|
|
31
|
-
case SymbolType.TriangleDown:
|
|
32
|
-
return triangleDown;
|
|
33
|
-
default:
|
|
34
|
-
return symbolCircle;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { Selection } from 'd3';
|
|
2
|
-
import { BaseTextStyle } from '../../../../types';
|
|
3
|
-
export declare function handleOverflowingText(tSpan: SVGTSpanElement | null, maxWidth: number): void;
|
|
4
|
-
export declare function setEllipsisForOverflowText<T>(selection: Selection<SVGTextElement, T, null, unknown>, maxWidth: number): void;
|
|
5
|
-
export declare function setEllipsisForOverflowTexts<T>(selection: Selection<SVGTextElement, T, any, unknown>, maxWidth: ((datum: T) => number) | number): void;
|
|
6
|
-
export declare function hasOverlappingLabels({ width, labels, padding, style, }: {
|
|
7
|
-
width: number;
|
|
8
|
-
labels: string[];
|
|
9
|
-
style?: BaseTextStyle;
|
|
10
|
-
padding?: number;
|
|
11
|
-
}): boolean;
|
|
12
|
-
export declare function getLabelsSize({ labels, style, rotation, html, }: {
|
|
13
|
-
labels: string[];
|
|
14
|
-
style?: BaseTextStyle;
|
|
15
|
-
rotation?: number;
|
|
16
|
-
html?: boolean;
|
|
17
|
-
}): {
|
|
18
|
-
maxHeight: number;
|
|
19
|
-
maxWidth: number;
|
|
20
|
-
};
|
|
21
|
-
export type TextRow = {
|
|
22
|
-
text: string;
|
|
23
|
-
y: number;
|
|
24
|
-
};
|
|
25
|
-
export declare function wrapText(args: {
|
|
26
|
-
text: string;
|
|
27
|
-
style?: BaseTextStyle;
|
|
28
|
-
width: number;
|
|
29
|
-
}): TextRow[];
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { select } from 'd3-selection';
|
|
2
|
-
export function handleOverflowingText(tSpan, maxWidth) {
|
|
3
|
-
var _a, _b, _c;
|
|
4
|
-
if (!tSpan) {
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
const svg = tSpan.closest('svg');
|
|
8
|
-
if (!svg) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
const textNode = tSpan.closest('text');
|
|
12
|
-
const angle = ((_a = Array.from((textNode === null || textNode === void 0 ? void 0 : textNode.transform.baseVal) || []).find((item) => item.angle)) === null || _a === void 0 ? void 0 : _a.angle) || 0;
|
|
13
|
-
const revertRotation = svg.createSVGTransform();
|
|
14
|
-
revertRotation.setRotate(-angle, 0, 0);
|
|
15
|
-
textNode === null || textNode === void 0 ? void 0 : textNode.transform.baseVal.appendItem(revertRotation);
|
|
16
|
-
let text = tSpan.textContent || '';
|
|
17
|
-
let textLength = ((_b = tSpan.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.width) || 0;
|
|
18
|
-
while (textLength > maxWidth && text.length > 1) {
|
|
19
|
-
text = text.slice(0, -1);
|
|
20
|
-
tSpan.textContent = text + '…';
|
|
21
|
-
textLength = ((_c = tSpan.getBoundingClientRect()) === null || _c === void 0 ? void 0 : _c.width) || 0;
|
|
22
|
-
}
|
|
23
|
-
textNode === null || textNode === void 0 ? void 0 : textNode.transform.baseVal.removeItem((textNode === null || textNode === void 0 ? void 0 : textNode.transform.baseVal.length) - 1);
|
|
24
|
-
}
|
|
25
|
-
export function setEllipsisForOverflowText(selection, maxWidth) {
|
|
26
|
-
const text = selection.text();
|
|
27
|
-
selection.text(null).append('title').text(text);
|
|
28
|
-
const tSpan = selection.append('tspan').text(text).style('alignment-baseline', 'inherit');
|
|
29
|
-
handleOverflowingText(tSpan.node(), maxWidth);
|
|
30
|
-
}
|
|
31
|
-
export function setEllipsisForOverflowTexts(selection, maxWidth) {
|
|
32
|
-
selection.each(function (datum) {
|
|
33
|
-
const textMaxWidth = typeof maxWidth === 'function' ? maxWidth(datum) : maxWidth;
|
|
34
|
-
setEllipsisForOverflowText(select(this), textMaxWidth);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
export function hasOverlappingLabels({ width, labels, padding = 0, style, }) {
|
|
38
|
-
const maxWidth = (width - padding * (labels.length - 1)) / labels.length;
|
|
39
|
-
const textElement = select(document.body)
|
|
40
|
-
.append('text')
|
|
41
|
-
.style('font-size', (style === null || style === void 0 ? void 0 : style.fontSize) || '');
|
|
42
|
-
const result = labels.some((label) => {
|
|
43
|
-
var _a, _b;
|
|
44
|
-
const textWidth = ((_b = (_a = textElement.text(label).node()) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.width) || 0;
|
|
45
|
-
return textWidth > maxWidth;
|
|
46
|
-
});
|
|
47
|
-
textElement.remove();
|
|
48
|
-
return result;
|
|
49
|
-
}
|
|
50
|
-
function renderLabels(selection, { labels, style = {}, attrs = {}, }) {
|
|
51
|
-
const text = selection.append('g').append('text');
|
|
52
|
-
text.style('font-size', style.fontSize || '');
|
|
53
|
-
text.style('font-weight', style.fontWeight || '');
|
|
54
|
-
Object.entries(attrs).forEach(([name, value]) => {
|
|
55
|
-
text.attr(name, value);
|
|
56
|
-
});
|
|
57
|
-
text.selectAll('tspan')
|
|
58
|
-
.data(labels)
|
|
59
|
-
.enter()
|
|
60
|
-
.append('tspan')
|
|
61
|
-
.attr('x', 0)
|
|
62
|
-
.attr('dy', 0)
|
|
63
|
-
.text((d) => d);
|
|
64
|
-
return text;
|
|
65
|
-
}
|
|
66
|
-
export function getLabelsSize({ labels, style, rotation, html, }) {
|
|
67
|
-
var _a, _b, _c;
|
|
68
|
-
if (!labels.filter(Boolean).length) {
|
|
69
|
-
return { maxHeight: 0, maxWidth: 0 };
|
|
70
|
-
}
|
|
71
|
-
const container = select(document.body)
|
|
72
|
-
.append('div')
|
|
73
|
-
.attr('class', 'chartkit chartkit-theme_common');
|
|
74
|
-
const result = { maxHeight: 0, maxWidth: 0 };
|
|
75
|
-
let labelWrapper;
|
|
76
|
-
if (html) {
|
|
77
|
-
labelWrapper = container.append('div').style('position', 'absolute').node();
|
|
78
|
-
const { height, width } = labels.reduce((acc, l) => {
|
|
79
|
-
var _a, _b;
|
|
80
|
-
if (labelWrapper) {
|
|
81
|
-
labelWrapper.innerHTML = l;
|
|
82
|
-
}
|
|
83
|
-
const rect = labelWrapper === null || labelWrapper === void 0 ? void 0 : labelWrapper.getBoundingClientRect();
|
|
84
|
-
return {
|
|
85
|
-
width: Math.max(acc.width, (_a = rect === null || rect === void 0 ? void 0 : rect.width) !== null && _a !== void 0 ? _a : 0),
|
|
86
|
-
height: Math.max(acc.height, (_b = rect === null || rect === void 0 ? void 0 : rect.height) !== null && _b !== void 0 ? _b : 0),
|
|
87
|
-
};
|
|
88
|
-
}, { height: 0, width: 0 });
|
|
89
|
-
result.maxWidth = width;
|
|
90
|
-
result.maxHeight = height;
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
const svg = container.append('svg');
|
|
94
|
-
const textSelection = renderLabels(svg, { labels, style });
|
|
95
|
-
if (rotation) {
|
|
96
|
-
textSelection
|
|
97
|
-
.attr('text-anchor', rotation > 0 ? 'start' : 'end')
|
|
98
|
-
.style('transform', `rotate(${rotation}deg)`);
|
|
99
|
-
}
|
|
100
|
-
const rect = (_a = svg.select('g').node()) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
101
|
-
result.maxWidth = (_b = rect === null || rect === void 0 ? void 0 : rect.width) !== null && _b !== void 0 ? _b : 0;
|
|
102
|
-
result.maxHeight = (_c = rect === null || rect === void 0 ? void 0 : rect.height) !== null && _c !== void 0 ? _c : 0;
|
|
103
|
-
}
|
|
104
|
-
container.remove();
|
|
105
|
-
return result;
|
|
106
|
-
}
|
|
107
|
-
export function wrapText(args) {
|
|
108
|
-
const { text, style, width } = args;
|
|
109
|
-
const height = getLabelsSize({
|
|
110
|
-
labels: [text],
|
|
111
|
-
style: style,
|
|
112
|
-
}).maxHeight;
|
|
113
|
-
// @ts-ignore
|
|
114
|
-
const segmenter = new Intl.Segmenter([], { granularity: 'word' });
|
|
115
|
-
const segments = Array.from(segmenter.segment(text));
|
|
116
|
-
return segments.reduce((acc, s) => {
|
|
117
|
-
const item = s;
|
|
118
|
-
if (!acc.length) {
|
|
119
|
-
acc.push({
|
|
120
|
-
text: '',
|
|
121
|
-
y: acc.length * height,
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
let lastRow = acc[acc.length - 1];
|
|
125
|
-
if (item.isWordLike &&
|
|
126
|
-
getLabelsSize({
|
|
127
|
-
labels: [lastRow.text + item.segment],
|
|
128
|
-
style,
|
|
129
|
-
}).maxWidth > width) {
|
|
130
|
-
lastRow = {
|
|
131
|
-
text: '',
|
|
132
|
-
y: acc.length * height,
|
|
133
|
-
};
|
|
134
|
-
acc.push(lastRow);
|
|
135
|
-
}
|
|
136
|
-
lastRow.text += item.segment;
|
|
137
|
-
return acc;
|
|
138
|
-
}, []);
|
|
139
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export const TIME_UNITS = {
|
|
2
|
-
millisecond: 1,
|
|
3
|
-
second: 1000,
|
|
4
|
-
minute: 60000,
|
|
5
|
-
hour: 3600000,
|
|
6
|
-
day: 24 * 3600000,
|
|
7
|
-
week: 7 * 24 * 3600000,
|
|
8
|
-
month: 28 * 24 * 3600000,
|
|
9
|
-
year: 364 * 24 * 3600000,
|
|
10
|
-
};
|
|
11
|
-
export const DATETIME_LABEL_FORMATS = {
|
|
12
|
-
millisecond: 'DD.MM.YY HH:mm:ss.SSS',
|
|
13
|
-
second: 'DD.MM.YY HH:mm:ss',
|
|
14
|
-
minute: 'DD.MM.YY HH:mm',
|
|
15
|
-
hour: 'DD.MM.YY HH:mm',
|
|
16
|
-
day: 'DD.MM.YY',
|
|
17
|
-
week: 'DD.MM.YY',
|
|
18
|
-
month: "MMM 'YY",
|
|
19
|
-
year: 'YYYY',
|
|
20
|
-
};
|
|
21
|
-
function getTimeUnit(range) {
|
|
22
|
-
const units = Object.keys(TIME_UNITS);
|
|
23
|
-
const index = units.findIndex((unit) => range < TIME_UNITS[unit]);
|
|
24
|
-
return index === -1 ? 'year' : units[index - 1];
|
|
25
|
-
}
|
|
26
|
-
export function getDefaultDateFormat(range) {
|
|
27
|
-
if (range) {
|
|
28
|
-
const unit = getTimeUnit(range);
|
|
29
|
-
if (unit in DATETIME_LABEL_FORMATS) {
|
|
30
|
-
return DATETIME_LABEL_FORMATS[unit];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return DATETIME_LABEL_FORMATS.day;
|
|
34
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export const XY_SERIES = {
|
|
2
|
-
INVALID_CATEGORY_X: {
|
|
3
|
-
series: {
|
|
4
|
-
data: [{ type: 'scatter', data: [{ x: undefined, y: 1 }], name: 'Series' }],
|
|
5
|
-
},
|
|
6
|
-
xAxis: { type: 'category' },
|
|
7
|
-
},
|
|
8
|
-
INVALID_CATEGORY_Y: {
|
|
9
|
-
series: {
|
|
10
|
-
data: [{ type: 'scatter', data: [{ x: 1, y: undefined }], name: 'Series' }],
|
|
11
|
-
},
|
|
12
|
-
yAxis: [{ type: 'category' }],
|
|
13
|
-
},
|
|
14
|
-
INVALID_DATETIME_X: {
|
|
15
|
-
series: {
|
|
16
|
-
data: [{ type: 'scatter', data: [{ x: undefined, y: 1 }], name: 'Series' }],
|
|
17
|
-
},
|
|
18
|
-
xAxis: { type: 'datetime' },
|
|
19
|
-
},
|
|
20
|
-
INVALID_DATETIME_Y: {
|
|
21
|
-
series: {
|
|
22
|
-
data: [{ type: 'scatter', data: [{ x: undefined, y: 1 }], name: 'Series' }],
|
|
23
|
-
},
|
|
24
|
-
yAxis: [{ type: 'datetime' }],
|
|
25
|
-
},
|
|
26
|
-
INVALID_LINEAR_X: {
|
|
27
|
-
series: {
|
|
28
|
-
data: [{ type: 'scatter', data: [{ x: 'str', y: 1 }], name: 'Series' }],
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
INVALID_LINEAR_Y: {
|
|
32
|
-
series: {
|
|
33
|
-
data: [{ type: 'scatter', data: [{ x: 1, y: 'str' }], name: 'Series' }],
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
export const PIE_SERIES = {
|
|
38
|
-
INVALID_VALUE: {
|
|
39
|
-
series: {
|
|
40
|
-
// @ts-expect-error
|
|
41
|
-
data: [{ type: 'pie', data: [{ value: undefined, name: 'Series' }] }],
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
};
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import get from 'lodash/get';
|
|
2
|
-
import isEmpty from 'lodash/isEmpty';
|
|
3
|
-
import { SeriesType } from '../../../../constants';
|
|
4
|
-
import { i18n } from '../../../../i18n';
|
|
5
|
-
import { CHARTKIT_ERROR_CODE, ChartKitError } from '../../../../libs';
|
|
6
|
-
import { DEFAULT_AXIS_TYPE } from '../constants';
|
|
7
|
-
const AVAILABLE_SERIES_TYPES = Object.values(SeriesType);
|
|
8
|
-
const validateXYSeries = (args) => {
|
|
9
|
-
const { series, xAxis, yAxis = [] } = args;
|
|
10
|
-
const yAxisIndex = get(series, 'yAxis', 0);
|
|
11
|
-
const seriesYAxis = yAxis[yAxisIndex];
|
|
12
|
-
if (yAxisIndex !== 0 && typeof seriesYAxis === 'undefined') {
|
|
13
|
-
throw new ChartKitError({
|
|
14
|
-
code: CHARTKIT_ERROR_CODE.INVALID_DATA,
|
|
15
|
-
message: i18n('error', 'label_invalid-y-axis-index', {
|
|
16
|
-
index: yAxisIndex,
|
|
17
|
-
}),
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
const xType = get(xAxis, 'type', DEFAULT_AXIS_TYPE);
|
|
21
|
-
const yType = get(seriesYAxis, 'type', DEFAULT_AXIS_TYPE);
|
|
22
|
-
series.data.forEach(({ x, y }) => {
|
|
23
|
-
switch (xType) {
|
|
24
|
-
case 'category': {
|
|
25
|
-
if (typeof x !== 'string' && typeof x !== 'number') {
|
|
26
|
-
throw new ChartKitError({
|
|
27
|
-
code: CHARTKIT_ERROR_CODE.INVALID_DATA,
|
|
28
|
-
message: i18n('error', 'label_invalid-axis-category-data-point', {
|
|
29
|
-
key: 'x',
|
|
30
|
-
seriesName: series.name,
|
|
31
|
-
}),
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
case 'datetime': {
|
|
37
|
-
if (typeof x !== 'number') {
|
|
38
|
-
throw new ChartKitError({
|
|
39
|
-
code: CHARTKIT_ERROR_CODE.INVALID_DATA,
|
|
40
|
-
message: i18n('error', 'label_invalid-axis-datetime-data-point', {
|
|
41
|
-
key: 'x',
|
|
42
|
-
seriesName: series.name,
|
|
43
|
-
}),
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
case 'linear': {
|
|
49
|
-
if (typeof x !== 'number' && x !== null) {
|
|
50
|
-
throw new ChartKitError({
|
|
51
|
-
code: CHARTKIT_ERROR_CODE.INVALID_DATA,
|
|
52
|
-
message: i18n('error', 'label_invalid-axis-linear-data-point', {
|
|
53
|
-
key: 'x',
|
|
54
|
-
seriesName: series.name,
|
|
55
|
-
}),
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
switch (yType) {
|
|
61
|
-
case 'category': {
|
|
62
|
-
if (typeof y !== 'string' && typeof y !== 'number') {
|
|
63
|
-
throw new ChartKitError({
|
|
64
|
-
code: CHARTKIT_ERROR_CODE.INVALID_DATA,
|
|
65
|
-
message: i18n('error', 'label_invalid-axis-category-data-point', {
|
|
66
|
-
key: 'y',
|
|
67
|
-
seriesName: series.name,
|
|
68
|
-
}),
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
case 'datetime': {
|
|
74
|
-
if (typeof y !== 'number') {
|
|
75
|
-
throw new ChartKitError({
|
|
76
|
-
code: CHARTKIT_ERROR_CODE.INVALID_DATA,
|
|
77
|
-
message: i18n('error', 'label_invalid-axis-datetime-data-point', {
|
|
78
|
-
key: 'y',
|
|
79
|
-
seriesName: series.name,
|
|
80
|
-
}),
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
case 'linear': {
|
|
86
|
-
if (typeof y !== 'number' && y !== null) {
|
|
87
|
-
throw new ChartKitError({
|
|
88
|
-
code: CHARTKIT_ERROR_CODE.INVALID_DATA,
|
|
89
|
-
message: i18n('error', 'label_invalid-axis-linear-data-point', {
|
|
90
|
-
key: 'y',
|
|
91
|
-
seriesName: series.name,
|
|
92
|
-
}),
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
const validatePieSeries = ({ series }) => {
|
|
100
|
-
series.data.forEach(({ value }) => {
|
|
101
|
-
if (typeof value !== 'number') {
|
|
102
|
-
throw new ChartKitError({
|
|
103
|
-
code: CHARTKIT_ERROR_CODE.INVALID_DATA,
|
|
104
|
-
message: i18n('error', 'label_invalid-pie-data-value'),
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
const validateStacking = ({ series }) => {
|
|
110
|
-
const availableStackingValues = ['normal', 'percent'];
|
|
111
|
-
if (series.stacking && !availableStackingValues.includes(series.stacking)) {
|
|
112
|
-
throw new ChartKitError({
|
|
113
|
-
code: CHARTKIT_ERROR_CODE.INVALID_DATA,
|
|
114
|
-
message: i18n('error', 'label_invalid-series-property', {
|
|
115
|
-
key: 'stacking',
|
|
116
|
-
values: availableStackingValues,
|
|
117
|
-
}),
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
const validateTreemapSeries = ({ series }) => {
|
|
122
|
-
const parentIds = {};
|
|
123
|
-
series.data.forEach((d) => {
|
|
124
|
-
if (d.parentId && !parentIds[d.parentId]) {
|
|
125
|
-
parentIds[d.parentId] = true;
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
series.data.forEach((d) => {
|
|
129
|
-
let idOrName = d.id;
|
|
130
|
-
if (!idOrName) {
|
|
131
|
-
idOrName = Array.isArray(d.name) ? d.name.join() : d.name;
|
|
132
|
-
}
|
|
133
|
-
if (parentIds[idOrName] && typeof d.value === 'number') {
|
|
134
|
-
throw new ChartKitError({
|
|
135
|
-
code: CHARTKIT_ERROR_CODE.INVALID_DATA,
|
|
136
|
-
message: i18n('error', 'label_invalid-treemap-redundant-value', {
|
|
137
|
-
id: d.id,
|
|
138
|
-
name: d.name,
|
|
139
|
-
}),
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
if (!parentIds[idOrName] && typeof d.value !== 'number') {
|
|
143
|
-
throw new ChartKitError({
|
|
144
|
-
code: CHARTKIT_ERROR_CODE.INVALID_DATA,
|
|
145
|
-
message: i18n('error', 'label_invalid-treemap-missing-value', {
|
|
146
|
-
id: d.id,
|
|
147
|
-
name: d.name,
|
|
148
|
-
}),
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
|
-
const validateSeries = (args) => {
|
|
154
|
-
const { series, xAxis, yAxis } = args;
|
|
155
|
-
if (!AVAILABLE_SERIES_TYPES.includes(series.type)) {
|
|
156
|
-
throw new ChartKitError({
|
|
157
|
-
code: CHARTKIT_ERROR_CODE.INVALID_DATA,
|
|
158
|
-
message: i18n('error', 'label_invalid-series-type', {
|
|
159
|
-
types: AVAILABLE_SERIES_TYPES.join(', '),
|
|
160
|
-
}),
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
switch (series.type) {
|
|
164
|
-
case 'area':
|
|
165
|
-
case 'bar-y':
|
|
166
|
-
case 'bar-x': {
|
|
167
|
-
validateXYSeries({ series, xAxis, yAxis });
|
|
168
|
-
validateStacking({ series });
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
case 'line':
|
|
172
|
-
case 'scatter': {
|
|
173
|
-
validateXYSeries({ series, xAxis, yAxis });
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
case 'pie': {
|
|
177
|
-
validatePieSeries({ series });
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
case 'treemap': {
|
|
181
|
-
validateTreemapSeries({ series });
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
const countSeriesByType = (args) => {
|
|
186
|
-
const { series, type } = args;
|
|
187
|
-
let count = 0;
|
|
188
|
-
series.forEach((s) => {
|
|
189
|
-
if (s.type === type) {
|
|
190
|
-
count += 1;
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
return count;
|
|
194
|
-
};
|
|
195
|
-
export const validateData = (data) => {
|
|
196
|
-
if (isEmpty(data) || isEmpty(data.series) || isEmpty(data.series.data)) {
|
|
197
|
-
throw new ChartKitError({
|
|
198
|
-
code: CHARTKIT_ERROR_CODE.NO_DATA,
|
|
199
|
-
message: i18n('error', 'label_no-data'),
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
if (data.series.data.some((s) => isEmpty(s.data))) {
|
|
203
|
-
throw new ChartKitError({
|
|
204
|
-
code: CHARTKIT_ERROR_CODE.INVALID_DATA,
|
|
205
|
-
message: 'You should specify data for all series',
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
const treemapSeriesCount = countSeriesByType({
|
|
209
|
-
series: data.series.data,
|
|
210
|
-
type: SeriesType.Treemap,
|
|
211
|
-
});
|
|
212
|
-
if (treemapSeriesCount > 1) {
|
|
213
|
-
throw new ChartKitError({
|
|
214
|
-
code: CHARTKIT_ERROR_CODE.INVALID_DATA,
|
|
215
|
-
message: 'It looks like you are trying to define more than one "treemap" series.',
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
data.series.data.forEach((series) => {
|
|
219
|
-
validateSeries({ series, yAxis: data.yAxis, xAxis: data.xAxis });
|
|
220
|
-
});
|
|
221
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { create } from 'd3-selection';
|
|
2
|
-
import get from 'lodash/get';
|
|
3
|
-
import { getLabelsSize } from '../renderer/utils';
|
|
4
|
-
const MAX_FONT_SIZE = 64;
|
|
5
|
-
export function pieCenterText(text, options) {
|
|
6
|
-
if (!text) {
|
|
7
|
-
return undefined;
|
|
8
|
-
}
|
|
9
|
-
const padding = get(options, 'padding', 12);
|
|
10
|
-
return function (args) {
|
|
11
|
-
let fontSize = MAX_FONT_SIZE;
|
|
12
|
-
const textSize = getLabelsSize({ labels: [text], style: { fontSize: `${fontSize}px` } });
|
|
13
|
-
fontSize = (fontSize * (args.series.innerRadius - padding) * 2) / textSize.maxWidth;
|
|
14
|
-
const container = create('svg:g');
|
|
15
|
-
container
|
|
16
|
-
.append('text')
|
|
17
|
-
.text(text)
|
|
18
|
-
.attr('text-anchor', 'middle')
|
|
19
|
-
.attr('alignment-baseline', 'middle')
|
|
20
|
-
.style('font-size', `${fontSize}px`);
|
|
21
|
-
return container.node();
|
|
22
|
-
};
|
|
23
|
-
}
|
|
File without changes
|