@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,18 @@
|
|
|
1
|
+
export const axisLabelsDefaults = {
|
|
2
|
+
margin: 10,
|
|
3
|
+
padding: 10,
|
|
4
|
+
fontSize: 11,
|
|
5
|
+
maxWidth: 80,
|
|
6
|
+
};
|
|
7
|
+
const axisTitleDefaults = {
|
|
8
|
+
text: '',
|
|
9
|
+
margin: 0,
|
|
10
|
+
style: {
|
|
11
|
+
fontSize: '14px',
|
|
12
|
+
},
|
|
13
|
+
align: 'center',
|
|
14
|
+
maxRowCount: 1,
|
|
15
|
+
};
|
|
16
|
+
export const xAxisTitleDefaults = Object.assign(Object.assign({}, axisTitleDefaults), { margin: 4 });
|
|
17
|
+
export const yAxisTitleDefaults = Object.assign(Object.assign({}, axisTitleDefaults), { margin: 8 });
|
|
18
|
+
export const DEFAULT_AXIS_TYPE = 'linear';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChartLegend } from '../../types';
|
|
2
|
+
export declare const legendDefaults: {
|
|
3
|
+
align: Required<ChartLegend>["align"];
|
|
4
|
+
itemDistance: number;
|
|
5
|
+
margin: number;
|
|
6
|
+
itemStyle: {
|
|
7
|
+
fontSize: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare const CONTINUOUS_LEGEND_SIZE: {
|
|
11
|
+
height: number;
|
|
12
|
+
width: number;
|
|
13
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ChartSeriesOptions } from '../../types';
|
|
2
|
+
type DefaultBarXSeriesOptions = Partial<ChartSeriesOptions['bar-x']> & {
|
|
3
|
+
'bar-x': {
|
|
4
|
+
barMaxWidth: number;
|
|
5
|
+
barPadding: number;
|
|
6
|
+
groupPadding: number;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
type DefaultBarYSeriesOptions = Partial<ChartSeriesOptions['bar-x']> & {
|
|
10
|
+
'bar-y': {
|
|
11
|
+
barMaxWidth: number;
|
|
12
|
+
barPadding: number;
|
|
13
|
+
groupPadding: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
type DefaultWaterfallSeriesOptions = Partial<ChartSeriesOptions['waterfall']> & {
|
|
17
|
+
waterfall: {
|
|
18
|
+
barMaxWidth: number;
|
|
19
|
+
barPadding: number;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export type SeriesOptionsDefaults = Partial<ChartSeriesOptions> & DefaultBarXSeriesOptions & DefaultBarYSeriesOptions & DefaultWaterfallSeriesOptions;
|
|
23
|
+
export declare const seriesOptionsDefaults: SeriesOptionsDefaults;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
export const seriesOptionsDefaults = {
|
|
2
|
+
'bar-x': {
|
|
3
|
+
barMaxWidth: 50,
|
|
4
|
+
barPadding: 0.1,
|
|
5
|
+
groupPadding: 0.2,
|
|
6
|
+
states: {
|
|
7
|
+
hover: {
|
|
8
|
+
enabled: true,
|
|
9
|
+
brightness: 0.3,
|
|
10
|
+
},
|
|
11
|
+
inactive: {
|
|
12
|
+
enabled: false,
|
|
13
|
+
opacity: 0.5,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
'bar-y': {
|
|
18
|
+
barMaxWidth: 50,
|
|
19
|
+
barPadding: 0.1,
|
|
20
|
+
groupPadding: 0.2,
|
|
21
|
+
states: {
|
|
22
|
+
hover: {
|
|
23
|
+
enabled: true,
|
|
24
|
+
brightness: 0.3,
|
|
25
|
+
},
|
|
26
|
+
inactive: {
|
|
27
|
+
enabled: false,
|
|
28
|
+
opacity: 0.5,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
pie: {
|
|
33
|
+
states: {
|
|
34
|
+
hover: {
|
|
35
|
+
enabled: true,
|
|
36
|
+
brightness: 0.3,
|
|
37
|
+
},
|
|
38
|
+
inactive: {
|
|
39
|
+
enabled: false,
|
|
40
|
+
opacity: 0.5,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
scatter: {
|
|
45
|
+
states: {
|
|
46
|
+
hover: {
|
|
47
|
+
enabled: true,
|
|
48
|
+
brightness: 0.3,
|
|
49
|
+
},
|
|
50
|
+
inactive: {
|
|
51
|
+
enabled: false,
|
|
52
|
+
opacity: 0.5,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
line: {
|
|
57
|
+
states: {
|
|
58
|
+
hover: {
|
|
59
|
+
enabled: true,
|
|
60
|
+
brightness: 0.3,
|
|
61
|
+
},
|
|
62
|
+
inactive: {
|
|
63
|
+
enabled: false,
|
|
64
|
+
opacity: 0.5,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
area: {
|
|
69
|
+
states: {
|
|
70
|
+
hover: {
|
|
71
|
+
enabled: true,
|
|
72
|
+
brightness: 0.3,
|
|
73
|
+
},
|
|
74
|
+
inactive: {
|
|
75
|
+
enabled: false,
|
|
76
|
+
opacity: 0.5,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
treemap: {
|
|
81
|
+
states: {
|
|
82
|
+
hover: {
|
|
83
|
+
enabled: true,
|
|
84
|
+
brightness: 0.3,
|
|
85
|
+
},
|
|
86
|
+
inactive: {
|
|
87
|
+
enabled: false,
|
|
88
|
+
opacity: 0.5,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
waterfall: {
|
|
93
|
+
barMaxWidth: 50,
|
|
94
|
+
barPadding: 0.1,
|
|
95
|
+
states: {
|
|
96
|
+
hover: {
|
|
97
|
+
enabled: true,
|
|
98
|
+
brightness: 0.3,
|
|
99
|
+
},
|
|
100
|
+
inactive: {
|
|
101
|
+
enabled: false,
|
|
102
|
+
opacity: 0.5,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export * from './defaults';
|
|
2
|
+
export declare const SeriesType: {
|
|
3
|
+
readonly Area: "area";
|
|
4
|
+
readonly BarX: "bar-x";
|
|
5
|
+
readonly BarY: "bar-y";
|
|
6
|
+
readonly Line: "line";
|
|
7
|
+
readonly Pie: "pie";
|
|
8
|
+
readonly Scatter: "scatter";
|
|
9
|
+
readonly Treemap: "treemap";
|
|
10
|
+
readonly Waterfall: "waterfall";
|
|
11
|
+
};
|
|
12
|
+
export declare enum DashStyle {
|
|
13
|
+
Dash = "Dash",
|
|
14
|
+
DashDot = "DashDot",
|
|
15
|
+
Dot = "Dot",
|
|
16
|
+
LongDash = "LongDash",
|
|
17
|
+
LongDashDot = "LongDashDot",
|
|
18
|
+
LongDashDotDot = "LongDashDotDot",
|
|
19
|
+
ShortDash = "ShortDash",
|
|
20
|
+
ShortDashDot = "ShortDashDot",
|
|
21
|
+
ShortDashDotDot = "ShortDashDotDot",
|
|
22
|
+
ShortDot = "ShortDot",
|
|
23
|
+
Solid = "Solid"
|
|
24
|
+
}
|
|
25
|
+
export declare enum SymbolType {
|
|
26
|
+
Circle = "circle",
|
|
27
|
+
Diamond = "diamond",
|
|
28
|
+
Square = "square",
|
|
29
|
+
Triangle = "triangle",
|
|
30
|
+
TriangleDown = "triangle-down"
|
|
31
|
+
}
|
|
32
|
+
export declare enum LineCap {
|
|
33
|
+
Butt = "butt",
|
|
34
|
+
Round = "round",
|
|
35
|
+
Square = "square",
|
|
36
|
+
None = "none"
|
|
37
|
+
}
|
|
38
|
+
export declare enum LayoutAlgorithm {
|
|
39
|
+
Binary = "binary",
|
|
40
|
+
Dice = "dice",
|
|
41
|
+
Slice = "slice",
|
|
42
|
+
SliceDice = "slice-dice",
|
|
43
|
+
Squarify = "squarify"
|
|
44
|
+
}
|
|
45
|
+
export declare const DEFAULT_PALETTE: string[];
|
|
46
|
+
export declare const DEFAULT_AXIS_LABEL_FONT_SIZE = "11px";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export * from './defaults';
|
|
2
|
+
export const SeriesType = {
|
|
3
|
+
Area: 'area',
|
|
4
|
+
BarX: 'bar-x',
|
|
5
|
+
BarY: 'bar-y',
|
|
6
|
+
Line: 'line',
|
|
7
|
+
Pie: 'pie',
|
|
8
|
+
Scatter: 'scatter',
|
|
9
|
+
Treemap: 'treemap',
|
|
10
|
+
Waterfall: 'waterfall',
|
|
11
|
+
};
|
|
12
|
+
export var DashStyle;
|
|
13
|
+
(function (DashStyle) {
|
|
14
|
+
DashStyle["Dash"] = "Dash";
|
|
15
|
+
DashStyle["DashDot"] = "DashDot";
|
|
16
|
+
DashStyle["Dot"] = "Dot";
|
|
17
|
+
DashStyle["LongDash"] = "LongDash";
|
|
18
|
+
DashStyle["LongDashDot"] = "LongDashDot";
|
|
19
|
+
DashStyle["LongDashDotDot"] = "LongDashDotDot";
|
|
20
|
+
DashStyle["ShortDash"] = "ShortDash";
|
|
21
|
+
DashStyle["ShortDashDot"] = "ShortDashDot";
|
|
22
|
+
DashStyle["ShortDashDotDot"] = "ShortDashDotDot";
|
|
23
|
+
DashStyle["ShortDot"] = "ShortDot";
|
|
24
|
+
DashStyle["Solid"] = "Solid";
|
|
25
|
+
})(DashStyle || (DashStyle = {}));
|
|
26
|
+
export var SymbolType;
|
|
27
|
+
(function (SymbolType) {
|
|
28
|
+
SymbolType["Circle"] = "circle";
|
|
29
|
+
SymbolType["Diamond"] = "diamond";
|
|
30
|
+
SymbolType["Square"] = "square";
|
|
31
|
+
SymbolType["Triangle"] = "triangle";
|
|
32
|
+
SymbolType["TriangleDown"] = "triangle-down";
|
|
33
|
+
})(SymbolType || (SymbolType = {}));
|
|
34
|
+
export var LineCap;
|
|
35
|
+
(function (LineCap) {
|
|
36
|
+
LineCap["Butt"] = "butt";
|
|
37
|
+
LineCap["Round"] = "round";
|
|
38
|
+
LineCap["Square"] = "square";
|
|
39
|
+
LineCap["None"] = "none";
|
|
40
|
+
})(LineCap || (LineCap = {}));
|
|
41
|
+
export var LayoutAlgorithm;
|
|
42
|
+
(function (LayoutAlgorithm) {
|
|
43
|
+
LayoutAlgorithm["Binary"] = "binary";
|
|
44
|
+
LayoutAlgorithm["Dice"] = "dice";
|
|
45
|
+
LayoutAlgorithm["Slice"] = "slice";
|
|
46
|
+
LayoutAlgorithm["SliceDice"] = "slice-dice";
|
|
47
|
+
LayoutAlgorithm["Squarify"] = "squarify";
|
|
48
|
+
})(LayoutAlgorithm || (LayoutAlgorithm = {}));
|
|
49
|
+
export const DEFAULT_PALETTE = [
|
|
50
|
+
'#4DA2F1',
|
|
51
|
+
'#FF3D64',
|
|
52
|
+
'#8AD554',
|
|
53
|
+
'#FFC636',
|
|
54
|
+
'#FFB9DD',
|
|
55
|
+
'#84D1EE',
|
|
56
|
+
'#FF91A1',
|
|
57
|
+
'#54A520',
|
|
58
|
+
'#DB9100',
|
|
59
|
+
'#BA74B3',
|
|
60
|
+
'#1F68A9',
|
|
61
|
+
'#ED65A9',
|
|
62
|
+
'#0FA08D',
|
|
63
|
+
'#FF7E00',
|
|
64
|
+
'#E8B0A4',
|
|
65
|
+
'#52A6C5',
|
|
66
|
+
'#BE2443',
|
|
67
|
+
'#70C1AF',
|
|
68
|
+
'#FFB46C',
|
|
69
|
+
'#DCA3D7',
|
|
70
|
+
];
|
|
71
|
+
export const DEFAULT_AXIS_LABEL_FONT_SIZE = '11px';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './useChartDimensions';
|
|
2
|
+
export * from './useChartOptions';
|
|
3
|
+
export * from './useChartOptions/types';
|
|
4
|
+
export * from './useAxisScales';
|
|
5
|
+
export * from './useSeries';
|
|
6
|
+
export * from './useSeries/types';
|
|
7
|
+
export * from './useShapes';
|
|
8
|
+
export * from './useTooltip';
|
|
9
|
+
export * from './useTooltip/types';
|
|
10
|
+
export * from './useSplit/types';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './useChartDimensions';
|
|
2
|
+
export * from './useChartOptions';
|
|
3
|
+
export * from './useChartOptions/types';
|
|
4
|
+
export * from './useAxisScales';
|
|
5
|
+
export * from './useSeries';
|
|
6
|
+
export * from './useSeries/types';
|
|
7
|
+
export * from './useShapes';
|
|
8
|
+
export * from './useTooltip';
|
|
9
|
+
export * from './useTooltip/types';
|
|
10
|
+
export * from './useSplit/types';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ScaleBand, ScaleLinear, ScaleTime } from 'd3';
|
|
2
|
+
import type { ChartAxis, ChartSeries } from '../../types';
|
|
3
|
+
import type { PreparedAxis } from '../useChartOptions/types';
|
|
4
|
+
import type { PreparedSeries } from '../useSeries/types';
|
|
5
|
+
import type { PreparedSplit } from '../useSplit/types';
|
|
6
|
+
export type ChartScale = ScaleLinear<number, number> | ScaleBand<string> | ScaleTime<number, number>;
|
|
7
|
+
type Args = {
|
|
8
|
+
boundsWidth: number;
|
|
9
|
+
boundsHeight: number;
|
|
10
|
+
series: PreparedSeries[];
|
|
11
|
+
xAxis: PreparedAxis;
|
|
12
|
+
yAxis: PreparedAxis[];
|
|
13
|
+
split: PreparedSplit;
|
|
14
|
+
};
|
|
15
|
+
type ReturnValue = {
|
|
16
|
+
xScale?: ChartScale;
|
|
17
|
+
yScale?: ChartScale[];
|
|
18
|
+
};
|
|
19
|
+
export declare function createYScale(axis: PreparedAxis, series: PreparedSeries[], boundsHeight: number): ScaleBand<string> | ScaleLinear<number, number, never> | ScaleTime<number, number, never>;
|
|
20
|
+
export declare function createXScale(axis: PreparedAxis | ChartAxis, series: (PreparedSeries | ChartSeries)[], boundsWidth: number): ScaleBand<string> | ScaleLinear<number, number, never> | ScaleTime<number, number, never>;
|
|
21
|
+
/**
|
|
22
|
+
* Uses to create scales for axis related series
|
|
23
|
+
*/
|
|
24
|
+
export declare const useAxisScales: (args: Args) => ReturnValue;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { extent, scaleBand, scaleLinear, scaleLog, scaleUtc } from 'd3';
|
|
3
|
+
import get from 'lodash/get';
|
|
4
|
+
import { DEFAULT_AXIS_TYPE } from '../../constants';
|
|
5
|
+
import { CHART_SERIES_WITH_VOLUME_ON_Y_AXIS, getAxisHeight, getDataCategoryValue, getDefaultMaxXAxisValue, getDomainDataXBySeries, getDomainDataYBySeries, getOnlyVisibleSeries, isAxisRelatedSeries, isSeriesWithCategoryValues, } from '../../utils';
|
|
6
|
+
const isNumericalArrayData = (data) => {
|
|
7
|
+
return data.every((d) => typeof d === 'number' || d === null);
|
|
8
|
+
};
|
|
9
|
+
const filterCategoriesByVisibleSeries = (args) => {
|
|
10
|
+
const { axisDirection, categories, series } = args;
|
|
11
|
+
const visibleCategories = new Set();
|
|
12
|
+
series.forEach((s) => {
|
|
13
|
+
if (isSeriesWithCategoryValues(s)) {
|
|
14
|
+
s.data.forEach((d) => {
|
|
15
|
+
visibleCategories.add(getDataCategoryValue({ axisDirection, categories, data: d }));
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return categories.filter((c) => visibleCategories.has(c));
|
|
20
|
+
};
|
|
21
|
+
export function createYScale(axis, series, boundsHeight) {
|
|
22
|
+
const yType = get(axis, 'type', DEFAULT_AXIS_TYPE);
|
|
23
|
+
const yMin = get(axis, 'min');
|
|
24
|
+
const yCategories = get(axis, 'categories');
|
|
25
|
+
const yTimestamps = get(axis, 'timestamps');
|
|
26
|
+
switch (yType) {
|
|
27
|
+
case 'linear':
|
|
28
|
+
case 'logarithmic': {
|
|
29
|
+
const domain = getDomainDataYBySeries(series);
|
|
30
|
+
const range = [boundsHeight, boundsHeight * axis.maxPadding];
|
|
31
|
+
if (isNumericalArrayData(domain)) {
|
|
32
|
+
const [domainYMin, domainMax] = extent(domain);
|
|
33
|
+
const yMinValue = typeof yMin === 'number' ? yMin : domainYMin;
|
|
34
|
+
let yMaxValue = domainMax;
|
|
35
|
+
if (series.some((s) => CHART_SERIES_WITH_VOLUME_ON_Y_AXIS.includes(s.type))) {
|
|
36
|
+
yMaxValue = Math.max(yMaxValue, 0);
|
|
37
|
+
}
|
|
38
|
+
const scaleFn = yType === 'logarithmic' ? scaleLog : scaleLinear;
|
|
39
|
+
return scaleFn().domain([yMinValue, yMaxValue]).range(range).nice();
|
|
40
|
+
}
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
case 'category': {
|
|
44
|
+
if (yCategories) {
|
|
45
|
+
const filteredCategories = filterCategoriesByVisibleSeries({
|
|
46
|
+
axisDirection: 'y',
|
|
47
|
+
categories: yCategories,
|
|
48
|
+
series: series,
|
|
49
|
+
});
|
|
50
|
+
return scaleBand().domain(filteredCategories).range([boundsHeight, 0]);
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
case 'datetime': {
|
|
55
|
+
const range = [boundsHeight, boundsHeight * axis.maxPadding];
|
|
56
|
+
if (yTimestamps) {
|
|
57
|
+
const [yMin, yMax] = extent(yTimestamps);
|
|
58
|
+
return scaleUtc().domain([yMin, yMax]).range(range).nice();
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
const domain = getDomainDataYBySeries(series);
|
|
62
|
+
if (isNumericalArrayData(domain)) {
|
|
63
|
+
const [yMin, yMax] = extent(domain);
|
|
64
|
+
return scaleUtc().domain([yMin, yMax]).range(range).nice();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
throw new Error('Failed to create yScale');
|
|
71
|
+
}
|
|
72
|
+
function calculateXAxisPadding(series) {
|
|
73
|
+
let result = 0;
|
|
74
|
+
series.forEach((s) => {
|
|
75
|
+
switch (s.type) {
|
|
76
|
+
case 'bar-y': {
|
|
77
|
+
// Since labels can be located to the right of the bar, need to add an additional space
|
|
78
|
+
const inside = get(s, 'dataLabels.inside');
|
|
79
|
+
if (!inside) {
|
|
80
|
+
const labelsMaxWidth = get(s, 'dataLabels.maxWidth', 0);
|
|
81
|
+
result = Math.max(result, labelsMaxWidth);
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
export function createXScale(axis, series, boundsWidth) {
|
|
90
|
+
const xMin = get(axis, 'min');
|
|
91
|
+
const xMax = getDefaultMaxXAxisValue(series);
|
|
92
|
+
const xType = get(axis, 'type', DEFAULT_AXIS_TYPE);
|
|
93
|
+
const xCategories = get(axis, 'categories');
|
|
94
|
+
const xTimestamps = get(axis, 'timestamps');
|
|
95
|
+
const maxPadding = get(axis, 'maxPadding', 0);
|
|
96
|
+
const xAxisMinPadding = boundsWidth * maxPadding + calculateXAxisPadding(series);
|
|
97
|
+
const xRange = [0, boundsWidth - xAxisMinPadding];
|
|
98
|
+
switch (xType) {
|
|
99
|
+
case 'linear':
|
|
100
|
+
case 'logarithmic': {
|
|
101
|
+
const domain = getDomainDataXBySeries(series);
|
|
102
|
+
if (isNumericalArrayData(domain)) {
|
|
103
|
+
const [domainXMin, domainXMax] = extent(domain);
|
|
104
|
+
const xMinValue = typeof xMin === 'number' ? xMin : domainXMin;
|
|
105
|
+
const xMaxValue = typeof xMax === 'number' ? Math.max(xMax, domainXMax) : domainXMax;
|
|
106
|
+
const scaleFn = xType === 'logarithmic' ? scaleLog : scaleLinear;
|
|
107
|
+
return scaleFn().domain([xMinValue, xMaxValue]).range(xRange).nice();
|
|
108
|
+
}
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
case 'category': {
|
|
112
|
+
if (xCategories) {
|
|
113
|
+
const filteredCategories = filterCategoriesByVisibleSeries({
|
|
114
|
+
axisDirection: 'x',
|
|
115
|
+
categories: xCategories,
|
|
116
|
+
series: series,
|
|
117
|
+
});
|
|
118
|
+
const xScale = scaleBand().domain(filteredCategories).range([0, boundsWidth]);
|
|
119
|
+
if (xScale.step() / 2 < xAxisMinPadding) {
|
|
120
|
+
xScale.range(xRange);
|
|
121
|
+
}
|
|
122
|
+
return xScale;
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
case 'datetime': {
|
|
127
|
+
if (xTimestamps) {
|
|
128
|
+
const [xMin, xMax] = extent(xTimestamps);
|
|
129
|
+
return scaleUtc().domain([xMin, xMax]).range(xRange).nice();
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
const domain = getDomainDataXBySeries(series);
|
|
133
|
+
if (isNumericalArrayData(domain)) {
|
|
134
|
+
const [xMin, xMax] = extent(domain);
|
|
135
|
+
return scaleUtc().domain([xMin, xMax]).range(xRange).nice();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
throw new Error('Failed to create xScale');
|
|
142
|
+
}
|
|
143
|
+
const createScales = (args) => {
|
|
144
|
+
const { boundsWidth, boundsHeight, series, xAxis, yAxis, split } = args;
|
|
145
|
+
let visibleSeries = getOnlyVisibleSeries(series);
|
|
146
|
+
// Reassign to all series in case of all series unselected,
|
|
147
|
+
// otherwise we will get an empty space without grid
|
|
148
|
+
visibleSeries = visibleSeries.length === 0 ? series : visibleSeries;
|
|
149
|
+
return {
|
|
150
|
+
xScale: createXScale(xAxis, visibleSeries, boundsWidth),
|
|
151
|
+
yScale: yAxis.map((axis, index) => {
|
|
152
|
+
const axisSeries = series.filter((s) => {
|
|
153
|
+
const seriesAxisIndex = get(s, 'yAxis', 0);
|
|
154
|
+
return seriesAxisIndex === index;
|
|
155
|
+
});
|
|
156
|
+
const visibleAxisSeries = getOnlyVisibleSeries(axisSeries);
|
|
157
|
+
const axisHeight = getAxisHeight({ boundsHeight, split });
|
|
158
|
+
return createYScale(axis, visibleAxisSeries.length ? visibleAxisSeries : axisSeries, axisHeight);
|
|
159
|
+
}),
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Uses to create scales for axis related series
|
|
164
|
+
*/
|
|
165
|
+
export const useAxisScales = (args) => {
|
|
166
|
+
const { boundsWidth, boundsHeight, series, xAxis, yAxis, split } = args;
|
|
167
|
+
return React.useMemo(() => {
|
|
168
|
+
let xScale;
|
|
169
|
+
let yScale;
|
|
170
|
+
const hasAxisRelatedSeries = series.some(isAxisRelatedSeries);
|
|
171
|
+
if (hasAxisRelatedSeries) {
|
|
172
|
+
({ xScale, yScale } = createScales({
|
|
173
|
+
boundsWidth,
|
|
174
|
+
boundsHeight,
|
|
175
|
+
series,
|
|
176
|
+
xAxis,
|
|
177
|
+
yAxis,
|
|
178
|
+
split,
|
|
179
|
+
}));
|
|
180
|
+
}
|
|
181
|
+
return { xScale, yScale };
|
|
182
|
+
}, [boundsWidth, boundsHeight, series, xAxis, yAxis, split]);
|
|
183
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PreparedAxis, PreparedLegend, PreparedSeries } from '../../hooks';
|
|
2
|
+
import type { ChartMargin } from '../../types';
|
|
3
|
+
export { getBoundsWidth } from './utils';
|
|
4
|
+
type Args = {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
margin: ChartMargin;
|
|
8
|
+
preparedLegend: PreparedLegend;
|
|
9
|
+
preparedXAxis: PreparedAxis;
|
|
10
|
+
preparedYAxis: PreparedAxis[];
|
|
11
|
+
preparedSeries: PreparedSeries[];
|
|
12
|
+
};
|
|
13
|
+
export declare const useChartDimensions: (args: Args) => {
|
|
14
|
+
boundsWidth: number;
|
|
15
|
+
boundsHeight: number;
|
|
16
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { isAxisRelatedSeries } from '../../utils';
|
|
3
|
+
import { getBoundsWidth } from './utils';
|
|
4
|
+
export { getBoundsWidth } from './utils';
|
|
5
|
+
const getBottomOffset = (args) => {
|
|
6
|
+
const { hasAxisRelatedSeries, preparedLegend, preparedXAxis } = args;
|
|
7
|
+
let result = 0;
|
|
8
|
+
if (preparedLegend.enabled) {
|
|
9
|
+
result += preparedLegend.height + preparedLegend.margin;
|
|
10
|
+
}
|
|
11
|
+
if (hasAxisRelatedSeries) {
|
|
12
|
+
if (preparedXAxis.title.text) {
|
|
13
|
+
result += preparedXAxis.title.height + preparedXAxis.title.margin;
|
|
14
|
+
}
|
|
15
|
+
if (preparedXAxis.labels.enabled) {
|
|
16
|
+
result += preparedXAxis.labels.margin + preparedXAxis.labels.height;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
export const useChartDimensions = (args) => {
|
|
22
|
+
const { margin, width, height, preparedLegend, preparedXAxis, preparedYAxis, preparedSeries } = args;
|
|
23
|
+
return React.useMemo(() => {
|
|
24
|
+
const hasAxisRelatedSeries = preparedSeries.some(isAxisRelatedSeries);
|
|
25
|
+
const boundsWidth = getBoundsWidth({ chartWidth: width, chartMargin: margin, preparedYAxis });
|
|
26
|
+
const bottomOffset = getBottomOffset({
|
|
27
|
+
hasAxisRelatedSeries,
|
|
28
|
+
preparedLegend,
|
|
29
|
+
preparedXAxis,
|
|
30
|
+
});
|
|
31
|
+
const boundsHeight = height - margin.top - margin.bottom - bottomOffset;
|
|
32
|
+
return { boundsWidth, boundsHeight };
|
|
33
|
+
}, [margin, width, height, preparedLegend, preparedXAxis, preparedYAxis, preparedSeries]);
|
|
34
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PreparedAxis, PreparedChart } from '../../hooks';
|
|
2
|
+
export declare const getBoundsWidth: (args: {
|
|
3
|
+
chartWidth: number;
|
|
4
|
+
chartMargin: PreparedChart["margin"];
|
|
5
|
+
preparedYAxis: PreparedAxis[];
|
|
6
|
+
}) => number;
|
|
7
|
+
export declare function getYAxisWidth(axis: PreparedAxis | undefined): number;
|
|
8
|
+
export declare function getWidthOccupiedByYAxis(args: {
|
|
9
|
+
preparedAxis: PreparedAxis[];
|
|
10
|
+
}): number;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const getBoundsWidth = (args) => {
|
|
2
|
+
const { chartWidth, chartMargin, preparedYAxis } = args;
|
|
3
|
+
return (chartWidth -
|
|
4
|
+
chartMargin.right -
|
|
5
|
+
chartMargin.left -
|
|
6
|
+
getWidthOccupiedByYAxis({ preparedAxis: preparedYAxis }));
|
|
7
|
+
};
|
|
8
|
+
export function getYAxisWidth(axis) {
|
|
9
|
+
let result = 0;
|
|
10
|
+
if (axis === null || axis === void 0 ? void 0 : axis.title.text) {
|
|
11
|
+
result += axis.title.height + axis.title.margin;
|
|
12
|
+
}
|
|
13
|
+
if (axis === null || axis === void 0 ? void 0 : axis.labels.enabled) {
|
|
14
|
+
result += axis.labels.margin + axis.labels.width;
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
export function getWidthOccupiedByYAxis(args) {
|
|
19
|
+
const { preparedAxis } = args;
|
|
20
|
+
let leftAxisWidth = 0;
|
|
21
|
+
let rightAxisWidth = 0;
|
|
22
|
+
preparedAxis === null || preparedAxis === void 0 ? void 0 : preparedAxis.forEach((axis) => {
|
|
23
|
+
const axisWidth = getYAxisWidth(axis);
|
|
24
|
+
if (axis.position === 'right') {
|
|
25
|
+
rightAxisWidth = Math.max(rightAxisWidth, axisWidth);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
leftAxisWidth = Math.max(leftAxisWidth, axisWidth);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return leftAxisWidth + rightAxisWidth;
|
|
32
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import get from 'lodash/get';
|
|
2
|
+
const getMarginTop = (args) => {
|
|
3
|
+
const { chart, preparedTitle } = args;
|
|
4
|
+
let marginTop = get(chart, 'margin.top', 0);
|
|
5
|
+
if (preparedTitle === null || preparedTitle === void 0 ? void 0 : preparedTitle.height) {
|
|
6
|
+
marginTop += preparedTitle.height;
|
|
7
|
+
}
|
|
8
|
+
return marginTop;
|
|
9
|
+
};
|
|
10
|
+
const getMarginRight = (args) => {
|
|
11
|
+
const { chart } = args;
|
|
12
|
+
return get(chart, 'margin.right', 0);
|
|
13
|
+
};
|
|
14
|
+
export const getPreparedChart = (args) => {
|
|
15
|
+
const { chart, preparedTitle } = args;
|
|
16
|
+
const marginTop = getMarginTop({ chart, preparedTitle });
|
|
17
|
+
const marginBottom = get(chart, 'margin.bottom', 0);
|
|
18
|
+
const marginLeft = get(chart, 'margin.left', 0);
|
|
19
|
+
const marginRight = getMarginRight({ chart });
|
|
20
|
+
return {
|
|
21
|
+
margin: {
|
|
22
|
+
top: marginTop,
|
|
23
|
+
right: marginRight,
|
|
24
|
+
bottom: marginBottom,
|
|
25
|
+
left: marginLeft,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
};
|