@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,32 +0,0 @@
|
|
|
1
|
-
export const getBoundsWidth = (args) => {
|
|
2
|
-
const { chartWidth, chartMargin, preparedYAxis } = args;
|
|
3
|
-
return (chartWidth -
|
|
4
|
-
chartMargin.right -
|
|
5
|
-
chartMargin.left -
|
|
6
|
-
getWidthOccupiedByYAxis({ preparedAxis: preparedYAxis }));
|
|
7
|
-
};
|
|
8
|
-
export function getYAxisWidth(axis) {
|
|
9
|
-
let result = 0;
|
|
10
|
-
if (axis === null || axis === void 0 ? void 0 : axis.title.text) {
|
|
11
|
-
result += axis.title.height + axis.title.margin;
|
|
12
|
-
}
|
|
13
|
-
if (axis === null || axis === void 0 ? void 0 : axis.labels.enabled) {
|
|
14
|
-
result += axis.labels.margin + axis.labels.width;
|
|
15
|
-
}
|
|
16
|
-
return result;
|
|
17
|
-
}
|
|
18
|
-
export function getWidthOccupiedByYAxis(args) {
|
|
19
|
-
const { preparedAxis } = args;
|
|
20
|
-
let leftAxisWidth = 0;
|
|
21
|
-
let rightAxisWidth = 0;
|
|
22
|
-
preparedAxis === null || preparedAxis === void 0 ? void 0 : preparedAxis.forEach((axis) => {
|
|
23
|
-
const axisWidth = getYAxisWidth(axis);
|
|
24
|
-
if (axis.position === 'right') {
|
|
25
|
-
rightAxisWidth = Math.max(rightAxisWidth, axisWidth);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
leftAxisWidth = Math.max(leftAxisWidth, axisWidth);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
return leftAxisWidth + rightAxisWidth;
|
|
32
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ChartKitWidgetData } from '../../../../../types';
|
|
2
|
-
import type { PreparedChart, PreparedTitle } from './types';
|
|
3
|
-
export declare const getPreparedChart: (args: {
|
|
4
|
-
chart: ChartKitWidgetData['chart'];
|
|
5
|
-
preparedTitle?: PreparedTitle;
|
|
6
|
-
}) => PreparedChart;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import get from 'lodash/get';
|
|
2
|
-
const getMarginTop = (args) => {
|
|
3
|
-
const { chart, preparedTitle } = args;
|
|
4
|
-
let marginTop = get(chart, 'margin.top', 0);
|
|
5
|
-
if (preparedTitle === null || preparedTitle === void 0 ? void 0 : preparedTitle.height) {
|
|
6
|
-
marginTop += preparedTitle.height;
|
|
7
|
-
}
|
|
8
|
-
return marginTop;
|
|
9
|
-
};
|
|
10
|
-
const getMarginRight = (args) => {
|
|
11
|
-
const { chart } = args;
|
|
12
|
-
return get(chart, 'margin.right', 0);
|
|
13
|
-
};
|
|
14
|
-
export const getPreparedChart = (args) => {
|
|
15
|
-
const { chart, preparedTitle } = args;
|
|
16
|
-
const marginTop = getMarginTop({ chart, preparedTitle });
|
|
17
|
-
const marginBottom = get(chart, 'margin.bottom', 0);
|
|
18
|
-
const marginLeft = get(chart, 'margin.left', 0);
|
|
19
|
-
const marginRight = getMarginRight({ chart });
|
|
20
|
-
return {
|
|
21
|
-
margin: {
|
|
22
|
-
top: marginTop,
|
|
23
|
-
right: marginRight,
|
|
24
|
-
bottom: marginBottom,
|
|
25
|
-
left: marginLeft,
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { getPreparedChart } from './chart';
|
|
3
|
-
import { getPreparedTitle } from './title';
|
|
4
|
-
import { getPreparedTooltip } from './tooltip';
|
|
5
|
-
export const useChartOptions = (args) => {
|
|
6
|
-
const { data: { chart, title, tooltip }, } = args;
|
|
7
|
-
const options = React.useMemo(() => {
|
|
8
|
-
const preparedTitle = getPreparedTitle({ title });
|
|
9
|
-
const preparedTooltip = getPreparedTooltip({ tooltip });
|
|
10
|
-
const preparedChart = getPreparedChart({
|
|
11
|
-
chart,
|
|
12
|
-
preparedTitle,
|
|
13
|
-
});
|
|
14
|
-
return {
|
|
15
|
-
chart: preparedChart,
|
|
16
|
-
title: preparedTitle,
|
|
17
|
-
tooltip: preparedTooltip,
|
|
18
|
-
};
|
|
19
|
-
}, [chart, title, tooltip]);
|
|
20
|
-
return options;
|
|
21
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import get from 'lodash/get';
|
|
2
|
-
import { getHorisontalSvgTextHeight } from '../../utils';
|
|
3
|
-
const DEFAULT_TITLE_FONT_SIZE = '15px';
|
|
4
|
-
const TITLE_PADDINGS = 8 * 2;
|
|
5
|
-
export const getPreparedTitle = ({ title, }) => {
|
|
6
|
-
const titleText = get(title, 'text');
|
|
7
|
-
const titleStyle = {
|
|
8
|
-
fontSize: get(title, 'style.fontSize', DEFAULT_TITLE_FONT_SIZE),
|
|
9
|
-
fontWeight: get(title, 'style.fontWeight'),
|
|
10
|
-
};
|
|
11
|
-
const titleHeight = titleText
|
|
12
|
-
? getHorisontalSvgTextHeight({ text: titleText, style: titleStyle }) + TITLE_PADDINGS
|
|
13
|
-
: 0;
|
|
14
|
-
const preparedTitle = titleText
|
|
15
|
-
? { text: titleText, style: titleStyle, height: titleHeight }
|
|
16
|
-
: undefined;
|
|
17
|
-
return preparedTitle;
|
|
18
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { BaseTextStyle, ChartKitWidgetAxis, ChartKitWidgetAxisLabels, ChartKitWidgetAxisTitleAlignment, ChartKitWidgetAxisType, ChartKitWidgetData, ChartMargin } from '../../../../../types';
|
|
2
|
-
type PreparedAxisLabels = Omit<ChartKitWidgetAxisLabels, 'enabled' | 'padding' | 'style' | 'autoRotation'> & Required<Pick<ChartKitWidgetAxisLabels, 'enabled' | 'padding' | 'margin' | 'rotation'>> & {
|
|
3
|
-
style: BaseTextStyle;
|
|
4
|
-
rotation: number;
|
|
5
|
-
height: number;
|
|
6
|
-
width: number;
|
|
7
|
-
lineHeight: number;
|
|
8
|
-
maxWidth: number;
|
|
9
|
-
};
|
|
10
|
-
export type PreparedChart = {
|
|
11
|
-
margin: ChartMargin;
|
|
12
|
-
};
|
|
13
|
-
export type PreparedAxis = Omit<ChartKitWidgetAxis, 'type' | 'labels'> & {
|
|
14
|
-
type: ChartKitWidgetAxisType;
|
|
15
|
-
labels: PreparedAxisLabels;
|
|
16
|
-
title: {
|
|
17
|
-
height: number;
|
|
18
|
-
width: number;
|
|
19
|
-
text: string;
|
|
20
|
-
margin: number;
|
|
21
|
-
style: BaseTextStyle;
|
|
22
|
-
align: ChartKitWidgetAxisTitleAlignment;
|
|
23
|
-
maxRowCount: number;
|
|
24
|
-
};
|
|
25
|
-
min?: number;
|
|
26
|
-
grid: {
|
|
27
|
-
enabled: boolean;
|
|
28
|
-
};
|
|
29
|
-
maxPadding: number;
|
|
30
|
-
ticks: {
|
|
31
|
-
pixelInterval?: number;
|
|
32
|
-
};
|
|
33
|
-
position: 'left' | 'right' | 'top' | 'bottom';
|
|
34
|
-
plotIndex: number;
|
|
35
|
-
};
|
|
36
|
-
export type PreparedTitle = ChartKitWidgetData['title'] & {
|
|
37
|
-
height: number;
|
|
38
|
-
};
|
|
39
|
-
export type PreparedTooltip = ChartKitWidgetData['tooltip'] & {
|
|
40
|
-
enabled: boolean;
|
|
41
|
-
};
|
|
42
|
-
export type ChartOptions = {
|
|
43
|
-
chart: PreparedChart;
|
|
44
|
-
tooltip: PreparedTooltip;
|
|
45
|
-
title?: PreparedTitle;
|
|
46
|
-
};
|
|
47
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ChartKitWidgetSeries, ChartKitWidgetXAxis } from '../../../../../types';
|
|
2
|
-
import type { PreparedAxis } from './types';
|
|
3
|
-
export declare const getPreparedXAxis: ({ xAxis, series, width, }: {
|
|
4
|
-
xAxis?: import("../../../../../types").ChartKitWidgetAxis | undefined;
|
|
5
|
-
series: ChartKitWidgetSeries[];
|
|
6
|
-
width: number;
|
|
7
|
-
}) => PreparedAxis;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import get from 'lodash/get';
|
|
2
|
-
import { DEFAULT_AXIS_LABEL_FONT_SIZE, axisLabelsDefaults, xAxisTitleDefaults, } from '../../constants';
|
|
3
|
-
import { CHART_SERIES_WITH_VOLUME_ON_X_AXIS, calculateCos, formatAxisTickLabel, getClosestPointsRange, getHorisontalSvgTextHeight, getLabelsSize, getMaxTickCount, getTicksCount, getXAxisItems, hasOverlappingLabels, wrapText, } from '../../utils';
|
|
4
|
-
import { createXScale } from '../useAxisScales';
|
|
5
|
-
function getLabelSettings({ axis, series, width, autoRotation = true, }) {
|
|
6
|
-
const scale = createXScale(axis, series, width);
|
|
7
|
-
const tickCount = getTicksCount({ axis, range: width });
|
|
8
|
-
const ticks = getXAxisItems({
|
|
9
|
-
scale: scale,
|
|
10
|
-
count: tickCount,
|
|
11
|
-
maxCount: getMaxTickCount({ width, axis }),
|
|
12
|
-
});
|
|
13
|
-
const step = getClosestPointsRange(axis, ticks);
|
|
14
|
-
const labels = ticks.map((value) => {
|
|
15
|
-
return formatAxisTickLabel({
|
|
16
|
-
axis,
|
|
17
|
-
value,
|
|
18
|
-
step,
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
const overlapping = hasOverlappingLabels({
|
|
22
|
-
width,
|
|
23
|
-
labels,
|
|
24
|
-
padding: axis.labels.padding,
|
|
25
|
-
style: axis.labels.style,
|
|
26
|
-
});
|
|
27
|
-
const defaultRotation = overlapping && autoRotation ? -45 : 0;
|
|
28
|
-
const rotation = axis.labels.rotation || defaultRotation;
|
|
29
|
-
const labelsHeight = rotation
|
|
30
|
-
? getLabelsSize({
|
|
31
|
-
labels,
|
|
32
|
-
style: axis.labels.style,
|
|
33
|
-
rotation,
|
|
34
|
-
}).maxHeight
|
|
35
|
-
: axis.labels.lineHeight;
|
|
36
|
-
const maxHeight = rotation ? calculateCos(rotation) * axis.labels.maxWidth : labelsHeight;
|
|
37
|
-
return { height: Math.min(maxHeight, labelsHeight), rotation };
|
|
38
|
-
}
|
|
39
|
-
function getAxisMin(axis, series) {
|
|
40
|
-
const min = axis === null || axis === void 0 ? void 0 : axis.min;
|
|
41
|
-
if (typeof min === 'undefined' &&
|
|
42
|
-
(series === null || series === void 0 ? void 0 : series.some((s) => CHART_SERIES_WITH_VOLUME_ON_X_AXIS.includes(s.type)))) {
|
|
43
|
-
return series.reduce((minValue, s) => {
|
|
44
|
-
const minYValue = s.data.reduce((res, d) => Math.min(res, get(d, 'x', 0)), 0);
|
|
45
|
-
return Math.min(minValue, minYValue);
|
|
46
|
-
}, 0);
|
|
47
|
-
}
|
|
48
|
-
return min;
|
|
49
|
-
}
|
|
50
|
-
export const getPreparedXAxis = ({ xAxis, series, width, }) => {
|
|
51
|
-
var _a;
|
|
52
|
-
const titleText = get(xAxis, 'title.text', '');
|
|
53
|
-
const titleStyle = Object.assign(Object.assign({}, xAxisTitleDefaults.style), get(xAxis, 'title.style'));
|
|
54
|
-
const titleMaxRowsCount = get(xAxis, 'title.maxRowCount', xAxisTitleDefaults.maxRowCount);
|
|
55
|
-
const estimatedTitleRows = wrapText({
|
|
56
|
-
text: titleText,
|
|
57
|
-
style: titleStyle,
|
|
58
|
-
width,
|
|
59
|
-
}).slice(0, titleMaxRowsCount);
|
|
60
|
-
const titleSize = getLabelsSize({
|
|
61
|
-
labels: [titleText],
|
|
62
|
-
style: titleStyle,
|
|
63
|
-
});
|
|
64
|
-
const labelsStyle = {
|
|
65
|
-
fontSize: get(xAxis, 'labels.style.fontSize', DEFAULT_AXIS_LABEL_FONT_SIZE),
|
|
66
|
-
};
|
|
67
|
-
const preparedXAxis = {
|
|
68
|
-
type: get(xAxis, 'type', 'linear'),
|
|
69
|
-
labels: {
|
|
70
|
-
enabled: get(xAxis, 'labels.enabled', true),
|
|
71
|
-
margin: get(xAxis, 'labels.margin', axisLabelsDefaults.margin),
|
|
72
|
-
padding: get(xAxis, 'labels.padding', axisLabelsDefaults.padding),
|
|
73
|
-
dateFormat: get(xAxis, 'labels.dateFormat'),
|
|
74
|
-
numberFormat: get(xAxis, 'labels.numberFormat'),
|
|
75
|
-
rotation: get(xAxis, 'labels.rotation', 0),
|
|
76
|
-
style: labelsStyle,
|
|
77
|
-
width: 0,
|
|
78
|
-
height: 0,
|
|
79
|
-
lineHeight: getHorisontalSvgTextHeight({ text: 'Tmp', style: labelsStyle }),
|
|
80
|
-
maxWidth: get(xAxis, 'labels.maxWidth', axisLabelsDefaults.maxWidth),
|
|
81
|
-
},
|
|
82
|
-
lineColor: get(xAxis, 'lineColor'),
|
|
83
|
-
categories: get(xAxis, 'categories'),
|
|
84
|
-
timestamps: get(xAxis, 'timestamps'),
|
|
85
|
-
title: {
|
|
86
|
-
text: titleText,
|
|
87
|
-
style: titleStyle,
|
|
88
|
-
margin: get(xAxis, 'title.margin', xAxisTitleDefaults.margin),
|
|
89
|
-
height: titleSize.maxHeight * estimatedTitleRows.length,
|
|
90
|
-
width: titleSize.maxWidth,
|
|
91
|
-
align: get(xAxis, 'title.align', xAxisTitleDefaults.align),
|
|
92
|
-
maxRowCount: get(xAxis, 'title.maxRowCount', xAxisTitleDefaults.maxRowCount),
|
|
93
|
-
},
|
|
94
|
-
min: getAxisMin(xAxis, series),
|
|
95
|
-
maxPadding: get(xAxis, 'maxPadding', 0.01),
|
|
96
|
-
grid: {
|
|
97
|
-
enabled: get(xAxis, 'grid.enabled', true),
|
|
98
|
-
},
|
|
99
|
-
ticks: {
|
|
100
|
-
pixelInterval: get(xAxis, 'ticks.pixelInterval'),
|
|
101
|
-
},
|
|
102
|
-
position: 'bottom',
|
|
103
|
-
plotIndex: 0,
|
|
104
|
-
};
|
|
105
|
-
const { height, rotation } = getLabelSettings({
|
|
106
|
-
axis: preparedXAxis,
|
|
107
|
-
series,
|
|
108
|
-
width,
|
|
109
|
-
autoRotation: (_a = xAxis === null || xAxis === void 0 ? void 0 : xAxis.labels) === null || _a === void 0 ? void 0 : _a.autoRotation,
|
|
110
|
-
});
|
|
111
|
-
preparedXAxis.labels.height = height;
|
|
112
|
-
preparedXAxis.labels.rotation = rotation;
|
|
113
|
-
return preparedXAxis;
|
|
114
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ChartKitWidgetSeries, ChartKitWidgetYAxis } from '../../../../../types';
|
|
2
|
-
import type { PreparedAxis } from './types';
|
|
3
|
-
export declare const getPreparedYAxis: ({ series, yAxis, height, }: {
|
|
4
|
-
series: ChartKitWidgetSeries[];
|
|
5
|
-
yAxis: ChartKitWidgetYAxis[] | undefined;
|
|
6
|
-
height: number;
|
|
7
|
-
}) => PreparedAxis[];
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import get from 'lodash/get';
|
|
2
|
-
import { DEFAULT_AXIS_LABEL_FONT_SIZE, DEFAULT_AXIS_TYPE, axisLabelsDefaults, yAxisTitleDefaults, } from '../../constants';
|
|
3
|
-
import { CHART_SERIES_WITH_VOLUME_ON_Y_AXIS, formatAxisTickLabel, getClosestPointsRange, getHorisontalSvgTextHeight, getLabelsSize, getScaleTicks, getWaterfallPointSubtotal, wrapText, } from '../../utils';
|
|
4
|
-
import { createYScale } from '../useAxisScales';
|
|
5
|
-
const getAxisLabelMaxWidth = (args) => {
|
|
6
|
-
const { axis, series } = args;
|
|
7
|
-
if (!axis.labels.enabled) {
|
|
8
|
-
return 0;
|
|
9
|
-
}
|
|
10
|
-
const scale = createYScale(axis, series, 1);
|
|
11
|
-
const ticks = getScaleTicks(scale);
|
|
12
|
-
// FIXME: it is necessary to filter data, since we do not draw overlapping ticks
|
|
13
|
-
const step = getClosestPointsRange(axis, ticks);
|
|
14
|
-
const labels = ticks.map((tick) => formatAxisTickLabel({
|
|
15
|
-
axis,
|
|
16
|
-
value: tick,
|
|
17
|
-
step,
|
|
18
|
-
}));
|
|
19
|
-
return getLabelsSize({
|
|
20
|
-
labels,
|
|
21
|
-
style: axis.labels.style,
|
|
22
|
-
rotation: axis.labels.rotation,
|
|
23
|
-
}).maxWidth;
|
|
24
|
-
};
|
|
25
|
-
function getAxisMin(axis, series) {
|
|
26
|
-
const min = axis === null || axis === void 0 ? void 0 : axis.min;
|
|
27
|
-
if (typeof min === 'undefined' &&
|
|
28
|
-
(series === null || series === void 0 ? void 0 : series.some((s) => CHART_SERIES_WITH_VOLUME_ON_Y_AXIS.includes(s.type)))) {
|
|
29
|
-
return series.reduce((minValue, s) => {
|
|
30
|
-
switch (s.type) {
|
|
31
|
-
case 'waterfall': {
|
|
32
|
-
const minSubTotal = s.data.reduce((res, d) => Math.min(res, getWaterfallPointSubtotal(d, s) || 0), 0);
|
|
33
|
-
return Math.min(minValue, minSubTotal);
|
|
34
|
-
}
|
|
35
|
-
default: {
|
|
36
|
-
const minYValue = s.data.reduce((res, d) => Math.min(res, get(d, 'y', 0)), 0);
|
|
37
|
-
return Math.min(minValue, minYValue);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}, 0);
|
|
41
|
-
}
|
|
42
|
-
return min;
|
|
43
|
-
}
|
|
44
|
-
export const getPreparedYAxis = ({ series, yAxis, height, }) => {
|
|
45
|
-
const axisByPlot = [];
|
|
46
|
-
const axisItems = yAxis || [{}];
|
|
47
|
-
return axisItems.map((axisItem) => {
|
|
48
|
-
const plotIndex = get(axisItem, 'plotIndex', 0);
|
|
49
|
-
const firstPlotAxis = !axisByPlot[plotIndex];
|
|
50
|
-
if (firstPlotAxis) {
|
|
51
|
-
axisByPlot[plotIndex] = [];
|
|
52
|
-
}
|
|
53
|
-
axisByPlot[plotIndex].push(axisItem);
|
|
54
|
-
const defaultAxisPosition = firstPlotAxis ? 'left' : 'right';
|
|
55
|
-
const labelsEnabled = get(axisItem, 'labels.enabled', true);
|
|
56
|
-
const labelsStyle = {
|
|
57
|
-
fontSize: get(axisItem, 'labels.style.fontSize', DEFAULT_AXIS_LABEL_FONT_SIZE),
|
|
58
|
-
};
|
|
59
|
-
const titleText = get(axisItem, 'title.text', '');
|
|
60
|
-
const titleStyle = Object.assign(Object.assign({}, yAxisTitleDefaults.style), get(axisItem, 'title.style'));
|
|
61
|
-
const titleMaxRowsCount = get(axisItem, 'title.maxRowCount', yAxisTitleDefaults.maxRowCount);
|
|
62
|
-
const estimatedTitleRows = wrapText({
|
|
63
|
-
text: titleText,
|
|
64
|
-
style: titleStyle,
|
|
65
|
-
width: height,
|
|
66
|
-
}).slice(0, titleMaxRowsCount);
|
|
67
|
-
const titleSize = getLabelsSize({ labels: [titleText], style: titleStyle });
|
|
68
|
-
const axisType = get(axisItem, 'type', DEFAULT_AXIS_TYPE);
|
|
69
|
-
const preparedAxis = {
|
|
70
|
-
type: axisType,
|
|
71
|
-
labels: {
|
|
72
|
-
enabled: labelsEnabled,
|
|
73
|
-
margin: labelsEnabled
|
|
74
|
-
? get(axisItem, 'labels.margin', axisLabelsDefaults.margin)
|
|
75
|
-
: 0,
|
|
76
|
-
padding: labelsEnabled
|
|
77
|
-
? get(axisItem, 'labels.padding', axisLabelsDefaults.padding)
|
|
78
|
-
: 0,
|
|
79
|
-
dateFormat: get(axisItem, 'labels.dateFormat'),
|
|
80
|
-
numberFormat: get(axisItem, 'labels.numberFormat'),
|
|
81
|
-
style: labelsStyle,
|
|
82
|
-
rotation: get(axisItem, 'labels.rotation', 0),
|
|
83
|
-
width: 0,
|
|
84
|
-
height: 0,
|
|
85
|
-
lineHeight: getHorisontalSvgTextHeight({ text: 'TmpLabel', style: labelsStyle }),
|
|
86
|
-
maxWidth: get(axisItem, 'labels.maxWidth', axisLabelsDefaults.maxWidth),
|
|
87
|
-
},
|
|
88
|
-
lineColor: get(axisItem, 'lineColor'),
|
|
89
|
-
categories: get(axisItem, 'categories'),
|
|
90
|
-
timestamps: get(axisItem, 'timestamps'),
|
|
91
|
-
title: {
|
|
92
|
-
text: titleText,
|
|
93
|
-
margin: get(axisItem, 'title.margin', yAxisTitleDefaults.margin),
|
|
94
|
-
style: titleStyle,
|
|
95
|
-
width: titleSize.maxWidth,
|
|
96
|
-
height: titleSize.maxHeight * estimatedTitleRows.length,
|
|
97
|
-
align: get(axisItem, 'title.align', yAxisTitleDefaults.align),
|
|
98
|
-
maxRowCount: titleMaxRowsCount,
|
|
99
|
-
},
|
|
100
|
-
min: getAxisMin(axisItem, series),
|
|
101
|
-
maxPadding: get(axisItem, 'maxPadding', 0.05),
|
|
102
|
-
grid: {
|
|
103
|
-
enabled: get(axisItem, 'grid.enabled', firstPlotAxis),
|
|
104
|
-
},
|
|
105
|
-
ticks: {
|
|
106
|
-
pixelInterval: get(axisItem, 'ticks.pixelInterval'),
|
|
107
|
-
},
|
|
108
|
-
position: get(axisItem, 'position', defaultAxisPosition),
|
|
109
|
-
plotIndex: get(axisItem, 'plotIndex', 0),
|
|
110
|
-
};
|
|
111
|
-
if (labelsEnabled) {
|
|
112
|
-
preparedAxis.labels.width = getAxisLabelMaxWidth({ axis: preparedAxis, series });
|
|
113
|
-
}
|
|
114
|
-
return preparedAxis;
|
|
115
|
-
});
|
|
116
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { BaseTextStyle, Halo } from '../../../../../types';
|
|
2
|
-
import { PointMarkerOptions } from '../../../../../types/widget-data/marker';
|
|
3
|
-
export declare const DEFAULT_LEGEND_SYMBOL_SIZE = 8;
|
|
4
|
-
export declare const DEFAULT_LEGEND_SYMBOL_PADDING = 5;
|
|
5
|
-
export declare const DEFAULT_DATALABELS_PADDING = 5;
|
|
6
|
-
export declare const DEFAULT_DATALABELS_STYLE: BaseTextStyle;
|
|
7
|
-
export declare const DEFAULT_HALO_OPTIONS: Required<Halo>;
|
|
8
|
-
export declare const DEFAULT_POINT_MARKER_OPTIONS: Omit<Required<PointMarkerOptions>, 'enabled'>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export const DEFAULT_LEGEND_SYMBOL_SIZE = 8;
|
|
2
|
-
export const DEFAULT_LEGEND_SYMBOL_PADDING = 5;
|
|
3
|
-
export const DEFAULT_DATALABELS_PADDING = 5;
|
|
4
|
-
export const DEFAULT_DATALABELS_STYLE = {
|
|
5
|
-
fontSize: '11px',
|
|
6
|
-
fontWeight: 'bold',
|
|
7
|
-
fontColor: 'var(--d3-data-labels)',
|
|
8
|
-
};
|
|
9
|
-
export const DEFAULT_HALO_OPTIONS = {
|
|
10
|
-
enabled: true,
|
|
11
|
-
opacity: 0.25,
|
|
12
|
-
size: 6,
|
|
13
|
-
};
|
|
14
|
-
export const DEFAULT_POINT_MARKER_OPTIONS = {
|
|
15
|
-
radius: 4,
|
|
16
|
-
borderColor: '',
|
|
17
|
-
borderWidth: 0,
|
|
18
|
-
symbol: 'circle',
|
|
19
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { ChartKitWidgetData } from '../../../../../types';
|
|
2
|
-
import type { PreparedAxis, PreparedChart } from '../useChartOptions/types';
|
|
3
|
-
import type { OnLegendItemClick, PreparedSeries } from './types';
|
|
4
|
-
type Args = {
|
|
5
|
-
chartWidth: number;
|
|
6
|
-
chartHeight: number;
|
|
7
|
-
chartMargin: PreparedChart['margin'];
|
|
8
|
-
legend: ChartKitWidgetData['legend'];
|
|
9
|
-
series: ChartKitWidgetData['series'];
|
|
10
|
-
preparedYAxis: PreparedAxis[];
|
|
11
|
-
};
|
|
12
|
-
export declare const useSeries: (args: Args) => {
|
|
13
|
-
legendItems: import("./types").LegendItem[][];
|
|
14
|
-
legendConfig: {
|
|
15
|
-
offset: {
|
|
16
|
-
left: number;
|
|
17
|
-
top: number;
|
|
18
|
-
};
|
|
19
|
-
pagination: {
|
|
20
|
-
limit: number;
|
|
21
|
-
maxPage: number;
|
|
22
|
-
} | undefined;
|
|
23
|
-
};
|
|
24
|
-
preparedLegend: import("./types").PreparedLegend;
|
|
25
|
-
preparedSeries: PreparedSeries[];
|
|
26
|
-
preparedSeriesOptions: import("../../constants").SeriesOptionsDefaults;
|
|
27
|
-
handleLegendItemClick: OnLegendItemClick;
|
|
28
|
-
};
|
|
29
|
-
export {};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { group, scaleOrdinal } from 'd3';
|
|
3
|
-
import { DEFAULT_PALETTE } from '../../constants';
|
|
4
|
-
import { getSeriesNames } from '../../utils';
|
|
5
|
-
import { getLegendComponents, getPreparedLegend } from './prepare-legend';
|
|
6
|
-
import { getPreparedOptions } from './prepare-options';
|
|
7
|
-
import { prepareSeries } from './prepareSeries';
|
|
8
|
-
import { getActiveLegendItems, getAllLegendItems } from './utils';
|
|
9
|
-
export const useSeries = (args) => {
|
|
10
|
-
const { chartWidth, chartHeight, chartMargin, legend, preparedYAxis, series: { data: series, options: seriesOptions }, } = args;
|
|
11
|
-
const preparedLegend = React.useMemo(() => getPreparedLegend({ legend, series }), [legend, series]);
|
|
12
|
-
const preparedSeries = React.useMemo(() => {
|
|
13
|
-
const seriesNames = getSeriesNames(series);
|
|
14
|
-
const colorScale = scaleOrdinal(seriesNames, DEFAULT_PALETTE);
|
|
15
|
-
const groupedSeries = group(series, (item) => item.type);
|
|
16
|
-
return Array.from(groupedSeries).reduce((acc, [seriesType, seriesList]) => {
|
|
17
|
-
acc.push(...prepareSeries({
|
|
18
|
-
type: seriesType,
|
|
19
|
-
series: seriesList,
|
|
20
|
-
seriesOptions,
|
|
21
|
-
legend: preparedLegend,
|
|
22
|
-
colorScale,
|
|
23
|
-
}));
|
|
24
|
-
return acc;
|
|
25
|
-
}, []);
|
|
26
|
-
}, [series, seriesOptions, preparedLegend]);
|
|
27
|
-
const preparedSeriesOptions = React.useMemo(() => {
|
|
28
|
-
return getPreparedOptions(seriesOptions);
|
|
29
|
-
}, [seriesOptions]);
|
|
30
|
-
const [activeLegendItems, setActiveLegendItems] = React.useState(getActiveLegendItems(preparedSeries));
|
|
31
|
-
const chartSeries = React.useMemo(() => {
|
|
32
|
-
return preparedSeries.map((singleSeries) => {
|
|
33
|
-
if (singleSeries.legend.enabled) {
|
|
34
|
-
return Object.assign(Object.assign({}, singleSeries), { visible: activeLegendItems.includes(singleSeries.name) });
|
|
35
|
-
}
|
|
36
|
-
return singleSeries;
|
|
37
|
-
});
|
|
38
|
-
}, [preparedSeries, activeLegendItems]);
|
|
39
|
-
const { legendConfig, legendItems } = React.useMemo(() => {
|
|
40
|
-
return getLegendComponents({
|
|
41
|
-
chartHeight,
|
|
42
|
-
chartMargin,
|
|
43
|
-
chartWidth,
|
|
44
|
-
series: chartSeries,
|
|
45
|
-
preparedLegend,
|
|
46
|
-
preparedYAxis,
|
|
47
|
-
});
|
|
48
|
-
}, [chartWidth, chartHeight, chartMargin, chartSeries, preparedLegend, preparedYAxis]);
|
|
49
|
-
const handleLegendItemClick = React.useCallback(({ name, metaKey }) => {
|
|
50
|
-
const allItems = getAllLegendItems(preparedSeries);
|
|
51
|
-
const onlyItemSelected = activeLegendItems.length === 1 && activeLegendItems.includes(name);
|
|
52
|
-
let nextActiveLegendItems;
|
|
53
|
-
if (metaKey && activeLegendItems.includes(name)) {
|
|
54
|
-
nextActiveLegendItems = activeLegendItems.filter((item) => item !== name);
|
|
55
|
-
}
|
|
56
|
-
else if (metaKey && !activeLegendItems.includes(name)) {
|
|
57
|
-
nextActiveLegendItems = activeLegendItems.concat(name);
|
|
58
|
-
}
|
|
59
|
-
else if (onlyItemSelected && allItems.length === 1) {
|
|
60
|
-
nextActiveLegendItems = [];
|
|
61
|
-
}
|
|
62
|
-
else if (onlyItemSelected) {
|
|
63
|
-
nextActiveLegendItems = allItems;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
nextActiveLegendItems = [name];
|
|
67
|
-
}
|
|
68
|
-
setActiveLegendItems(nextActiveLegendItems);
|
|
69
|
-
}, [preparedSeries, activeLegendItems]);
|
|
70
|
-
// FIXME: remove effect. It initiates extra rerender
|
|
71
|
-
React.useEffect(() => {
|
|
72
|
-
setActiveLegendItems(getActiveLegendItems(preparedSeries));
|
|
73
|
-
}, [preparedSeries]);
|
|
74
|
-
return {
|
|
75
|
-
legendItems,
|
|
76
|
-
legendConfig,
|
|
77
|
-
preparedLegend,
|
|
78
|
-
preparedSeries: chartSeries,
|
|
79
|
-
preparedSeriesOptions,
|
|
80
|
-
handleLegendItemClick,
|
|
81
|
-
};
|
|
82
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ScaleOrdinal } from 'd3';
|
|
2
|
-
import { AreaSeries, ChartKitWidgetSeriesOptions } from '../../../../../types';
|
|
3
|
-
import { PreparedAreaSeries, PreparedLegend } from './types';
|
|
4
|
-
export declare const DEFAULT_LINE_WIDTH = 1;
|
|
5
|
-
export declare const DEFAULT_MARKER: {
|
|
6
|
-
enabled: boolean;
|
|
7
|
-
symbol: "circle" | "diamond" | "square" | "triangle" | "triangle-down";
|
|
8
|
-
borderColor: string;
|
|
9
|
-
borderWidth: number;
|
|
10
|
-
radius: number;
|
|
11
|
-
};
|
|
12
|
-
type PrepareAreaSeriesArgs = {
|
|
13
|
-
colorScale: ScaleOrdinal<string, string>;
|
|
14
|
-
series: AreaSeries[];
|
|
15
|
-
seriesOptions?: ChartKitWidgetSeriesOptions;
|
|
16
|
-
legend: PreparedLegend;
|
|
17
|
-
};
|
|
18
|
-
export declare function prepareArea(args: PrepareAreaSeriesArgs): PreparedAreaSeries[];
|
|
19
|
-
export {};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import get from 'lodash/get';
|
|
2
|
-
import merge from 'lodash/merge';
|
|
3
|
-
import { getRandomCKId } from '../../../../../utils';
|
|
4
|
-
import { DEFAULT_DATALABELS_PADDING, DEFAULT_DATALABELS_STYLE, DEFAULT_HALO_OPTIONS, DEFAULT_POINT_MARKER_OPTIONS, } from './constants';
|
|
5
|
-
import { getSeriesStackId, prepareLegendSymbol } from './utils';
|
|
6
|
-
export const DEFAULT_LINE_WIDTH = 1;
|
|
7
|
-
export const DEFAULT_MARKER = Object.assign(Object.assign({}, DEFAULT_POINT_MARKER_OPTIONS), { enabled: false });
|
|
8
|
-
function prepareMarker(series, seriesOptions) {
|
|
9
|
-
var _a;
|
|
10
|
-
const seriesHoverState = get(seriesOptions, 'area.states.hover');
|
|
11
|
-
const markerNormalState = Object.assign({}, DEFAULT_MARKER, (_a = seriesOptions === null || seriesOptions === void 0 ? void 0 : seriesOptions.area) === null || _a === void 0 ? void 0 : _a.marker, series.marker);
|
|
12
|
-
const hoveredMarkerDefaultOptions = {
|
|
13
|
-
enabled: true,
|
|
14
|
-
radius: markerNormalState.radius,
|
|
15
|
-
borderWidth: 1,
|
|
16
|
-
borderColor: '#ffffff',
|
|
17
|
-
halo: DEFAULT_HALO_OPTIONS,
|
|
18
|
-
};
|
|
19
|
-
return {
|
|
20
|
-
states: {
|
|
21
|
-
normal: markerNormalState,
|
|
22
|
-
hover: merge(hoveredMarkerDefaultOptions, seriesHoverState === null || seriesHoverState === void 0 ? void 0 : seriesHoverState.marker),
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export function prepareArea(args) {
|
|
27
|
-
const { colorScale, series: seriesList, seriesOptions, legend } = args;
|
|
28
|
-
const defaultAreaWidth = get(seriesOptions, 'area.lineWidth', DEFAULT_LINE_WIDTH);
|
|
29
|
-
const defaultOpacity = get(seriesOptions, 'area.opacity', 0.75);
|
|
30
|
-
return seriesList.map((series) => {
|
|
31
|
-
var _a, _b;
|
|
32
|
-
const id = getRandomCKId();
|
|
33
|
-
const name = series.name || '';
|
|
34
|
-
const color = series.color || colorScale(name);
|
|
35
|
-
const prepared = {
|
|
36
|
-
type: series.type,
|
|
37
|
-
color,
|
|
38
|
-
opacity: get(series, 'opacity', defaultOpacity),
|
|
39
|
-
lineWidth: get(series, 'lineWidth', defaultAreaWidth),
|
|
40
|
-
name,
|
|
41
|
-
id,
|
|
42
|
-
visible: get(series, 'visible', true),
|
|
43
|
-
legend: {
|
|
44
|
-
enabled: get(series, 'legend.enabled', legend.enabled),
|
|
45
|
-
symbol: prepareLegendSymbol(series),
|
|
46
|
-
},
|
|
47
|
-
data: series.data,
|
|
48
|
-
stacking: series.stacking,
|
|
49
|
-
stackId: getSeriesStackId(series),
|
|
50
|
-
dataLabels: {
|
|
51
|
-
enabled: ((_a = series.dataLabels) === null || _a === void 0 ? void 0 : _a.enabled) || false,
|
|
52
|
-
style: Object.assign({}, DEFAULT_DATALABELS_STYLE, (_b = series.dataLabels) === null || _b === void 0 ? void 0 : _b.style),
|
|
53
|
-
padding: get(series, 'dataLabels.padding', DEFAULT_DATALABELS_PADDING),
|
|
54
|
-
allowOverlap: get(series, 'dataLabels.allowOverlap', false),
|
|
55
|
-
html: get(series, 'dataLabels.html', false),
|
|
56
|
-
},
|
|
57
|
-
marker: prepareMarker(series, seriesOptions),
|
|
58
|
-
cursor: get(series, 'cursor', null),
|
|
59
|
-
yAxis: get(series, 'yAxis', 0),
|
|
60
|
-
};
|
|
61
|
-
return prepared;
|
|
62
|
-
}, []);
|
|
63
|
-
}
|