@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,278 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { line as lineGenerator, scaleLinear, select, symbol } from 'd3';
|
|
3
|
+
import { CONTINUOUS_LEGEND_SIZE } from '../../constants';
|
|
4
|
+
import { getLineDashArray } from '../../hooks/useShapes/utils';
|
|
5
|
+
import { block, createGradientRect, getContinuesColorFn, getLabelsSize, getSymbol, } from '../../utils';
|
|
6
|
+
import { axisBottom } from '../../utils/chart/axis-generators';
|
|
7
|
+
import './styles.css';
|
|
8
|
+
const b = block('d3-legend');
|
|
9
|
+
const getLegendPosition = (args) => {
|
|
10
|
+
const { align, offsetWidth, width, contentWidth } = args;
|
|
11
|
+
const top = 0;
|
|
12
|
+
if (align === 'left') {
|
|
13
|
+
return { top, left: offsetWidth };
|
|
14
|
+
}
|
|
15
|
+
if (align === 'right') {
|
|
16
|
+
return { top, left: offsetWidth + width - contentWidth };
|
|
17
|
+
}
|
|
18
|
+
return { top, left: offsetWidth + width / 2 - contentWidth / 2 };
|
|
19
|
+
};
|
|
20
|
+
const appendPaginator = (args) => {
|
|
21
|
+
const { container, offset, maxPage, legend, transform, onArrowClick } = args;
|
|
22
|
+
const paginationLine = container.append('g').attr('class', b('pagination'));
|
|
23
|
+
let computedWidth = 0;
|
|
24
|
+
paginationLine
|
|
25
|
+
.append('text')
|
|
26
|
+
.text('▲')
|
|
27
|
+
.attr('class', function () {
|
|
28
|
+
return b('pagination-arrow', { inactive: offset === 0 });
|
|
29
|
+
})
|
|
30
|
+
.style('font-size', legend.itemStyle.fontSize)
|
|
31
|
+
.each(function () {
|
|
32
|
+
computedWidth += this.getComputedTextLength();
|
|
33
|
+
})
|
|
34
|
+
.on('click', function () {
|
|
35
|
+
if (offset - 1 >= 0) {
|
|
36
|
+
onArrowClick(offset - 1);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
paginationLine
|
|
40
|
+
.append('text')
|
|
41
|
+
.text(`${offset + 1}/${maxPage}`)
|
|
42
|
+
.attr('class', b('pagination-counter'))
|
|
43
|
+
.attr('x', computedWidth)
|
|
44
|
+
.style('font-size', legend.itemStyle.fontSize)
|
|
45
|
+
.each(function () {
|
|
46
|
+
computedWidth += this.getComputedTextLength();
|
|
47
|
+
});
|
|
48
|
+
paginationLine
|
|
49
|
+
.append('text')
|
|
50
|
+
.text('▼')
|
|
51
|
+
.attr('class', function () {
|
|
52
|
+
return b('pagination-arrow', { inactive: offset === maxPage - 1 });
|
|
53
|
+
})
|
|
54
|
+
.attr('x', computedWidth)
|
|
55
|
+
.style('font-size', legend.itemStyle.fontSize)
|
|
56
|
+
.on('click', function () {
|
|
57
|
+
if (offset + 1 < maxPage) {
|
|
58
|
+
onArrowClick(offset + 1);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
paginationLine.attr('transform', transform);
|
|
62
|
+
};
|
|
63
|
+
const legendSymbolGenerator = lineGenerator()
|
|
64
|
+
.x((d) => d.x)
|
|
65
|
+
.y((d) => d.y);
|
|
66
|
+
function renderLegendSymbol(args) {
|
|
67
|
+
const { selection, legend } = args;
|
|
68
|
+
const line = selection.data();
|
|
69
|
+
const getXPosition = (i) => {
|
|
70
|
+
return line.slice(0, i).reduce((acc, legendItem) => {
|
|
71
|
+
return (acc +
|
|
72
|
+
legendItem.symbol.width +
|
|
73
|
+
legendItem.symbol.padding +
|
|
74
|
+
legendItem.textWidth +
|
|
75
|
+
legend.itemDistance);
|
|
76
|
+
}, 0);
|
|
77
|
+
};
|
|
78
|
+
selection.each(function (d, i) {
|
|
79
|
+
const element = select(this);
|
|
80
|
+
const x = getXPosition(i);
|
|
81
|
+
const className = b('item-symbol', { shape: d.symbol.shape, unselected: !d.visible });
|
|
82
|
+
const color = d.visible ? d.color : '';
|
|
83
|
+
switch (d.symbol.shape) {
|
|
84
|
+
case 'path': {
|
|
85
|
+
const y = legend.lineHeight / 2;
|
|
86
|
+
const points = [
|
|
87
|
+
{ x: x, y },
|
|
88
|
+
{ x: x + d.symbol.width, y },
|
|
89
|
+
];
|
|
90
|
+
element
|
|
91
|
+
.append('path')
|
|
92
|
+
.attr('d', legendSymbolGenerator(points))
|
|
93
|
+
.attr('fill', 'none')
|
|
94
|
+
.attr('stroke-width', d.symbol.strokeWidth)
|
|
95
|
+
.attr('class', className)
|
|
96
|
+
.style('stroke', color);
|
|
97
|
+
if (d.dashStyle) {
|
|
98
|
+
element.attr('stroke-dasharray', getLineDashArray(d.dashStyle, d.symbol.strokeWidth));
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
case 'rect': {
|
|
103
|
+
const y = (legend.lineHeight - d.symbol.height) / 2;
|
|
104
|
+
element
|
|
105
|
+
.append('rect')
|
|
106
|
+
.attr('x', x)
|
|
107
|
+
.attr('y', y)
|
|
108
|
+
.attr('width', d.symbol.width)
|
|
109
|
+
.attr('height', d.symbol.height)
|
|
110
|
+
.attr('rx', d.symbol.radius)
|
|
111
|
+
.attr('class', className)
|
|
112
|
+
.style('fill', color);
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
case 'symbol': {
|
|
116
|
+
const y = legend.lineHeight / 2;
|
|
117
|
+
element
|
|
118
|
+
.append('svg:path')
|
|
119
|
+
.attr('d', () => {
|
|
120
|
+
const scatterSymbol = getSymbol(d.symbol.symbolType);
|
|
121
|
+
// D3 takes size as square pixels, so we need to make square pixels size by multiplying
|
|
122
|
+
// https://d3js.org/d3-shape/symbol#symbol
|
|
123
|
+
return symbol(scatterSymbol, d.symbol.width * d.symbol.width)();
|
|
124
|
+
})
|
|
125
|
+
.attr('transform', () => {
|
|
126
|
+
return 'translate(' + x + ',' + y + ')';
|
|
127
|
+
})
|
|
128
|
+
.attr('class', className)
|
|
129
|
+
.style('fill', color);
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
export const Legend = (props) => {
|
|
136
|
+
const { boundsWidth, chartSeries, legend, items, config, onItemClick } = props;
|
|
137
|
+
const ref = React.useRef(null);
|
|
138
|
+
const [paginationOffset, setPaginationOffset] = React.useState(0);
|
|
139
|
+
React.useEffect(() => {
|
|
140
|
+
setPaginationOffset(0);
|
|
141
|
+
}, [boundsWidth]);
|
|
142
|
+
React.useEffect(() => {
|
|
143
|
+
var _a, _b, _c, _d, _e;
|
|
144
|
+
if (!ref.current) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const svgElement = select(ref.current);
|
|
148
|
+
svgElement.selectAll('*').remove();
|
|
149
|
+
let legendWidth = 0;
|
|
150
|
+
if (legend.type === 'discrete') {
|
|
151
|
+
const limit = (_a = config.pagination) === null || _a === void 0 ? void 0 : _a.limit;
|
|
152
|
+
const pageItems = typeof limit === 'number'
|
|
153
|
+
? items.slice(paginationOffset * limit, paginationOffset * limit + limit)
|
|
154
|
+
: items;
|
|
155
|
+
pageItems.forEach((line, lineIndex) => {
|
|
156
|
+
var _a;
|
|
157
|
+
const legendLine = svgElement.append('g').attr('class', b('line'));
|
|
158
|
+
const legendItemTemplate = legendLine
|
|
159
|
+
.selectAll('legend-history')
|
|
160
|
+
.data(line)
|
|
161
|
+
.enter()
|
|
162
|
+
.append('g')
|
|
163
|
+
.attr('class', b('item'))
|
|
164
|
+
.on('click', function (e, d) {
|
|
165
|
+
onItemClick({ name: d.name, metaKey: e.metaKey });
|
|
166
|
+
});
|
|
167
|
+
const getXPosition = (i) => {
|
|
168
|
+
return line.slice(0, i).reduce((acc, legendItem) => {
|
|
169
|
+
return (acc +
|
|
170
|
+
legendItem.symbol.width +
|
|
171
|
+
legendItem.symbol.padding +
|
|
172
|
+
legendItem.textWidth +
|
|
173
|
+
legend.itemDistance);
|
|
174
|
+
}, 0);
|
|
175
|
+
};
|
|
176
|
+
renderLegendSymbol({ selection: legendItemTemplate, legend });
|
|
177
|
+
legendItemTemplate
|
|
178
|
+
.append('text')
|
|
179
|
+
.attr('x', function (legendItem, i) {
|
|
180
|
+
return (getXPosition(i) + legendItem.symbol.width + legendItem.symbol.padding);
|
|
181
|
+
})
|
|
182
|
+
.attr('height', legend.lineHeight)
|
|
183
|
+
.attr('class', function (d) {
|
|
184
|
+
const mods = { selected: d.visible, unselected: !d.visible };
|
|
185
|
+
return b('item-text', mods);
|
|
186
|
+
})
|
|
187
|
+
.text(function (d) {
|
|
188
|
+
return ('name' in d && d.name);
|
|
189
|
+
})
|
|
190
|
+
.style('font-size', legend.itemStyle.fontSize);
|
|
191
|
+
const contentWidth = ((_a = legendLine.node()) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width) || 0;
|
|
192
|
+
const { left } = getLegendPosition({
|
|
193
|
+
align: legend.align,
|
|
194
|
+
width: boundsWidth,
|
|
195
|
+
offsetWidth: 0,
|
|
196
|
+
contentWidth,
|
|
197
|
+
});
|
|
198
|
+
const top = legend.lineHeight * lineIndex;
|
|
199
|
+
legendLine.attr('transform', `translate(${[left, top].join(',')})`);
|
|
200
|
+
});
|
|
201
|
+
legendWidth = boundsWidth;
|
|
202
|
+
if (config.pagination) {
|
|
203
|
+
const transform = `translate(${[
|
|
204
|
+
0,
|
|
205
|
+
legend.lineHeight * config.pagination.limit + legend.lineHeight / 2,
|
|
206
|
+
].join(',')})`;
|
|
207
|
+
appendPaginator({
|
|
208
|
+
container: svgElement,
|
|
209
|
+
offset: paginationOffset,
|
|
210
|
+
maxPage: config.pagination.maxPage,
|
|
211
|
+
legend,
|
|
212
|
+
transform,
|
|
213
|
+
onArrowClick: setPaginationOffset,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
// gradient rect
|
|
219
|
+
const domain = (_b = legend.colorScale.domain) !== null && _b !== void 0 ? _b : [];
|
|
220
|
+
const rectHeight = CONTINUOUS_LEGEND_SIZE.height;
|
|
221
|
+
svgElement.call(createGradientRect, {
|
|
222
|
+
y: legend.title.height + legend.title.margin,
|
|
223
|
+
height: rectHeight,
|
|
224
|
+
width: legend.width,
|
|
225
|
+
interpolator: getContinuesColorFn({
|
|
226
|
+
values: [0, 1],
|
|
227
|
+
colors: legend.colorScale.colors,
|
|
228
|
+
stops: legend.colorScale.stops,
|
|
229
|
+
}),
|
|
230
|
+
});
|
|
231
|
+
// ticks
|
|
232
|
+
const xAxisGenerator = axisBottom({
|
|
233
|
+
scale: scaleLinear(domain, [0, legend.width]),
|
|
234
|
+
ticks: {
|
|
235
|
+
items: [[0, -rectHeight]],
|
|
236
|
+
labelsMargin: legend.ticks.labelsMargin,
|
|
237
|
+
labelsLineHeight: legend.ticks.labelsLineHeight,
|
|
238
|
+
maxTickCount: 4,
|
|
239
|
+
tickColor: '#fff',
|
|
240
|
+
},
|
|
241
|
+
domain: {
|
|
242
|
+
size: legend.width,
|
|
243
|
+
color: 'transparent',
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
const tickTop = legend.title.height + legend.title.margin + rectHeight;
|
|
247
|
+
svgElement
|
|
248
|
+
.append('g')
|
|
249
|
+
.attr('transform', `translate(0, ${tickTop})`)
|
|
250
|
+
.call(xAxisGenerator);
|
|
251
|
+
legendWidth = legend.width;
|
|
252
|
+
}
|
|
253
|
+
if (legend.title.enable) {
|
|
254
|
+
const { maxWidth: labelWidth } = getLabelsSize({
|
|
255
|
+
labels: [legend.title.text],
|
|
256
|
+
style: legend.title.style,
|
|
257
|
+
});
|
|
258
|
+
svgElement
|
|
259
|
+
.append('g')
|
|
260
|
+
.attr('class', b('title'))
|
|
261
|
+
.append('text')
|
|
262
|
+
.attr('dx', legend.width / 2 - labelWidth / 2)
|
|
263
|
+
.attr('font-weight', (_c = legend.title.style.fontWeight) !== null && _c !== void 0 ? _c : null)
|
|
264
|
+
.attr('font-size', (_d = legend.title.style.fontSize) !== null && _d !== void 0 ? _d : null)
|
|
265
|
+
.attr('fill', (_e = legend.title.style.fontColor) !== null && _e !== void 0 ? _e : null)
|
|
266
|
+
.style('alignment-baseline', 'before-edge')
|
|
267
|
+
.text(legend.title.text);
|
|
268
|
+
}
|
|
269
|
+
const { left } = getLegendPosition({
|
|
270
|
+
align: legend.align,
|
|
271
|
+
width: boundsWidth,
|
|
272
|
+
offsetWidth: config.offset.left,
|
|
273
|
+
contentWidth: legendWidth,
|
|
274
|
+
});
|
|
275
|
+
svgElement.attr('transform', `translate(${[left, config.offset.top].join(',')})`);
|
|
276
|
+
}, [boundsWidth, chartSeries, onItemClick, legend, items, config, paginationOffset]);
|
|
277
|
+
return React.createElement("g", { className: b(), ref: ref, width: boundsWidth, height: legend.height });
|
|
278
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.gcharts-d3-legend {
|
|
2
|
+
color: var(--g-color-text-secondary);
|
|
3
|
+
}
|
|
4
|
+
.gcharts-d3-legend__title {
|
|
5
|
+
fill: var(--g-color-text-secondary);
|
|
6
|
+
}
|
|
7
|
+
.gcharts-d3-legend__item {
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
user-select: none;
|
|
10
|
+
}
|
|
11
|
+
.gcharts-d3-legend__item-symbol_shape_rect.gcharts-d3-legend__item-symbol_unselected {
|
|
12
|
+
fill: var(--g-color-text-hint);
|
|
13
|
+
}
|
|
14
|
+
.gcharts-d3-legend__item-symbol_shape_path.gcharts-d3-legend__item-symbol_unselected {
|
|
15
|
+
stroke: var(--g-color-text-hint);
|
|
16
|
+
}
|
|
17
|
+
.gcharts-d3-legend__item-symbol_shape_symbol.gcharts-d3-legend__item-symbol_unselected {
|
|
18
|
+
fill: var(--g-color-text-hint);
|
|
19
|
+
}
|
|
20
|
+
.gcharts-d3-legend__item-text {
|
|
21
|
+
fill: var(--g-color-text-secondary);
|
|
22
|
+
alignment-baseline: before-edge;
|
|
23
|
+
}
|
|
24
|
+
.gcharts-d3-legend__item-text_unselected {
|
|
25
|
+
fill: var(--g-color-text-hint);
|
|
26
|
+
}
|
|
27
|
+
.gcharts-d3-legend__item-text:hover {
|
|
28
|
+
fill: var(--g-color-text-complementary);
|
|
29
|
+
}
|
|
30
|
+
.gcharts-d3-legend__pagination {
|
|
31
|
+
user-select: none;
|
|
32
|
+
fill: var(--g-color-text-primary);
|
|
33
|
+
}
|
|
34
|
+
.gcharts-d3-legend__pagination-counter, .gcharts-d3-legend__pagination-arrow {
|
|
35
|
+
alignment-baseline: middle;
|
|
36
|
+
}
|
|
37
|
+
.gcharts-d3-legend__pagination-arrow {
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
fill: var(--g-color-text-brand);
|
|
40
|
+
}
|
|
41
|
+
.gcharts-d3-legend__pagination-arrow_inactive {
|
|
42
|
+
cursor: inherit;
|
|
43
|
+
fill: var(--g-color-base-generic-accent-disabled);
|
|
44
|
+
}
|
|
45
|
+
.gcharts-d3-legend__pagination-arrow:hover:not(.gcharts-d3-legend__pagination-arrow_inactive) {
|
|
46
|
+
fill: var(--g-color-base-brand-hover);
|
|
47
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { block } from '../../utils';
|
|
3
|
+
import './styles.css';
|
|
4
|
+
const b = block('d3-plot-title');
|
|
5
|
+
export const PlotTitle = (props) => {
|
|
6
|
+
const { title } = props;
|
|
7
|
+
if (!title) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
const { x, y, text, style, height } = title;
|
|
11
|
+
return (React.createElement("text", { className: b(), dx: x, dy: y, dominantBaseline: "middle", textAnchor: "middle", style: Object.assign({ lineHeight: `${height}px` }, style) },
|
|
12
|
+
React.createElement("tspan", null, text)));
|
|
13
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { block } from '../../utils';
|
|
3
|
+
import './styles.css';
|
|
4
|
+
const b = block('d3-title');
|
|
5
|
+
export const Title = (props) => {
|
|
6
|
+
const { chartWidth, text, height, style } = props;
|
|
7
|
+
return (React.createElement("text", { className: b(), dx: chartWidth / 2, dy: height / 2, dominantBaseline: "middle", textAnchor: "middle", style: Object.assign({ lineHeight: `${height}px` }, style) },
|
|
8
|
+
React.createElement("tspan", null, text)));
|
|
9
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PreparedAxis } from '../../hooks';
|
|
3
|
+
import type { TooltipDataChunk } from '../../types';
|
|
4
|
+
type Props = {
|
|
5
|
+
hovered: TooltipDataChunk[];
|
|
6
|
+
xAxis: PreparedAxis;
|
|
7
|
+
yAxis: PreparedAxis;
|
|
8
|
+
};
|
|
9
|
+
export declare const DefaultContent: ({ hovered, xAxis, yAxis }: Props) => React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { dateTime } from '@gravity-ui/date-utils';
|
|
3
|
+
import get from 'lodash/get';
|
|
4
|
+
import { formatNumber } from '../../libs';
|
|
5
|
+
import { block, getDataCategoryValue, getWaterfallPointSubtotal } from '../../utils';
|
|
6
|
+
const b = block('d3-tooltip');
|
|
7
|
+
const DEFAULT_DATE_FORMAT = 'DD.MM.YY';
|
|
8
|
+
const getRowData = (fieldName, axis, data) => {
|
|
9
|
+
switch (axis.type) {
|
|
10
|
+
case 'category': {
|
|
11
|
+
const categories = get(axis, 'categories', []);
|
|
12
|
+
return getDataCategoryValue({ axisDirection: fieldName, categories, data });
|
|
13
|
+
}
|
|
14
|
+
case 'datetime': {
|
|
15
|
+
const value = get(data, fieldName);
|
|
16
|
+
if (!value) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
return dateTime({ input: value }).format(DEFAULT_DATE_FORMAT);
|
|
20
|
+
}
|
|
21
|
+
case 'linear':
|
|
22
|
+
default: {
|
|
23
|
+
const value = get(data, fieldName);
|
|
24
|
+
return formatNumber(value);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const getXRowData = (xAxis, data) => getRowData('x', xAxis, data);
|
|
29
|
+
const getYRowData = (yAxis, data) => getRowData('y', yAxis, data);
|
|
30
|
+
const getMeasureValue = (data, xAxis, yAxis) => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
if (data.every((item) => ['pie', 'treemap', 'waterfall'].includes(item.series.type))) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
if (data.some((item) => item.series.type === 'bar-y')) {
|
|
36
|
+
return getYRowData(yAxis, (_a = data[0]) === null || _a === void 0 ? void 0 : _a.data);
|
|
37
|
+
}
|
|
38
|
+
return getXRowData(xAxis, (_b = data[0]) === null || _b === void 0 ? void 0 : _b.data);
|
|
39
|
+
};
|
|
40
|
+
export const DefaultContent = ({ hovered, xAxis, yAxis }) => {
|
|
41
|
+
const measureValue = getMeasureValue(hovered, xAxis, yAxis);
|
|
42
|
+
return (React.createElement(React.Fragment, null,
|
|
43
|
+
measureValue && React.createElement("div", null, measureValue),
|
|
44
|
+
hovered.map(({ data, series, closest }, i) => {
|
|
45
|
+
const id = `${get(series, 'id')}_${i}`;
|
|
46
|
+
const color = get(series, 'color');
|
|
47
|
+
switch (series.type) {
|
|
48
|
+
case 'scatter':
|
|
49
|
+
case 'line':
|
|
50
|
+
case 'area':
|
|
51
|
+
case 'bar-x': {
|
|
52
|
+
const value = (React.createElement(React.Fragment, null,
|
|
53
|
+
series.name,
|
|
54
|
+
": ",
|
|
55
|
+
getYRowData(yAxis, data)));
|
|
56
|
+
return (React.createElement("div", { key: id, className: b('content-row') },
|
|
57
|
+
React.createElement("div", { className: b('color'), style: { backgroundColor: color } }),
|
|
58
|
+
React.createElement("div", null, closest ? React.createElement("b", null, value) : React.createElement("span", null, value))));
|
|
59
|
+
}
|
|
60
|
+
case 'waterfall': {
|
|
61
|
+
const isTotal = get(data, 'total', false);
|
|
62
|
+
const subTotal = getWaterfallPointSubtotal(data, series);
|
|
63
|
+
return (React.createElement("div", { key: `${id}_${get(data, 'x')}` },
|
|
64
|
+
!isTotal && (React.createElement(React.Fragment, null,
|
|
65
|
+
React.createElement("div", { key: id, className: b('content-row') },
|
|
66
|
+
React.createElement("b", null, getXRowData(xAxis, data))),
|
|
67
|
+
React.createElement("div", { className: b('content-row') },
|
|
68
|
+
React.createElement("span", null,
|
|
69
|
+
series.name,
|
|
70
|
+
"\u00A0"),
|
|
71
|
+
React.createElement("span", null, getYRowData(yAxis, data))))),
|
|
72
|
+
React.createElement("div", { key: id, className: b('content-row') },
|
|
73
|
+
isTotal ? 'Total' : 'Subtotal',
|
|
74
|
+
": ",
|
|
75
|
+
subTotal)));
|
|
76
|
+
}
|
|
77
|
+
case 'bar-y': {
|
|
78
|
+
const value = (React.createElement(React.Fragment, null,
|
|
79
|
+
series.name,
|
|
80
|
+
": ",
|
|
81
|
+
getXRowData(xAxis, data)));
|
|
82
|
+
return (React.createElement("div", { key: id, className: b('content-row') },
|
|
83
|
+
React.createElement("div", { className: b('color'), style: { backgroundColor: color } }),
|
|
84
|
+
React.createElement("div", null, closest ? React.createElement("b", null, value) : React.createElement("span", null, value))));
|
|
85
|
+
}
|
|
86
|
+
case 'pie':
|
|
87
|
+
case 'treemap': {
|
|
88
|
+
const seriesData = data;
|
|
89
|
+
return (React.createElement("div", { key: id, className: b('content-row') },
|
|
90
|
+
React.createElement("div", { className: b('color'), style: { backgroundColor: color } }),
|
|
91
|
+
React.createElement("span", null,
|
|
92
|
+
seriesData.name || seriesData.id,
|
|
93
|
+
"\u00A0"),
|
|
94
|
+
React.createElement("span", null, seriesData.value)));
|
|
95
|
+
}
|
|
96
|
+
default: {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
})));
|
|
101
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Dispatch } from 'd3';
|
|
3
|
+
import type { PreparedAxis, PreparedTooltip } from '../../hooks';
|
|
4
|
+
import './styles.css';
|
|
5
|
+
type TooltipProps = {
|
|
6
|
+
dispatcher: Dispatch<object>;
|
|
7
|
+
tooltip: PreparedTooltip;
|
|
8
|
+
svgContainer: SVGSVGElement | null;
|
|
9
|
+
xAxis: PreparedAxis;
|
|
10
|
+
yAxis: PreparedAxis;
|
|
11
|
+
};
|
|
12
|
+
export declare const Tooltip: (props: TooltipProps) => React.JSX.Element | null;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Popup, useVirtualElementRef } from '@gravity-ui/uikit';
|
|
3
|
+
import isNil from 'lodash/isNil';
|
|
4
|
+
import { useTooltip } from '../../hooks';
|
|
5
|
+
import { block } from '../../utils';
|
|
6
|
+
import { DefaultContent } from './DefaultContent';
|
|
7
|
+
import './styles.css';
|
|
8
|
+
const b = block('d3-tooltip');
|
|
9
|
+
export const Tooltip = (props) => {
|
|
10
|
+
const { tooltip, xAxis, yAxis, svgContainer, dispatcher } = props;
|
|
11
|
+
const { hovered, pointerPosition } = useTooltip({ dispatcher, tooltip });
|
|
12
|
+
const containerRect = (svgContainer === null || svgContainer === void 0 ? void 0 : svgContainer.getBoundingClientRect()) || { left: 0, top: 0 };
|
|
13
|
+
const left = ((pointerPosition === null || pointerPosition === void 0 ? void 0 : pointerPosition[0]) || 0) + containerRect.left;
|
|
14
|
+
const top = ((pointerPosition === null || pointerPosition === void 0 ? void 0 : pointerPosition[1]) || 0) + containerRect.top;
|
|
15
|
+
const anchorRef = useVirtualElementRef({ rect: { top, left } });
|
|
16
|
+
const content = React.useMemo(() => {
|
|
17
|
+
var _a;
|
|
18
|
+
if (!hovered) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const customTooltip = (_a = tooltip.renderer) === null || _a === void 0 ? void 0 : _a.call(tooltip, { hovered });
|
|
22
|
+
return isNil(customTooltip) ? (React.createElement(DefaultContent, { hovered: hovered, xAxis: xAxis, yAxis: yAxis })) : (customTooltip);
|
|
23
|
+
}, [hovered, tooltip, xAxis, yAxis]);
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
window.dispatchEvent(new CustomEvent('scroll'));
|
|
26
|
+
}, [left, top]);
|
|
27
|
+
return (hovered === null || hovered === void 0 ? void 0 : hovered.length) ? (React.createElement(Popup, { className: b(), open: true, anchorRef: anchorRef, offset: [0, 20], placement: ['right', 'left', 'top', 'bottom'], modifiers: [{ name: 'preventOverflow', options: { padding: 10, altAxis: true } }] },
|
|
28
|
+
React.createElement("div", { className: b('content') }, content))) : null;
|
|
29
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.gcharts-d3-tooltip[class] {
|
|
2
|
+
--g-popup-border-width: 0;
|
|
3
|
+
pointer-events: none;
|
|
4
|
+
}
|
|
5
|
+
.gcharts-d3-tooltip[class] > div {
|
|
6
|
+
animation-duration: unset;
|
|
7
|
+
animation-timing-function: unset;
|
|
8
|
+
animation-fill-mode: unset;
|
|
9
|
+
}
|
|
10
|
+
.gcharts-d3-tooltip__content {
|
|
11
|
+
padding: 10px 14px;
|
|
12
|
+
text-wrap: nowrap;
|
|
13
|
+
border: 1px solid var(--g-color-line-generic);
|
|
14
|
+
border-radius: 3px;
|
|
15
|
+
background-color: var(--g-color-infographics-tooltip-bg);
|
|
16
|
+
box-shadow: 0 2px 12px var(--g-color-sfx-shadow);
|
|
17
|
+
}
|
|
18
|
+
.gcharts-d3-tooltip__content-row {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
}
|
|
22
|
+
.gcharts-d3-tooltip__color {
|
|
23
|
+
display: inline-block;
|
|
24
|
+
width: 16px;
|
|
25
|
+
height: 8px;
|
|
26
|
+
margin-inline-end: 8px;
|
|
27
|
+
border-radius: 2px;
|
|
28
|
+
background-color: #dddddd;
|
|
29
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ChartData } from '../types';
|
|
3
|
+
export type ChartRef = {
|
|
4
|
+
reflow: () => void;
|
|
5
|
+
};
|
|
6
|
+
type ChartDimentions = {
|
|
7
|
+
height: number;
|
|
8
|
+
width: number;
|
|
9
|
+
};
|
|
10
|
+
export type ChartProps = {
|
|
11
|
+
data: ChartData;
|
|
12
|
+
lang?: string;
|
|
13
|
+
onResize?: (args: {
|
|
14
|
+
dimensions?: ChartDimentions;
|
|
15
|
+
}) => void;
|
|
16
|
+
};
|
|
17
|
+
export declare const Chart: React.ForwardRefExoticComponent<ChartProps & React.RefAttributes<ChartRef>>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { select } from 'd3';
|
|
3
|
+
import debounce from 'lodash/debounce';
|
|
4
|
+
import { i18nFactory } from '../i18n';
|
|
5
|
+
import { getUniqId } from '../utils';
|
|
6
|
+
import { validateData } from '../validation';
|
|
7
|
+
import { ChartInner } from './ChartInner';
|
|
8
|
+
export const Chart = React.forwardRef(function Chart(props, forwardedRef) {
|
|
9
|
+
const { data, lang, onResize } = props;
|
|
10
|
+
const validatedData = React.useRef();
|
|
11
|
+
const ref = React.useRef(null);
|
|
12
|
+
const debounced = React.useRef();
|
|
13
|
+
const [dimensions, setDimensions] = React.useState();
|
|
14
|
+
if (validatedData.current !== data) {
|
|
15
|
+
validateData(data);
|
|
16
|
+
validatedData.current = data;
|
|
17
|
+
}
|
|
18
|
+
const handleResize = React.useCallback(() => {
|
|
19
|
+
var _a;
|
|
20
|
+
const parentElement = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
21
|
+
if (parentElement) {
|
|
22
|
+
const { width, height } = parentElement.getBoundingClientRect();
|
|
23
|
+
setDimensions({ width, height });
|
|
24
|
+
}
|
|
25
|
+
}, []);
|
|
26
|
+
const debuncedHandleResize = React.useMemo(() => {
|
|
27
|
+
var _a;
|
|
28
|
+
(_a = debounced.current) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
29
|
+
debounced.current = debounce(handleResize, 200);
|
|
30
|
+
return debounced.current;
|
|
31
|
+
}, [handleResize]);
|
|
32
|
+
React.useImperativeHandle(forwardedRef, () => ({
|
|
33
|
+
reflow() {
|
|
34
|
+
debuncedHandleResize();
|
|
35
|
+
},
|
|
36
|
+
}), [debuncedHandleResize]);
|
|
37
|
+
React.useEffect(() => {
|
|
38
|
+
// dimensions initialize
|
|
39
|
+
debuncedHandleResize();
|
|
40
|
+
}, [debuncedHandleResize]);
|
|
41
|
+
React.useEffect(() => {
|
|
42
|
+
const selection = select(window);
|
|
43
|
+
// https://github.com/d3/d3-selection/blob/main/README.md#handling-events
|
|
44
|
+
const eventName = `resize.${getUniqId()}`;
|
|
45
|
+
selection.on(eventName, debuncedHandleResize);
|
|
46
|
+
return () => {
|
|
47
|
+
// https://d3js.org/d3-selection/events#selection_on
|
|
48
|
+
selection.on(eventName, null);
|
|
49
|
+
};
|
|
50
|
+
}, [debuncedHandleResize]);
|
|
51
|
+
React.useEffect(() => {
|
|
52
|
+
if (typeof onResize === 'function') {
|
|
53
|
+
onResize({ dimensions });
|
|
54
|
+
}
|
|
55
|
+
}, [dimensions, onResize]);
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
if (lang && i18nFactory.lang !== lang) {
|
|
58
|
+
i18nFactory.setLang(lang);
|
|
59
|
+
}
|
|
60
|
+
}, [lang]);
|
|
61
|
+
return (React.createElement("div", { ref: ref, style: {
|
|
62
|
+
width: (dimensions === null || dimensions === void 0 ? void 0 : dimensions.width) || '100%',
|
|
63
|
+
height: (dimensions === null || dimensions === void 0 ? void 0 : dimensions.height) || '100%',
|
|
64
|
+
position: 'relative',
|
|
65
|
+
} }, (dimensions === null || dimensions === void 0 ? void 0 : dimensions.height) && (dimensions === null || dimensions === void 0 ? void 0 : dimensions.width) && (React.createElement(ChartInner, { height: dimensions === null || dimensions === void 0 ? void 0 : dimensions.height, width: dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, data: data }))));
|
|
66
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BaseTextStyle, ChartAxis, ChartAxisType } from '../../types';
|
|
2
|
+
export declare const axisLabelsDefaults: {
|
|
3
|
+
margin: number;
|
|
4
|
+
padding: number;
|
|
5
|
+
fontSize: number;
|
|
6
|
+
maxWidth: number;
|
|
7
|
+
};
|
|
8
|
+
type AxisTitleDefaults = Required<ChartAxis['title']> & {
|
|
9
|
+
style: BaseTextStyle;
|
|
10
|
+
};
|
|
11
|
+
export declare const xAxisTitleDefaults: AxisTitleDefaults;
|
|
12
|
+
export declare const yAxisTitleDefaults: AxisTitleDefaults;
|
|
13
|
+
export declare const DEFAULT_AXIS_TYPE: ChartAxisType;
|
|
14
|
+
export {};
|