@gravity-ui/charts 0.1.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/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/cjs/components/Axis/AxisX.d.ts +20 -0
- package/dist/cjs/components/Axis/AxisX.js +108 -0
- package/dist/cjs/components/Axis/AxisY.d.ts +12 -0
- package/dist/cjs/components/Axis/AxisY.js +199 -0
- package/dist/cjs/components/Axis/index.d.ts +2 -0
- package/dist/cjs/components/Axis/index.js +2 -0
- package/dist/cjs/components/Axis/styles.css +17 -0
- package/dist/cjs/components/ChartInner/index.d.ts +10 -0
- package/dist/cjs/components/ChartInner/index.js +143 -0
- package/dist/cjs/components/ChartInner/styles.css +10 -0
- package/dist/cjs/components/Legend/index.d.ts +13 -0
- package/dist/cjs/components/Legend/index.js +278 -0
- package/dist/cjs/components/Legend/styles.css +47 -0
- package/dist/cjs/components/PlotTitle/index.d.ts +8 -0
- package/dist/cjs/components/PlotTitle/index.js +13 -0
- package/dist/cjs/components/PlotTitle/styles.css +5 -0
- package/dist/cjs/components/Title/index.d.ts +8 -0
- package/dist/cjs/components/Title/index.js +9 -0
- package/dist/cjs/components/Title/styles.css +5 -0
- package/dist/cjs/components/Tooltip/DefaultContent.d.ts +10 -0
- package/dist/cjs/components/Tooltip/DefaultContent.js +101 -0
- package/dist/cjs/components/Tooltip/index.d.ts +13 -0
- package/dist/cjs/components/Tooltip/index.js +29 -0
- package/dist/cjs/components/Tooltip/styles.css +29 -0
- package/dist/cjs/components/index.d.ts +18 -0
- package/dist/cjs/components/index.js +66 -0
- package/dist/cjs/constants/defaults/axis.d.ts +14 -0
- package/dist/cjs/constants/defaults/axis.js +18 -0
- package/dist/cjs/constants/defaults/index.d.ts +3 -0
- package/dist/cjs/constants/defaults/index.js +3 -0
- package/dist/cjs/constants/defaults/legend.d.ts +13 -0
- package/dist/cjs/constants/defaults/legend.js +12 -0
- package/dist/cjs/constants/defaults/series-options.d.ts +24 -0
- package/dist/cjs/constants/defaults/series-options.js +106 -0
- package/dist/cjs/constants/index.d.ts +46 -0
- package/dist/cjs/constants/index.js +71 -0
- package/dist/cjs/hooks/index.d.ts +10 -0
- package/dist/cjs/hooks/index.js +10 -0
- package/dist/cjs/hooks/useAxisScales/index.d.ts +25 -0
- package/dist/cjs/hooks/useAxisScales/index.js +183 -0
- package/dist/cjs/hooks/useChartDimensions/index.d.ts +16 -0
- package/dist/cjs/hooks/useChartDimensions/index.js +34 -0
- package/dist/cjs/hooks/useChartDimensions/utils.d.ts +10 -0
- package/dist/cjs/hooks/useChartDimensions/utils.js +32 -0
- package/dist/cjs/hooks/useChartOptions/chart.d.ts +6 -0
- package/dist/cjs/hooks/useChartOptions/chart.js +28 -0
- package/dist/cjs/hooks/useChartOptions/index.d.ts +7 -0
- package/dist/cjs/hooks/useChartOptions/index.js +21 -0
- package/dist/cjs/hooks/useChartOptions/title.d.ts +5 -0
- package/dist/cjs/hooks/useChartOptions/title.js +18 -0
- package/dist/cjs/hooks/useChartOptions/tooltip.d.ts +5 -0
- package/dist/cjs/hooks/useChartOptions/tooltip.js +5 -0
- package/dist/cjs/hooks/useChartOptions/types.d.ts +47 -0
- package/dist/cjs/hooks/useChartOptions/types.js +1 -0
- package/dist/cjs/hooks/useChartOptions/x-axis.d.ts +7 -0
- package/dist/cjs/hooks/useChartOptions/x-axis.js +115 -0
- package/dist/cjs/hooks/useChartOptions/y-axis.d.ts +7 -0
- package/dist/cjs/hooks/useChartOptions/y-axis.js +117 -0
- package/dist/cjs/hooks/useSeries/constants.d.ts +8 -0
- package/dist/cjs/hooks/useSeries/constants.js +19 -0
- package/dist/cjs/hooks/useSeries/index.d.ts +29 -0
- package/dist/cjs/hooks/useSeries/index.js +82 -0
- package/dist/cjs/hooks/useSeries/prepare-area.d.ts +19 -0
- package/dist/cjs/hooks/useSeries/prepare-area.js +63 -0
- package/dist/cjs/hooks/useSeries/prepare-bar-x.d.ts +10 -0
- package/dist/cjs/hooks/useSeries/prepare-bar-x.js +38 -0
- package/dist/cjs/hooks/useSeries/prepare-bar-y.d.ts +10 -0
- package/dist/cjs/hooks/useSeries/prepare-bar-y.js +48 -0
- package/dist/cjs/hooks/useSeries/prepare-legend.d.ts +27 -0
- package/dist/cjs/hooks/useSeries/prepare-legend.js +144 -0
- package/dist/cjs/hooks/useSeries/prepare-line.d.ts +22 -0
- package/dist/cjs/hooks/useSeries/prepare-line.js +82 -0
- package/dist/cjs/hooks/useSeries/prepare-options.d.ts +3 -0
- package/dist/cjs/hooks/useSeries/prepare-options.js +5 -0
- package/dist/cjs/hooks/useSeries/prepare-pie.d.ts +9 -0
- package/dist/cjs/hooks/useSeries/prepare-pie.js +62 -0
- package/dist/cjs/hooks/useSeries/prepare-scatter.d.ts +11 -0
- package/dist/cjs/hooks/useSeries/prepare-scatter.js +46 -0
- package/dist/cjs/hooks/useSeries/prepare-treemap.d.ts +11 -0
- package/dist/cjs/hooks/useSeries/prepare-treemap.js +38 -0
- package/dist/cjs/hooks/useSeries/prepare-waterfall.d.ts +10 -0
- package/dist/cjs/hooks/useSeries/prepare-waterfall.js +37 -0
- package/dist/cjs/hooks/useSeries/prepareSeries.d.ts +10 -0
- package/dist/cjs/hooks/useSeries/prepareSeries.js +65 -0
- package/dist/cjs/hooks/useSeries/types.d.ts +253 -0
- package/dist/cjs/hooks/useSeries/types.js +1 -0
- package/dist/cjs/hooks/useSeries/utils.d.ts +7 -0
- package/dist/cjs/hooks/useSeries/utils.js +33 -0
- package/dist/cjs/hooks/useShapes/HtmlLayer.d.ts +8 -0
- package/dist/cjs/hooks/useShapes/HtmlLayer.js +22 -0
- package/dist/cjs/hooks/useShapes/area/index.d.ts +12 -0
- package/dist/cjs/hooks/useShapes/area/index.js +143 -0
- package/dist/cjs/hooks/useShapes/area/prepare-data.d.ts +12 -0
- package/dist/cjs/hooks/useShapes/area/prepare-data.js +158 -0
- package/dist/cjs/hooks/useShapes/area/types.d.ts +27 -0
- package/dist/cjs/hooks/useShapes/area/types.js +1 -0
- package/dist/cjs/hooks/useShapes/bar-x/index.d.ts +13 -0
- package/dist/cjs/hooks/useShapes/bar-x/index.js +95 -0
- package/dist/cjs/hooks/useShapes/bar-x/prepare-data.d.ts +13 -0
- package/dist/cjs/hooks/useShapes/bar-x/prepare-data.js +160 -0
- package/dist/cjs/hooks/useShapes/bar-x/types.d.ts +12 -0
- package/dist/cjs/hooks/useShapes/bar-x/types.js +1 -0
- package/dist/cjs/hooks/useShapes/bar-y/index.d.ts +12 -0
- package/dist/cjs/hooks/useShapes/bar-y/index.js +84 -0
- package/dist/cjs/hooks/useShapes/bar-y/prepare-data.d.ts +12 -0
- package/dist/cjs/hooks/useShapes/bar-y/prepare-data.js +169 -0
- package/dist/cjs/hooks/useShapes/bar-y/types.d.ts +13 -0
- package/dist/cjs/hooks/useShapes/bar-y/types.js +1 -0
- package/dist/cjs/hooks/useShapes/constants.d.ts +3 -0
- package/dist/cjs/hooks/useShapes/constants.js +3 -0
- package/dist/cjs/hooks/useShapes/index.d.ts +33 -0
- package/dist/cjs/hooks/useShapes/index.js +154 -0
- package/dist/cjs/hooks/useShapes/line/index.d.ts +12 -0
- package/dist/cjs/hooks/useShapes/line/index.js +130 -0
- package/dist/cjs/hooks/useShapes/line/prepare-data.d.ts +13 -0
- package/dist/cjs/hooks/useShapes/line/prepare-data.js +91 -0
- package/dist/cjs/hooks/useShapes/line/types.d.ts +29 -0
- package/dist/cjs/hooks/useShapes/line/types.js +1 -0
- package/dist/cjs/hooks/useShapes/marker.d.ts +14 -0
- package/dist/cjs/hooks/useShapes/marker.js +75 -0
- package/dist/cjs/hooks/useShapes/pie/index.d.ts +13 -0
- package/dist/cjs/hooks/useShapes/pie/index.js +171 -0
- package/dist/cjs/hooks/useShapes/pie/prepare-data.d.ts +9 -0
- package/dist/cjs/hooks/useShapes/pie/prepare-data.js +186 -0
- package/dist/cjs/hooks/useShapes/pie/types.d.ts +41 -0
- package/dist/cjs/hooks/useShapes/pie/types.js +1 -0
- package/dist/cjs/hooks/useShapes/pie/utils.d.ts +4 -0
- package/dist/cjs/hooks/useShapes/pie/utils.js +15 -0
- package/dist/cjs/hooks/useShapes/scatter/index.d.ts +12 -0
- package/dist/cjs/hooks/useShapes/scatter/index.js +69 -0
- package/dist/cjs/hooks/useShapes/scatter/prepare-data.d.ts +11 -0
- package/dist/cjs/hooks/useShapes/scatter/prepare-data.js +31 -0
- package/dist/cjs/hooks/useShapes/scatter/types.d.ts +17 -0
- package/dist/cjs/hooks/useShapes/scatter/types.js +1 -0
- package/dist/cjs/hooks/useShapes/styles.css +35 -0
- package/dist/cjs/hooks/useShapes/treemap/index.d.ts +12 -0
- package/dist/cjs/hooks/useShapes/treemap/index.js +98 -0
- package/dist/cjs/hooks/useShapes/treemap/prepare-data.d.ts +7 -0
- package/dist/cjs/hooks/useShapes/treemap/prepare-data.js +114 -0
- package/dist/cjs/hooks/useShapes/treemap/types.d.ts +16 -0
- package/dist/cjs/hooks/useShapes/treemap/types.js +1 -0
- package/dist/cjs/hooks/useShapes/utils.d.ts +29 -0
- package/dist/cjs/hooks/useShapes/utils.js +53 -0
- package/dist/cjs/hooks/useShapes/waterfall/index.d.ts +13 -0
- package/dist/cjs/hooks/useShapes/waterfall/index.js +127 -0
- package/dist/cjs/hooks/useShapes/waterfall/prepare-data.d.ts +12 -0
- package/dist/cjs/hooks/useShapes/waterfall/prepare-data.js +133 -0
- package/dist/cjs/hooks/useShapes/waterfall/types.d.ts +14 -0
- package/dist/cjs/hooks/useShapes/waterfall/types.js +1 -0
- package/dist/cjs/hooks/useSplit/index.d.ts +14 -0
- package/dist/cjs/hooks/useSplit/index.js +57 -0
- package/dist/cjs/hooks/useSplit/types.d.ts +17 -0
- package/dist/cjs/hooks/useSplit/types.js +1 -0
- package/dist/cjs/hooks/useTooltip/index.d.ts +13 -0
- package/dist/cjs/hooks/useTooltip/index.js +17 -0
- package/dist/cjs/hooks/useTooltip/types.d.ts +1 -0
- package/dist/cjs/hooks/useTooltip/types.js +1 -0
- package/dist/cjs/i18n/index.d.ts +8 -0
- package/dist/cjs/i18n/index.js +10 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/libs/chart-error/index.d.ts +16 -0
- package/dist/cjs/libs/chart-error/index.js +19 -0
- package/dist/cjs/libs/format-number/i18n/en.json +17 -0
- package/dist/cjs/libs/format-number/i18n/i18n.d.ts +5 -0
- package/dist/cjs/libs/format-number/i18n/i18n.js +8 -0
- package/dist/cjs/libs/format-number/i18n/ru.json +17 -0
- package/dist/cjs/libs/format-number/index.d.ts +5 -0
- package/dist/cjs/libs/format-number/index.js +87 -0
- package/dist/cjs/libs/format-number/types.d.ts +14 -0
- package/dist/cjs/libs/format-number/types.js +1 -0
- package/dist/cjs/libs/index.d.ts +2 -0
- package/dist/cjs/libs/index.js +2 -0
- package/dist/cjs/types/chart/area.d.ts +76 -0
- package/dist/cjs/types/chart/area.js +1 -0
- package/dist/cjs/types/chart/axis.d.ts +85 -0
- package/dist/cjs/types/chart/axis.js +1 -0
- package/dist/cjs/types/chart/bar-x.d.ts +67 -0
- package/dist/cjs/types/chart/bar-x.js +1 -0
- package/dist/cjs/types/chart/bar-y.d.ts +60 -0
- package/dist/cjs/types/chart/bar-y.js +1 -0
- package/dist/cjs/types/chart/base.d.ts +48 -0
- package/dist/cjs/types/chart/base.js +1 -0
- package/dist/cjs/types/chart/chart.d.ts +15 -0
- package/dist/cjs/types/chart/chart.js +1 -0
- package/dist/cjs/types/chart/halo.d.ts +9 -0
- package/dist/cjs/types/chart/halo.js +1 -0
- package/dist/cjs/types/chart/legend.d.ts +92 -0
- package/dist/cjs/types/chart/legend.js +1 -0
- package/dist/cjs/types/chart/line.d.ts +57 -0
- package/dist/cjs/types/chart/line.js +1 -0
- package/dist/cjs/types/chart/marker.d.ts +12 -0
- package/dist/cjs/types/chart/marker.js +1 -0
- package/dist/cjs/types/chart/pie.d.ts +88 -0
- package/dist/cjs/types/chart/pie.js +1 -0
- package/dist/cjs/types/chart/scatter.d.ts +46 -0
- package/dist/cjs/types/chart/scatter.js +1 -0
- package/dist/cjs/types/chart/series.d.ts +226 -0
- package/dist/cjs/types/chart/series.js +1 -0
- package/dist/cjs/types/chart/split.d.ts +13 -0
- package/dist/cjs/types/chart/split.js +1 -0
- package/dist/cjs/types/chart/title.d.ts +5 -0
- package/dist/cjs/types/chart/title.js +1 -0
- package/dist/cjs/types/chart/tooltip.d.ts +67 -0
- package/dist/cjs/types/chart/tooltip.js +1 -0
- package/dist/cjs/types/chart/treemap.d.ts +46 -0
- package/dist/cjs/types/chart/treemap.js +1 -0
- package/dist/cjs/types/chart/waterfall.d.ts +40 -0
- package/dist/cjs/types/chart/waterfall.js +1 -0
- package/dist/cjs/types/chart-ui.d.ts +24 -0
- package/dist/cjs/types/chart-ui.js +1 -0
- package/dist/cjs/types/formatter.d.ts +14 -0
- package/dist/cjs/types/formatter.js +1 -0
- package/dist/cjs/types/index.d.ts +42 -0
- package/dist/cjs/types/index.js +19 -0
- package/dist/cjs/types/misc.d.ts +4 -0
- package/dist/cjs/types/misc.js +1 -0
- package/dist/cjs/utils/chart/axis-generators/bottom.d.ts +24 -0
- package/dist/cjs/utils/chart/axis-generators/bottom.js +126 -0
- package/dist/cjs/utils/chart/axis-generators/index.d.ts +1 -0
- package/dist/cjs/utils/chart/axis-generators/index.js +1 -0
- package/dist/cjs/utils/chart/axis.d.ts +31 -0
- package/dist/cjs/utils/chart/axis.js +71 -0
- package/dist/cjs/utils/chart/color.d.ts +10 -0
- package/dist/cjs/utils/chart/color.js +43 -0
- package/dist/cjs/utils/chart/get-closest-data.d.ts +15 -0
- package/dist/cjs/utils/chart/get-closest-data.js +172 -0
- package/dist/cjs/utils/chart/index.d.ts +78 -0
- package/dist/cjs/utils/chart/index.js +210 -0
- package/dist/cjs/utils/chart/labels.d.ts +6 -0
- package/dist/cjs/utils/chart/labels.js +44 -0
- package/dist/cjs/utils/chart/legend.d.ts +8 -0
- package/dist/cjs/utils/chart/legend.js +23 -0
- package/dist/cjs/utils/chart/math.d.ts +25 -0
- package/dist/cjs/utils/chart/math.js +51 -0
- package/dist/cjs/utils/chart/series/index.d.ts +1 -0
- package/dist/cjs/utils/chart/series/index.js +1 -0
- package/dist/cjs/utils/chart/series/waterfall.d.ts +4 -0
- package/dist/cjs/utils/chart/series/waterfall.js +25 -0
- package/dist/cjs/utils/chart/symbol.d.ts +3 -0
- package/dist/cjs/utils/chart/symbol.js +36 -0
- package/dist/cjs/utils/chart/text.d.ts +29 -0
- package/dist/cjs/utils/chart/text.js +139 -0
- package/dist/cjs/utils/chart/time.d.ts +3 -0
- package/dist/cjs/utils/chart/time.js +34 -0
- package/dist/cjs/utils/chart-ui/index.d.ts +4 -0
- package/dist/cjs/utils/chart-ui/index.js +4 -0
- package/dist/cjs/utils/chart-ui/pie-center-text.d.ts +7 -0
- package/dist/cjs/utils/chart-ui/pie-center-text.js +23 -0
- package/dist/cjs/utils/cn.d.ts +3 -0
- package/dist/cjs/utils/cn.js +4 -0
- package/dist/cjs/utils/d3-dispatcher.d.ts +1 -0
- package/dist/cjs/utils/d3-dispatcher.js +4 -0
- package/dist/cjs/utils/index.d.ts +5 -0
- package/dist/cjs/utils/index.js +5 -0
- package/dist/cjs/utils/misc.d.ts +2 -0
- package/dist/cjs/utils/misc.js +8 -0
- package/dist/cjs/validation/index.d.ts +2 -0
- package/dist/cjs/validation/index.js +220 -0
- package/dist/esm/components/Axis/AxisX.d.ts +20 -0
- package/dist/esm/components/Axis/AxisX.js +108 -0
- package/dist/esm/components/Axis/AxisY.d.ts +12 -0
- package/dist/esm/components/Axis/AxisY.js +199 -0
- package/dist/esm/components/Axis/index.d.ts +2 -0
- package/dist/esm/components/Axis/index.js +2 -0
- package/dist/esm/components/Axis/styles.css +17 -0
- package/dist/esm/components/ChartInner/index.d.ts +10 -0
- package/dist/esm/components/ChartInner/index.js +143 -0
- package/dist/esm/components/ChartInner/styles.css +10 -0
- package/dist/esm/components/Legend/index.d.ts +13 -0
- package/dist/esm/components/Legend/index.js +278 -0
- package/dist/esm/components/Legend/styles.css +47 -0
- package/dist/esm/components/PlotTitle/index.d.ts +8 -0
- package/dist/esm/components/PlotTitle/index.js +13 -0
- package/dist/esm/components/PlotTitle/styles.css +5 -0
- package/dist/esm/components/Title/index.d.ts +8 -0
- package/dist/esm/components/Title/index.js +9 -0
- package/dist/esm/components/Title/styles.css +5 -0
- package/dist/esm/components/Tooltip/DefaultContent.d.ts +10 -0
- package/dist/esm/components/Tooltip/DefaultContent.js +101 -0
- package/dist/esm/components/Tooltip/index.d.ts +13 -0
- package/dist/esm/components/Tooltip/index.js +29 -0
- package/dist/esm/components/Tooltip/styles.css +29 -0
- package/dist/esm/components/index.d.ts +18 -0
- package/dist/esm/components/index.js +66 -0
- package/dist/esm/constants/defaults/axis.d.ts +14 -0
- package/dist/esm/constants/defaults/axis.js +18 -0
- package/dist/esm/constants/defaults/index.d.ts +3 -0
- package/dist/esm/constants/defaults/index.js +3 -0
- package/dist/esm/constants/defaults/legend.d.ts +13 -0
- package/dist/esm/constants/defaults/legend.js +12 -0
- package/dist/esm/constants/defaults/series-options.d.ts +24 -0
- package/dist/esm/constants/defaults/series-options.js +106 -0
- package/dist/esm/constants/index.d.ts +46 -0
- package/dist/esm/constants/index.js +71 -0
- package/dist/esm/hooks/index.d.ts +10 -0
- package/dist/esm/hooks/index.js +10 -0
- package/dist/esm/hooks/useAxisScales/index.d.ts +25 -0
- package/dist/esm/hooks/useAxisScales/index.js +183 -0
- package/dist/esm/hooks/useChartDimensions/index.d.ts +16 -0
- package/dist/esm/hooks/useChartDimensions/index.js +34 -0
- package/dist/esm/hooks/useChartDimensions/utils.d.ts +10 -0
- package/dist/esm/hooks/useChartDimensions/utils.js +32 -0
- package/dist/esm/hooks/useChartOptions/chart.d.ts +6 -0
- package/dist/esm/hooks/useChartOptions/chart.js +28 -0
- package/dist/esm/hooks/useChartOptions/index.d.ts +7 -0
- package/dist/esm/hooks/useChartOptions/index.js +21 -0
- package/dist/esm/hooks/useChartOptions/title.d.ts +5 -0
- package/dist/esm/hooks/useChartOptions/title.js +18 -0
- package/dist/esm/hooks/useChartOptions/tooltip.d.ts +5 -0
- package/dist/esm/hooks/useChartOptions/tooltip.js +5 -0
- package/dist/esm/hooks/useChartOptions/types.d.ts +47 -0
- package/dist/esm/hooks/useChartOptions/types.js +1 -0
- package/dist/esm/hooks/useChartOptions/x-axis.d.ts +7 -0
- package/dist/esm/hooks/useChartOptions/x-axis.js +115 -0
- package/dist/esm/hooks/useChartOptions/y-axis.d.ts +7 -0
- package/dist/esm/hooks/useChartOptions/y-axis.js +117 -0
- package/dist/esm/hooks/useSeries/constants.d.ts +8 -0
- package/dist/esm/hooks/useSeries/constants.js +19 -0
- package/dist/esm/hooks/useSeries/index.d.ts +29 -0
- package/dist/esm/hooks/useSeries/index.js +82 -0
- package/dist/esm/hooks/useSeries/prepare-area.d.ts +19 -0
- package/dist/esm/hooks/useSeries/prepare-area.js +63 -0
- package/dist/esm/hooks/useSeries/prepare-bar-x.d.ts +10 -0
- package/dist/esm/hooks/useSeries/prepare-bar-x.js +38 -0
- package/dist/esm/hooks/useSeries/prepare-bar-y.d.ts +10 -0
- package/dist/esm/hooks/useSeries/prepare-bar-y.js +48 -0
- package/dist/esm/hooks/useSeries/prepare-legend.d.ts +27 -0
- package/dist/esm/hooks/useSeries/prepare-legend.js +144 -0
- package/dist/esm/hooks/useSeries/prepare-line.d.ts +22 -0
- package/dist/esm/hooks/useSeries/prepare-line.js +82 -0
- package/dist/esm/hooks/useSeries/prepare-options.d.ts +3 -0
- package/dist/esm/hooks/useSeries/prepare-options.js +5 -0
- package/dist/esm/hooks/useSeries/prepare-pie.d.ts +9 -0
- package/dist/esm/hooks/useSeries/prepare-pie.js +62 -0
- package/dist/esm/hooks/useSeries/prepare-scatter.d.ts +11 -0
- package/dist/esm/hooks/useSeries/prepare-scatter.js +46 -0
- package/dist/esm/hooks/useSeries/prepare-treemap.d.ts +11 -0
- package/dist/esm/hooks/useSeries/prepare-treemap.js +38 -0
- package/dist/esm/hooks/useSeries/prepare-waterfall.d.ts +10 -0
- package/dist/esm/hooks/useSeries/prepare-waterfall.js +37 -0
- package/dist/esm/hooks/useSeries/prepareSeries.d.ts +10 -0
- package/dist/esm/hooks/useSeries/prepareSeries.js +65 -0
- package/dist/esm/hooks/useSeries/types.d.ts +253 -0
- package/dist/esm/hooks/useSeries/types.js +1 -0
- package/dist/esm/hooks/useSeries/utils.d.ts +7 -0
- package/dist/esm/hooks/useSeries/utils.js +33 -0
- package/dist/esm/hooks/useShapes/HtmlLayer.d.ts +8 -0
- package/dist/esm/hooks/useShapes/HtmlLayer.js +22 -0
- package/dist/esm/hooks/useShapes/area/index.d.ts +12 -0
- package/dist/esm/hooks/useShapes/area/index.js +143 -0
- package/dist/esm/hooks/useShapes/area/prepare-data.d.ts +12 -0
- package/dist/esm/hooks/useShapes/area/prepare-data.js +158 -0
- package/dist/esm/hooks/useShapes/area/types.d.ts +27 -0
- package/dist/esm/hooks/useShapes/area/types.js +1 -0
- package/dist/esm/hooks/useShapes/bar-x/index.d.ts +13 -0
- package/dist/esm/hooks/useShapes/bar-x/index.js +95 -0
- package/dist/esm/hooks/useShapes/bar-x/prepare-data.d.ts +13 -0
- package/dist/esm/hooks/useShapes/bar-x/prepare-data.js +160 -0
- package/dist/esm/hooks/useShapes/bar-x/types.d.ts +12 -0
- package/dist/esm/hooks/useShapes/bar-x/types.js +1 -0
- package/dist/esm/hooks/useShapes/bar-y/index.d.ts +12 -0
- package/dist/esm/hooks/useShapes/bar-y/index.js +84 -0
- package/dist/esm/hooks/useShapes/bar-y/prepare-data.d.ts +12 -0
- package/dist/esm/hooks/useShapes/bar-y/prepare-data.js +169 -0
- package/dist/esm/hooks/useShapes/bar-y/types.d.ts +13 -0
- package/dist/esm/hooks/useShapes/bar-y/types.js +1 -0
- package/dist/esm/hooks/useShapes/constants.d.ts +3 -0
- package/dist/esm/hooks/useShapes/constants.js +3 -0
- package/dist/esm/hooks/useShapes/index.d.ts +33 -0
- package/dist/esm/hooks/useShapes/index.js +154 -0
- package/dist/esm/hooks/useShapes/line/index.d.ts +12 -0
- package/dist/esm/hooks/useShapes/line/index.js +130 -0
- package/dist/esm/hooks/useShapes/line/prepare-data.d.ts +13 -0
- package/dist/esm/hooks/useShapes/line/prepare-data.js +91 -0
- package/dist/esm/hooks/useShapes/line/types.d.ts +29 -0
- package/dist/esm/hooks/useShapes/line/types.js +1 -0
- package/dist/esm/hooks/useShapes/marker.d.ts +14 -0
- package/dist/esm/hooks/useShapes/marker.js +75 -0
- package/dist/esm/hooks/useShapes/pie/index.d.ts +13 -0
- package/dist/esm/hooks/useShapes/pie/index.js +171 -0
- package/dist/esm/hooks/useShapes/pie/prepare-data.d.ts +9 -0
- package/dist/esm/hooks/useShapes/pie/prepare-data.js +186 -0
- package/dist/esm/hooks/useShapes/pie/types.d.ts +41 -0
- package/dist/esm/hooks/useShapes/pie/types.js +1 -0
- package/dist/esm/hooks/useShapes/pie/utils.d.ts +4 -0
- package/dist/esm/hooks/useShapes/pie/utils.js +15 -0
- package/dist/esm/hooks/useShapes/scatter/index.d.ts +12 -0
- package/dist/esm/hooks/useShapes/scatter/index.js +69 -0
- package/dist/esm/hooks/useShapes/scatter/prepare-data.d.ts +11 -0
- package/dist/esm/hooks/useShapes/scatter/prepare-data.js +31 -0
- package/dist/esm/hooks/useShapes/scatter/types.d.ts +17 -0
- package/dist/esm/hooks/useShapes/scatter/types.js +1 -0
- package/dist/esm/hooks/useShapes/styles.css +35 -0
- package/dist/esm/hooks/useShapes/treemap/index.d.ts +12 -0
- package/dist/esm/hooks/useShapes/treemap/index.js +98 -0
- package/dist/esm/hooks/useShapes/treemap/prepare-data.d.ts +7 -0
- package/dist/esm/hooks/useShapes/treemap/prepare-data.js +114 -0
- package/dist/esm/hooks/useShapes/treemap/types.d.ts +16 -0
- package/dist/esm/hooks/useShapes/treemap/types.js +1 -0
- package/dist/esm/hooks/useShapes/utils.d.ts +29 -0
- package/dist/esm/hooks/useShapes/utils.js +53 -0
- package/dist/esm/hooks/useShapes/waterfall/index.d.ts +13 -0
- package/dist/esm/hooks/useShapes/waterfall/index.js +127 -0
- package/dist/esm/hooks/useShapes/waterfall/prepare-data.d.ts +12 -0
- package/dist/esm/hooks/useShapes/waterfall/prepare-data.js +133 -0
- package/dist/esm/hooks/useShapes/waterfall/types.d.ts +14 -0
- package/dist/esm/hooks/useShapes/waterfall/types.js +1 -0
- package/dist/esm/hooks/useSplit/index.d.ts +14 -0
- package/dist/esm/hooks/useSplit/index.js +57 -0
- package/dist/esm/hooks/useSplit/types.d.ts +17 -0
- package/dist/esm/hooks/useSplit/types.js +1 -0
- package/dist/esm/hooks/useTooltip/index.d.ts +13 -0
- package/dist/esm/hooks/useTooltip/index.js +17 -0
- package/dist/esm/hooks/useTooltip/types.d.ts +1 -0
- package/dist/esm/hooks/useTooltip/types.js +1 -0
- package/dist/esm/i18n/index.d.ts +8 -0
- package/dist/esm/i18n/index.js +10 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/libs/chart-error/index.d.ts +16 -0
- package/dist/esm/libs/chart-error/index.js +19 -0
- package/dist/esm/libs/format-number/i18n/en.json +17 -0
- package/dist/esm/libs/format-number/i18n/i18n.d.ts +5 -0
- package/dist/esm/libs/format-number/i18n/i18n.js +8 -0
- package/dist/esm/libs/format-number/i18n/ru.json +17 -0
- package/dist/esm/libs/format-number/index.d.ts +5 -0
- package/dist/esm/libs/format-number/index.js +87 -0
- package/dist/esm/libs/format-number/types.d.ts +14 -0
- package/dist/esm/libs/format-number/types.js +1 -0
- package/dist/esm/libs/index.d.ts +2 -0
- package/dist/esm/libs/index.js +2 -0
- package/dist/esm/types/chart/area.d.ts +76 -0
- package/dist/esm/types/chart/area.js +1 -0
- package/dist/esm/types/chart/axis.d.ts +85 -0
- package/dist/esm/types/chart/axis.js +1 -0
- package/dist/esm/types/chart/bar-x.d.ts +67 -0
- package/dist/esm/types/chart/bar-x.js +1 -0
- package/dist/esm/types/chart/bar-y.d.ts +60 -0
- package/dist/esm/types/chart/bar-y.js +1 -0
- package/dist/esm/types/chart/base.d.ts +48 -0
- package/dist/esm/types/chart/base.js +1 -0
- package/dist/esm/types/chart/chart.d.ts +15 -0
- package/dist/esm/types/chart/chart.js +1 -0
- package/dist/esm/types/chart/halo.d.ts +9 -0
- package/dist/esm/types/chart/halo.js +1 -0
- package/dist/esm/types/chart/legend.d.ts +92 -0
- package/dist/esm/types/chart/legend.js +1 -0
- package/dist/esm/types/chart/line.d.ts +57 -0
- package/dist/esm/types/chart/line.js +1 -0
- package/dist/esm/types/chart/marker.d.ts +12 -0
- package/dist/esm/types/chart/marker.js +1 -0
- package/dist/esm/types/chart/pie.d.ts +88 -0
- package/dist/esm/types/chart/pie.js +1 -0
- package/dist/esm/types/chart/scatter.d.ts +46 -0
- package/dist/esm/types/chart/scatter.js +1 -0
- package/dist/esm/types/chart/series.d.ts +226 -0
- package/dist/esm/types/chart/series.js +1 -0
- package/dist/esm/types/chart/split.d.ts +13 -0
- package/dist/esm/types/chart/split.js +1 -0
- package/dist/esm/types/chart/title.d.ts +5 -0
- package/dist/esm/types/chart/title.js +1 -0
- package/dist/esm/types/chart/tooltip.d.ts +67 -0
- package/dist/esm/types/chart/tooltip.js +1 -0
- package/dist/esm/types/chart/treemap.d.ts +46 -0
- package/dist/esm/types/chart/treemap.js +1 -0
- package/dist/esm/types/chart/waterfall.d.ts +40 -0
- package/dist/esm/types/chart/waterfall.js +1 -0
- package/dist/esm/types/chart-ui.d.ts +24 -0
- package/dist/esm/types/chart-ui.js +1 -0
- package/dist/esm/types/formatter.d.ts +14 -0
- package/dist/esm/types/formatter.js +1 -0
- package/dist/esm/types/index.d.ts +42 -0
- package/dist/esm/types/index.js +19 -0
- package/dist/esm/types/misc.d.ts +4 -0
- package/dist/esm/types/misc.js +1 -0
- package/dist/esm/utils/chart/axis-generators/bottom.d.ts +24 -0
- package/dist/esm/utils/chart/axis-generators/bottom.js +126 -0
- package/dist/esm/utils/chart/axis-generators/index.d.ts +1 -0
- package/dist/esm/utils/chart/axis-generators/index.js +1 -0
- package/dist/esm/utils/chart/axis.d.ts +31 -0
- package/dist/esm/utils/chart/axis.js +71 -0
- package/dist/esm/utils/chart/color.d.ts +10 -0
- package/dist/esm/utils/chart/color.js +43 -0
- package/dist/esm/utils/chart/get-closest-data.d.ts +15 -0
- package/dist/esm/utils/chart/get-closest-data.js +172 -0
- package/dist/esm/utils/chart/index.d.ts +78 -0
- package/dist/esm/utils/chart/index.js +210 -0
- package/dist/esm/utils/chart/labels.d.ts +6 -0
- package/dist/esm/utils/chart/labels.js +44 -0
- package/dist/esm/utils/chart/legend.d.ts +8 -0
- package/dist/esm/utils/chart/legend.js +23 -0
- package/dist/esm/utils/chart/math.d.ts +25 -0
- package/dist/esm/utils/chart/math.js +51 -0
- package/dist/esm/utils/chart/series/index.d.ts +1 -0
- package/dist/esm/utils/chart/series/index.js +1 -0
- package/dist/esm/utils/chart/series/waterfall.d.ts +4 -0
- package/dist/esm/utils/chart/series/waterfall.js +25 -0
- package/dist/esm/utils/chart/symbol.d.ts +3 -0
- package/dist/esm/utils/chart/symbol.js +36 -0
- package/dist/esm/utils/chart/text.d.ts +29 -0
- package/dist/esm/utils/chart/text.js +139 -0
- package/dist/esm/utils/chart/time.d.ts +3 -0
- package/dist/esm/utils/chart/time.js +34 -0
- package/dist/esm/utils/chart-ui/index.d.ts +4 -0
- package/dist/esm/utils/chart-ui/index.js +4 -0
- package/dist/esm/utils/chart-ui/pie-center-text.d.ts +7 -0
- package/dist/esm/utils/chart-ui/pie-center-text.js +23 -0
- package/dist/esm/utils/cn.d.ts +3 -0
- package/dist/esm/utils/cn.js +4 -0
- package/dist/esm/utils/d3-dispatcher.d.ts +1 -0
- package/dist/esm/utils/d3-dispatcher.js +4 -0
- package/dist/esm/utils/index.d.ts +5 -0
- package/dist/esm/utils/index.js +5 -0
- package/dist/esm/utils/misc.d.ts +2 -0
- package/dist/esm/utils/misc.js +8 -0
- package/dist/esm/validation/index.d.ts +2 -0
- package/dist/esm/validation/index.js +220 -0
- package/package.json +140 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { color, select } from 'd3';
|
|
3
|
+
import get from 'lodash/get';
|
|
4
|
+
import { block, setEllipsisForOverflowTexts } from '../../../utils';
|
|
5
|
+
import { HtmlLayer } from '../HtmlLayer';
|
|
6
|
+
const b = block('d3-treemap');
|
|
7
|
+
export const TreemapSeriesShape = (props) => {
|
|
8
|
+
const { dispatcher, preparedData, seriesOptions, htmlLayout } = props;
|
|
9
|
+
const ref = React.useRef(null);
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
if (!ref.current) {
|
|
12
|
+
return () => { };
|
|
13
|
+
}
|
|
14
|
+
const svgElement = select(ref.current);
|
|
15
|
+
svgElement.selectAll('*').remove();
|
|
16
|
+
const { labelData, leaves, series } = preparedData;
|
|
17
|
+
const leaf = svgElement
|
|
18
|
+
.selectAll('g')
|
|
19
|
+
.data(leaves)
|
|
20
|
+
.join('g')
|
|
21
|
+
.attr('transform', (d) => `translate(${d.x0},${d.y0})`)
|
|
22
|
+
.attr('cursor', series.cursor);
|
|
23
|
+
const rectSelection = leaf
|
|
24
|
+
.append('rect')
|
|
25
|
+
.attr('id', (d) => d.id || d.name)
|
|
26
|
+
.attr('fill', (d) => {
|
|
27
|
+
var _a;
|
|
28
|
+
if (d.data.color) {
|
|
29
|
+
return d.data.color;
|
|
30
|
+
}
|
|
31
|
+
const levelOptions = (_a = series.levels) === null || _a === void 0 ? void 0 : _a.find((l) => l.index === d.depth);
|
|
32
|
+
return (levelOptions === null || levelOptions === void 0 ? void 0 : levelOptions.color) || series.color;
|
|
33
|
+
})
|
|
34
|
+
.attr('width', (d) => d.x1 - d.x0)
|
|
35
|
+
.attr('height', (d) => d.y1 - d.y0);
|
|
36
|
+
const labelSelection = svgElement
|
|
37
|
+
.selectAll('tspan')
|
|
38
|
+
.data(labelData)
|
|
39
|
+
.join('text')
|
|
40
|
+
.text((d) => d.text)
|
|
41
|
+
.attr('class', b('label'))
|
|
42
|
+
.attr('x', (d) => d.x)
|
|
43
|
+
.attr('y', (d) => d.y)
|
|
44
|
+
.style('font-size', () => series.dataLabels.style.fontSize)
|
|
45
|
+
.style('font-weight', () => { var _a; return ((_a = series.dataLabels.style) === null || _a === void 0 ? void 0 : _a.fontWeight) || null; })
|
|
46
|
+
.style('fill', () => { var _a; return ((_a = series.dataLabels.style) === null || _a === void 0 ? void 0 : _a.fontColor) || null; })
|
|
47
|
+
.call(setEllipsisForOverflowTexts, (d) => d.width);
|
|
48
|
+
const eventName = `hover-shape.treemap`;
|
|
49
|
+
const hoverOptions = get(seriesOptions, 'treemap.states.hover');
|
|
50
|
+
const inactiveOptions = get(seriesOptions, 'treemap.states.inactive');
|
|
51
|
+
dispatcher.on(eventName, (data) => {
|
|
52
|
+
var _a;
|
|
53
|
+
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
54
|
+
const inactiveEnabled = inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled;
|
|
55
|
+
const hoveredData = (_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.data;
|
|
56
|
+
rectSelection.datum((d, index, list) => {
|
|
57
|
+
const currentRect = select(list[index]);
|
|
58
|
+
const hovered = Boolean(hoverEnabled && hoveredData === d.data);
|
|
59
|
+
const inactive = Boolean(inactiveEnabled && hoveredData && !hovered);
|
|
60
|
+
currentRect
|
|
61
|
+
.attr('fill', (currentD) => {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
const levelOptions = (_a = series.levels) === null || _a === void 0 ? void 0 : _a.find((l) => l.index === currentD.depth);
|
|
64
|
+
const initialColor = (levelOptions === null || levelOptions === void 0 ? void 0 : levelOptions.color) || d.data.color || series.color;
|
|
65
|
+
if (hovered) {
|
|
66
|
+
return (((_b = color(initialColor)) === null || _b === void 0 ? void 0 : _b.brighter(hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.brightness).toString()) || initialColor);
|
|
67
|
+
}
|
|
68
|
+
return initialColor;
|
|
69
|
+
})
|
|
70
|
+
.attr('opacity', () => {
|
|
71
|
+
if (inactive) {
|
|
72
|
+
return (inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.opacity) || null;
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
});
|
|
76
|
+
return d;
|
|
77
|
+
});
|
|
78
|
+
labelSelection.datum((d, index, list) => {
|
|
79
|
+
const currentLabel = select(list[index]);
|
|
80
|
+
const hovered = Boolean(hoverEnabled && hoveredData === d.nodeData);
|
|
81
|
+
const inactive = Boolean(inactiveEnabled && hoveredData && !hovered);
|
|
82
|
+
currentLabel.attr('opacity', () => {
|
|
83
|
+
if (inactive) {
|
|
84
|
+
return (inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.opacity) || null;
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
});
|
|
88
|
+
return d;
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
return () => {
|
|
92
|
+
dispatcher.on(eventName, null);
|
|
93
|
+
};
|
|
94
|
+
}, [dispatcher, preparedData, seriesOptions]);
|
|
95
|
+
return (React.createElement(React.Fragment, null,
|
|
96
|
+
React.createElement("g", { ref: ref, className: b() }),
|
|
97
|
+
React.createElement(HtmlLayer, { preparedData: preparedData, htmlLayout: htmlLayout })));
|
|
98
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PreparedTreemapSeries } from '../../useSeries/types';
|
|
2
|
+
import type { PreparedTreemapData } from './types';
|
|
3
|
+
export declare function prepareTreemapData(args: {
|
|
4
|
+
series: PreparedTreemapSeries;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}): PreparedTreemapData;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { stratify, treemap, treemapBinary, treemapDice, treemapSlice, treemapSliceDice, treemapSquarify, } from 'd3';
|
|
2
|
+
import { LayoutAlgorithm } from '../../../constants';
|
|
3
|
+
import { getLabelsSize } from '../../../utils';
|
|
4
|
+
const DEFAULT_PADDING = 1;
|
|
5
|
+
function getLabels(args) {
|
|
6
|
+
const { data, html, padding, align } = args;
|
|
7
|
+
return data.reduce((acc, d) => {
|
|
8
|
+
const texts = Array.isArray(d.data.name) ? d.data.name : [d.data.name];
|
|
9
|
+
texts.forEach((text, index) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const { maxHeight: lineHeight, maxWidth: labelWidth } = (_a = getLabelsSize({ labels: [text], html })) !== null && _a !== void 0 ? _a : {};
|
|
12
|
+
const left = d.x0 + padding;
|
|
13
|
+
const right = d.x1 - padding;
|
|
14
|
+
const width = Math.max(0, right - left);
|
|
15
|
+
let x = left;
|
|
16
|
+
const y = index * lineHeight + d.y0 + padding;
|
|
17
|
+
switch (align) {
|
|
18
|
+
case 'left': {
|
|
19
|
+
x = left;
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
case 'center': {
|
|
23
|
+
x = Math.max(left, left + (width - labelWidth) / 2);
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
case 'right': {
|
|
27
|
+
x = Math.max(left, right - labelWidth);
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const item = html
|
|
32
|
+
? {
|
|
33
|
+
content: text,
|
|
34
|
+
x,
|
|
35
|
+
y,
|
|
36
|
+
}
|
|
37
|
+
: {
|
|
38
|
+
text,
|
|
39
|
+
x,
|
|
40
|
+
y,
|
|
41
|
+
width,
|
|
42
|
+
nodeData: d.data,
|
|
43
|
+
};
|
|
44
|
+
acc.push(item);
|
|
45
|
+
});
|
|
46
|
+
return acc;
|
|
47
|
+
}, []);
|
|
48
|
+
}
|
|
49
|
+
export function prepareTreemapData(args) {
|
|
50
|
+
var _a;
|
|
51
|
+
const { series, width, height } = args;
|
|
52
|
+
const dataWithRootNode = getSeriesDataWithRootNode(series);
|
|
53
|
+
const hierarchy = stratify()
|
|
54
|
+
.id((d) => {
|
|
55
|
+
if (d.id) {
|
|
56
|
+
return d.id;
|
|
57
|
+
}
|
|
58
|
+
return Array.isArray(d.name) ? d.name.join() : d.name;
|
|
59
|
+
})
|
|
60
|
+
.parentId((d) => d.parentId)(dataWithRootNode)
|
|
61
|
+
.sum((d) => d.value || 0);
|
|
62
|
+
const treemapInstance = treemap();
|
|
63
|
+
switch (series.layoutAlgorithm) {
|
|
64
|
+
case LayoutAlgorithm.Binary: {
|
|
65
|
+
treemapInstance.tile(treemapBinary);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
case LayoutAlgorithm.Dice: {
|
|
69
|
+
treemapInstance.tile(treemapDice);
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
case LayoutAlgorithm.Slice: {
|
|
73
|
+
treemapInstance.tile(treemapSlice);
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
case LayoutAlgorithm.SliceDice: {
|
|
77
|
+
treemapInstance.tile(treemapSliceDice);
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
case LayoutAlgorithm.Squarify: {
|
|
81
|
+
treemapInstance.tile(treemapSquarify);
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const root = treemapInstance.size([width, height]).paddingInner((d) => {
|
|
86
|
+
var _a, _b;
|
|
87
|
+
const levelOptions = (_a = series.levels) === null || _a === void 0 ? void 0 : _a.find((l) => l.index === d.depth + 1);
|
|
88
|
+
return (_b = levelOptions === null || levelOptions === void 0 ? void 0 : levelOptions.padding) !== null && _b !== void 0 ? _b : DEFAULT_PADDING;
|
|
89
|
+
})(hierarchy);
|
|
90
|
+
const leaves = root.leaves();
|
|
91
|
+
let labelData = [];
|
|
92
|
+
const htmlElements = [];
|
|
93
|
+
if ((_a = series.dataLabels) === null || _a === void 0 ? void 0 : _a.enabled) {
|
|
94
|
+
const { html, padding, align } = series.dataLabels;
|
|
95
|
+
const labels = getLabels({ html, padding, align, data: leaves });
|
|
96
|
+
if (html) {
|
|
97
|
+
htmlElements.push(...labels);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
labelData = labels;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return { labelData, leaves, series, htmlElements };
|
|
104
|
+
}
|
|
105
|
+
function getSeriesDataWithRootNode(series) {
|
|
106
|
+
return series.data.reduce((acc, d) => {
|
|
107
|
+
const dataChunk = Object.assign({}, d);
|
|
108
|
+
if (!dataChunk.parentId) {
|
|
109
|
+
dataChunk.parentId = series.id;
|
|
110
|
+
}
|
|
111
|
+
acc.push(dataChunk);
|
|
112
|
+
return acc;
|
|
113
|
+
}, [{ name: series.name, id: series.id }]);
|
|
114
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { HierarchyRectangularNode } from 'd3';
|
|
2
|
+
import type { HtmlItem, TreemapSeriesData } from '../../../types';
|
|
3
|
+
import type { PreparedTreemapSeries } from '../../useSeries/types';
|
|
4
|
+
export type TreemapLabelData = {
|
|
5
|
+
text: string;
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
nodeData: TreemapSeriesData;
|
|
10
|
+
};
|
|
11
|
+
export type PreparedTreemapData = {
|
|
12
|
+
labelData: TreemapLabelData[];
|
|
13
|
+
leaves: HierarchyRectangularNode<TreemapSeriesData<any>>[];
|
|
14
|
+
series: PreparedTreemapSeries;
|
|
15
|
+
htmlElements: HtmlItem[];
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { BaseType } from 'd3';
|
|
2
|
+
import type { DashStyle } from '../../constants';
|
|
3
|
+
import type { BasicInactiveState } from '../../types';
|
|
4
|
+
import type { ChartScale } from '../useAxisScales';
|
|
5
|
+
import type { PreparedAxis } from '../useChartOptions/types';
|
|
6
|
+
export declare function getXValue(args: {
|
|
7
|
+
point: {
|
|
8
|
+
x?: number | string;
|
|
9
|
+
};
|
|
10
|
+
xAxis: PreparedAxis;
|
|
11
|
+
xScale: ChartScale;
|
|
12
|
+
}): number;
|
|
13
|
+
export declare function getYValue(args: {
|
|
14
|
+
point: {
|
|
15
|
+
y?: number | string;
|
|
16
|
+
};
|
|
17
|
+
yAxis: PreparedAxis;
|
|
18
|
+
yScale: ChartScale;
|
|
19
|
+
}): number;
|
|
20
|
+
export declare const shapeKey: (d: unknown) => string | -1;
|
|
21
|
+
export declare function setActiveState<T extends {
|
|
22
|
+
active?: boolean;
|
|
23
|
+
}>(args: {
|
|
24
|
+
element: BaseType;
|
|
25
|
+
datum: T;
|
|
26
|
+
state: BasicInactiveState | undefined;
|
|
27
|
+
active: boolean;
|
|
28
|
+
}): T;
|
|
29
|
+
export declare const getLineDashArray: (dashStyle: DashStyle, strokeWidth?: number) => string;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { select } from 'd3';
|
|
2
|
+
import get from 'lodash/get';
|
|
3
|
+
import { getDataCategoryValue } from '../../utils';
|
|
4
|
+
export function getXValue(args) {
|
|
5
|
+
const { point, xAxis, xScale } = args;
|
|
6
|
+
if (xAxis.type === 'category') {
|
|
7
|
+
const xBandScale = xScale;
|
|
8
|
+
const categories = get(xAxis, 'categories', []);
|
|
9
|
+
const dataCategory = getDataCategoryValue({ axisDirection: 'x', categories, data: point });
|
|
10
|
+
return (xBandScale(dataCategory) || 0) + xBandScale.step() / 2;
|
|
11
|
+
}
|
|
12
|
+
const xLinearScale = xScale;
|
|
13
|
+
return xLinearScale(point.x);
|
|
14
|
+
}
|
|
15
|
+
export function getYValue(args) {
|
|
16
|
+
const { point, yAxis, yScale } = args;
|
|
17
|
+
if (yAxis.type === 'category') {
|
|
18
|
+
const yBandScale = yScale;
|
|
19
|
+
const categories = get(yAxis, 'categories', []);
|
|
20
|
+
const dataCategory = getDataCategoryValue({ axisDirection: 'y', categories, data: point });
|
|
21
|
+
return (yBandScale(dataCategory) || 0) + yBandScale.step() / 2;
|
|
22
|
+
}
|
|
23
|
+
const yLinearScale = yScale;
|
|
24
|
+
return yLinearScale(point.y);
|
|
25
|
+
}
|
|
26
|
+
export const shapeKey = (d) => d.id || -1;
|
|
27
|
+
export function setActiveState(args) {
|
|
28
|
+
const { element, datum, state, active } = args;
|
|
29
|
+
const elementSelection = select(element);
|
|
30
|
+
if (datum.active !== active) {
|
|
31
|
+
datum.active = active;
|
|
32
|
+
const opacity = datum.active ? null : state === null || state === void 0 ? void 0 : state.opacity;
|
|
33
|
+
elementSelection.attr('opacity', opacity || null);
|
|
34
|
+
}
|
|
35
|
+
return datum;
|
|
36
|
+
}
|
|
37
|
+
export const getLineDashArray = (dashStyle, strokeWidth = 2) => {
|
|
38
|
+
const value = dashStyle.toLowerCase();
|
|
39
|
+
const arrayValue = value
|
|
40
|
+
.replace('shortdashdotdot', '3,1,1,1,1,1,')
|
|
41
|
+
.replace('shortdashdot', '3,1,1,1')
|
|
42
|
+
.replace('shortdot', '1,1,')
|
|
43
|
+
.replace('shortdash', '3,1,')
|
|
44
|
+
.replace('longdash', '8,3,')
|
|
45
|
+
.replace(/dot/g, '1,3,')
|
|
46
|
+
.replace('dash', '4,3,')
|
|
47
|
+
.replace(/,$/, '')
|
|
48
|
+
.split(',')
|
|
49
|
+
.map((part) => {
|
|
50
|
+
return `${parseInt(part, 10) * strokeWidth}`;
|
|
51
|
+
});
|
|
52
|
+
return arrayValue.join(',').replace(/NaN/g, 'none');
|
|
53
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Dispatch } from 'd3';
|
|
3
|
+
import type { PreparedSeriesOptions } from '../../useSeries/types';
|
|
4
|
+
import type { PreparedWaterfallData } from './types';
|
|
5
|
+
export { prepareWaterfallData } from './prepare-data';
|
|
6
|
+
export * from './types';
|
|
7
|
+
type Args = {
|
|
8
|
+
dispatcher: Dispatch<object>;
|
|
9
|
+
preparedData: PreparedWaterfallData[];
|
|
10
|
+
seriesOptions: PreparedSeriesOptions;
|
|
11
|
+
htmlLayout: HTMLElement | null;
|
|
12
|
+
};
|
|
13
|
+
export declare const WaterfallSeriesShapes: (args: Args) => React.JSX.Element;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { color, line as lineGenerator, select } from 'd3';
|
|
3
|
+
import get from 'lodash/get';
|
|
4
|
+
import { DashStyle } from '../../../constants';
|
|
5
|
+
import { block, filterOverlappingLabels, getWaterfallPointColor } from '../../../utils';
|
|
6
|
+
import { HtmlLayer } from '../HtmlLayer';
|
|
7
|
+
import { getLineDashArray } from '../utils';
|
|
8
|
+
export { prepareWaterfallData } from './prepare-data';
|
|
9
|
+
export * from './types';
|
|
10
|
+
const b = block('d3-waterfall');
|
|
11
|
+
export const WaterfallSeriesShapes = (args) => {
|
|
12
|
+
const { dispatcher, preparedData, seriesOptions, htmlLayout } = args;
|
|
13
|
+
const ref = React.useRef(null);
|
|
14
|
+
const connectorSelector = `.${b('connector')}`;
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
var _a;
|
|
17
|
+
if (!ref.current) {
|
|
18
|
+
return () => { };
|
|
19
|
+
}
|
|
20
|
+
const svgElement = select(ref.current);
|
|
21
|
+
const hoverOptions = get(seriesOptions, 'waterfall.states.hover');
|
|
22
|
+
const inactiveOptions = get(seriesOptions, 'waterfall.states.inactive');
|
|
23
|
+
svgElement.selectAll('*').remove();
|
|
24
|
+
const rectSelection = svgElement
|
|
25
|
+
.selectAll('allRects')
|
|
26
|
+
.data(preparedData)
|
|
27
|
+
.join('rect')
|
|
28
|
+
.attr('class', b('segment'))
|
|
29
|
+
.attr('x', (d) => d.x)
|
|
30
|
+
.attr('y', (d) => d.y)
|
|
31
|
+
.attr('height', (d) => d.height)
|
|
32
|
+
.attr('width', (d) => d.width)
|
|
33
|
+
.attr('fill', (d) => getWaterfallPointColor(d.data, d.series))
|
|
34
|
+
.attr('opacity', (d) => d.opacity)
|
|
35
|
+
.attr('cursor', (d) => d.series.cursor);
|
|
36
|
+
let dataLabels = preparedData.map((d) => d.label).filter(Boolean);
|
|
37
|
+
if (!((_a = preparedData[0]) === null || _a === void 0 ? void 0 : _a.series.dataLabels.allowOverlap)) {
|
|
38
|
+
dataLabels = filterOverlappingLabels(dataLabels);
|
|
39
|
+
}
|
|
40
|
+
const labelSelection = svgElement
|
|
41
|
+
.selectAll('text')
|
|
42
|
+
.data(dataLabels)
|
|
43
|
+
.join('text')
|
|
44
|
+
.text((d) => d.text)
|
|
45
|
+
.attr('class', b('label'))
|
|
46
|
+
.attr('x', (d) => d.x)
|
|
47
|
+
.attr('y', (d) => d.y)
|
|
48
|
+
.attr('text-anchor', (d) => d.textAnchor)
|
|
49
|
+
.style('font-size', (d) => d.style.fontSize)
|
|
50
|
+
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
51
|
+
.style('fill', (d) => d.style.fontColor || null);
|
|
52
|
+
// Add the connector line between bars
|
|
53
|
+
svgElement
|
|
54
|
+
.selectAll(connectorSelector)
|
|
55
|
+
.data(preparedData)
|
|
56
|
+
.join('path')
|
|
57
|
+
.attr('class', b('connector'))
|
|
58
|
+
.attr('d', (d, index) => {
|
|
59
|
+
const line = lineGenerator();
|
|
60
|
+
const prev = preparedData[index - 1];
|
|
61
|
+
if (!prev) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const points = [];
|
|
65
|
+
if (Number(prev.data.y) > 0) {
|
|
66
|
+
points.push([prev.x, prev.y]);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
points.push([prev.x, prev.y + prev.height]);
|
|
70
|
+
}
|
|
71
|
+
if (Number(d.data.y) > 0 && !d.data.total) {
|
|
72
|
+
points.push([d.x + d.width, d.y + d.height]);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
points.push([d.x + d.width, d.y]);
|
|
76
|
+
}
|
|
77
|
+
return line(points);
|
|
78
|
+
})
|
|
79
|
+
.attr('stroke-width', 1)
|
|
80
|
+
.attr('stroke-dasharray', () => getLineDashArray(DashStyle.Dash, 1));
|
|
81
|
+
dispatcher.on('hover-shape.waterfall', (data) => {
|
|
82
|
+
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
83
|
+
const inactiveEnabled = inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled;
|
|
84
|
+
if (!data) {
|
|
85
|
+
if (hoverEnabled) {
|
|
86
|
+
rectSelection.attr('fill', (d) => getWaterfallPointColor(d.data, d.series));
|
|
87
|
+
}
|
|
88
|
+
if (inactiveEnabled) {
|
|
89
|
+
rectSelection.attr('opacity', null);
|
|
90
|
+
labelSelection.attr('opacity', null);
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (hoverEnabled) {
|
|
95
|
+
const hoveredValues = data.map((d) => d.data.x);
|
|
96
|
+
rectSelection.attr('fill', (d) => {
|
|
97
|
+
var _a;
|
|
98
|
+
const fillColor = getWaterfallPointColor(d.data, d.series);
|
|
99
|
+
if (hoveredValues.includes(d.data.x)) {
|
|
100
|
+
const brightness = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.brightness;
|
|
101
|
+
return ((_a = color(fillColor)) === null || _a === void 0 ? void 0 : _a.brighter(brightness).toString()) || fillColor;
|
|
102
|
+
}
|
|
103
|
+
return fillColor;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (inactiveEnabled) {
|
|
107
|
+
const hoveredSeries = data.map((d) => d.series.id);
|
|
108
|
+
rectSelection.attr('opacity', (d) => {
|
|
109
|
+
return hoveredSeries.includes(d.series.id)
|
|
110
|
+
? null
|
|
111
|
+
: (inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.opacity) || null;
|
|
112
|
+
});
|
|
113
|
+
labelSelection.attr('opacity', (d) => {
|
|
114
|
+
return hoveredSeries.includes(d.series.id)
|
|
115
|
+
? null
|
|
116
|
+
: (inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.opacity) || null;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
return () => {
|
|
121
|
+
dispatcher.on('hover-shape.waterfall', null);
|
|
122
|
+
};
|
|
123
|
+
}, [dispatcher, preparedData, seriesOptions]);
|
|
124
|
+
return (React.createElement(React.Fragment, null,
|
|
125
|
+
React.createElement("g", { ref: ref, className: b() }),
|
|
126
|
+
React.createElement(HtmlLayer, { preparedData: preparedData, htmlLayout: htmlLayout })));
|
|
127
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChartScale } from '../../useAxisScales';
|
|
2
|
+
import type { PreparedAxis } from '../../useChartOptions/types';
|
|
3
|
+
import type { PreparedSeriesOptions, PreparedWaterfallSeries } from '../../useSeries/types';
|
|
4
|
+
import type { PreparedWaterfallData } from './types';
|
|
5
|
+
export declare const prepareWaterfallData: (args: {
|
|
6
|
+
series: PreparedWaterfallSeries[];
|
|
7
|
+
seriesOptions: PreparedSeriesOptions;
|
|
8
|
+
xAxis: PreparedAxis;
|
|
9
|
+
xScale: ChartScale;
|
|
10
|
+
yAxis: PreparedAxis[];
|
|
11
|
+
yScale: ChartScale[];
|
|
12
|
+
}) => PreparedWaterfallData[];
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import get from 'lodash/get';
|
|
2
|
+
import sortBy from 'lodash/sortBy';
|
|
3
|
+
import { getLabelsSize } from '../../../utils';
|
|
4
|
+
import { MIN_BAR_GAP, MIN_BAR_WIDTH } from '../constants';
|
|
5
|
+
import { getXValue, getYValue } from '../utils';
|
|
6
|
+
function getLabelData(d, plotHeight) {
|
|
7
|
+
if (!d.series.dataLabels.enabled) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
const text = String(d.data.label || d.subTotal);
|
|
11
|
+
const style = d.series.dataLabels.style;
|
|
12
|
+
const { maxHeight: height, maxWidth: width } = getLabelsSize({ labels: [text], style });
|
|
13
|
+
let y;
|
|
14
|
+
if (Number(d.data.y) > 0 || d.data.total) {
|
|
15
|
+
y = Math.max(height, d.y - d.series.dataLabels.padding);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
y = Math.min(plotHeight - d.series.dataLabels.padding, d.y + d.height + d.series.dataLabels.padding + height);
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
text,
|
|
22
|
+
x: d.x + d.width / 2,
|
|
23
|
+
y,
|
|
24
|
+
style,
|
|
25
|
+
size: { width, height },
|
|
26
|
+
textAnchor: 'middle',
|
|
27
|
+
series: d.series,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function getBandWidth(args) {
|
|
31
|
+
const { series, xAxis, xScale } = args;
|
|
32
|
+
if (xAxis.type === 'category') {
|
|
33
|
+
const xBandScale = xScale;
|
|
34
|
+
return xBandScale.bandwidth();
|
|
35
|
+
}
|
|
36
|
+
const xLinearScale = xScale;
|
|
37
|
+
const xValues = series.reduce((acc, s) => {
|
|
38
|
+
s.data.forEach((dataItem) => acc.push(Number(dataItem.x)));
|
|
39
|
+
return acc;
|
|
40
|
+
}, []);
|
|
41
|
+
let bandWidth = Infinity;
|
|
42
|
+
xValues.sort().forEach((xValue, index) => {
|
|
43
|
+
if (index > 0 && xValue !== xValues[index - 1]) {
|
|
44
|
+
const dist = xLinearScale(xValue) - xLinearScale(xValues[index - 1]);
|
|
45
|
+
if (dist < bandWidth) {
|
|
46
|
+
bandWidth = dist;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return bandWidth;
|
|
51
|
+
}
|
|
52
|
+
export const prepareWaterfallData = (args) => {
|
|
53
|
+
const { series, seriesOptions, xAxis, xScale, yAxis: [yAxis], yScale: [yScale], } = args;
|
|
54
|
+
const yLinearScale = yScale;
|
|
55
|
+
const plotHeight = yLinearScale(yLinearScale.domain()[0]);
|
|
56
|
+
const barMaxWidth = get(seriesOptions, 'waterfall.barMaxWidth');
|
|
57
|
+
const barPadding = get(seriesOptions, 'waterfall.barPadding');
|
|
58
|
+
const flattenData = series.reduce((acc, s) => {
|
|
59
|
+
acc.push(...s.data.map((d) => ({ data: d, series: s })));
|
|
60
|
+
return acc;
|
|
61
|
+
}, []);
|
|
62
|
+
const data = sortBy(flattenData, (d) => d.data.x);
|
|
63
|
+
const bandWidth = getBandWidth({
|
|
64
|
+
series,
|
|
65
|
+
xAxis,
|
|
66
|
+
xScale,
|
|
67
|
+
});
|
|
68
|
+
const rectGap = Math.max(bandWidth * barPadding, MIN_BAR_GAP);
|
|
69
|
+
const rectWidth = Math.max(MIN_BAR_WIDTH, Math.min(bandWidth - rectGap, barMaxWidth));
|
|
70
|
+
const yZero = getYValue({
|
|
71
|
+
point: { y: 0 },
|
|
72
|
+
yScale,
|
|
73
|
+
yAxis,
|
|
74
|
+
});
|
|
75
|
+
let totalValue = 0;
|
|
76
|
+
const result = [];
|
|
77
|
+
data.forEach((item, _index) => {
|
|
78
|
+
if (typeof item.data.y !== 'number' && !item.data.total) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (!item.data.total) {
|
|
82
|
+
totalValue += Number(item.data.y);
|
|
83
|
+
}
|
|
84
|
+
const prevPoint = result[result.length - 1];
|
|
85
|
+
const xCenter = getXValue({ point: item.data, xAxis, xScale });
|
|
86
|
+
const x = xCenter - rectWidth / 2;
|
|
87
|
+
const yValue = Number(item.data.total ? totalValue : item.data.y);
|
|
88
|
+
const height = yZero -
|
|
89
|
+
getYValue({
|
|
90
|
+
point: { y: Math.abs(yValue) },
|
|
91
|
+
yScale,
|
|
92
|
+
yAxis,
|
|
93
|
+
});
|
|
94
|
+
let y;
|
|
95
|
+
if (!prevPoint || item.data.total) {
|
|
96
|
+
y = getYValue({
|
|
97
|
+
point: {
|
|
98
|
+
y: yValue > 0 ? yValue : 0,
|
|
99
|
+
},
|
|
100
|
+
yScale,
|
|
101
|
+
yAxis,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
else if (Number(prevPoint.data.y) < 0) {
|
|
105
|
+
if (Number(item.data.y) > 0) {
|
|
106
|
+
y = prevPoint.y + prevPoint.height - height;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
y = prevPoint.y + prevPoint.height;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else if (Number(item.data.y) < 0) {
|
|
113
|
+
y = prevPoint.y;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
y = prevPoint.y - height;
|
|
117
|
+
}
|
|
118
|
+
const preparedData = {
|
|
119
|
+
x,
|
|
120
|
+
y,
|
|
121
|
+
width: rectWidth,
|
|
122
|
+
height,
|
|
123
|
+
opacity: get(item.data, 'opacity', null),
|
|
124
|
+
data: item.data,
|
|
125
|
+
series: item.series,
|
|
126
|
+
subTotal: totalValue,
|
|
127
|
+
htmlElements: [],
|
|
128
|
+
};
|
|
129
|
+
preparedData.label = getLabelData(preparedData, plotHeight);
|
|
130
|
+
result.push(preparedData);
|
|
131
|
+
});
|
|
132
|
+
return result;
|
|
133
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HtmlItem, LabelData, WaterfallSeriesData } from '../../../types';
|
|
2
|
+
import type { PreparedWaterfallSeries } from '../../useSeries/types';
|
|
3
|
+
export type PreparedWaterfallData = {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
opacity: number | null;
|
|
9
|
+
series: PreparedWaterfallSeries;
|
|
10
|
+
data: WaterfallSeriesData;
|
|
11
|
+
label?: LabelData;
|
|
12
|
+
subTotal: number;
|
|
13
|
+
htmlElements: HtmlItem[];
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ChartSplit } from '../../types';
|
|
2
|
+
import type { PreparedSplit } from './types';
|
|
3
|
+
type UseSplitArgs = {
|
|
4
|
+
split?: ChartSplit;
|
|
5
|
+
boundsHeight: number;
|
|
6
|
+
chartWidth: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function getPlotHeight(args: {
|
|
9
|
+
split: ChartSplit | undefined;
|
|
10
|
+
boundsHeight: number;
|
|
11
|
+
gap: number;
|
|
12
|
+
}): number;
|
|
13
|
+
export declare const useSplit: (args: UseSplitArgs) => PreparedSplit;
|
|
14
|
+
export {};
|