@gravity-ui/charts 1.46.0 → 1.47.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/dist/cjs/components/ChartInner/index.js +1 -0
- package/dist/cjs/components/ChartInner/useChartInnerProps.d.ts +1 -0
- package/dist/cjs/components/ChartInner/useChartInnerProps.js +13 -6
- package/dist/cjs/components/Legend/index.js +13 -14
- package/dist/cjs/components/Tooltip/index.js +22 -1
- package/dist/cjs/core/axes/x-axis.js +1 -1
- package/dist/cjs/core/axes/y-axis.js +1 -1
- package/dist/cjs/core/brush/index.d.ts +2 -0
- package/dist/cjs/core/brush/index.js +2 -0
- package/dist/cjs/{hooks/useBrush → core/brush}/types.d.ts +2 -2
- package/dist/cjs/{hooks/useBrush → core/brush}/utils.d.ts +1 -1
- package/dist/cjs/core/chart/index.d.ts +1 -0
- package/dist/cjs/core/chart/index.js +1 -0
- package/dist/cjs/core/chart/types.d.ts +8 -0
- package/dist/cjs/core/index.d.ts +3 -0
- package/dist/cjs/core/index.js +3 -0
- package/dist/cjs/core/layout/chart-dimensions.d.ts +1 -1
- package/dist/cjs/core/range-slider/index.d.ts +2 -0
- package/dist/cjs/core/range-slider/index.js +2 -0
- package/dist/cjs/core/range-slider/types.d.ts +4 -0
- package/dist/{esm/hooks/useRangeSlider → cjs/core/range-slider}/utils.d.ts +5 -5
- package/dist/{esm/hooks/useRangeSlider → cjs/core/range-slider}/utils.js +1 -1
- package/dist/cjs/core/scales/utils.d.ts +1 -1
- package/dist/cjs/core/scales/utils.js +1 -1
- package/dist/cjs/core/scales/x-scale.d.ts +2 -2
- package/dist/cjs/core/scales/x-scale.js +2 -2
- package/dist/cjs/core/scales/y-scale.js +69 -4
- package/dist/cjs/core/series/prepare-area.js +1 -1
- package/dist/cjs/core/series/prepare-bar-x.js +1 -1
- package/dist/cjs/core/series/prepare-bar-y.js +1 -1
- package/dist/cjs/core/series/prepare-funnel.js +1 -1
- package/dist/cjs/core/series/prepare-heatmap.js +1 -1
- package/dist/cjs/core/series/prepare-legend.d.ts +1 -1
- package/dist/cjs/core/series/prepare-legend.js +2 -2
- package/dist/cjs/core/series/prepare-line.js +1 -1
- package/dist/cjs/core/series/prepare-pie.js +1 -1
- package/dist/cjs/core/series/prepare-radar.js +1 -1
- package/dist/cjs/core/series/prepare-sankey.js +1 -1
- package/dist/cjs/core/series/prepare-scatter.js +1 -1
- package/dist/cjs/core/series/prepare-treemap.js +1 -1
- package/dist/cjs/core/series/prepare-waterfall.js +1 -1
- package/dist/cjs/core/series/prepare-x-range.js +1 -1
- package/dist/cjs/core/series/prepareSeries.d.ts +7 -1
- package/dist/cjs/core/series/prepareSeries.js +31 -0
- package/dist/cjs/core/series/types.d.ts +5 -0
- package/dist/cjs/core/series/utils.d.ts +4 -0
- package/dist/cjs/core/series/utils.js +9 -1
- package/dist/cjs/{hooks/useShapes/annotation/index.d.ts → core/shapes/annotation.d.ts} +1 -7
- package/dist/cjs/{hooks/useShapes/annotation/index.js → core/shapes/annotation.js} +2 -2
- package/dist/cjs/{hooks/useShapes → core/shapes}/area/prepare-data.d.ts +4 -4
- package/dist/cjs/{hooks/useShapes → core/shapes}/area/prepare-data.js +9 -4
- package/dist/cjs/core/shapes/area/renderer.d.ts +11 -0
- package/dist/cjs/core/shapes/area/renderer.js +175 -0
- package/dist/cjs/{hooks/useShapes → core/shapes}/area/types.d.ts +7 -8
- package/dist/{esm/hooks/useShapes → cjs/core/shapes}/bar-x/prepare-data.d.ts +4 -4
- package/dist/{esm/hooks/useShapes → cjs/core/shapes}/bar-x/prepare-data.js +6 -6
- package/dist/cjs/core/shapes/bar-x/renderer.d.ts +9 -0
- package/dist/cjs/core/shapes/bar-x/renderer.js +104 -0
- package/dist/cjs/{hooks/useShapes → core/shapes}/bar-x/types.d.ts +1 -2
- package/dist/{esm/hooks/useShapes → cjs/core/shapes}/bar-y/prepare-data.d.ts +3 -3
- package/dist/{esm/hooks/useShapes → cjs/core/shapes}/bar-y/prepare-data.js +3 -3
- package/dist/cjs/core/shapes/bar-y/renderer.d.ts +6 -0
- package/dist/cjs/core/shapes/bar-y/renderer.js +74 -0
- package/dist/cjs/{hooks/useShapes → core/shapes}/bar-y/types.d.ts +1 -1
- package/dist/cjs/{hooks/useShapes → core/shapes}/bar-y/utils.js +1 -1
- package/dist/cjs/core/shapes/data-labels.d.ts +15 -0
- package/dist/cjs/core/shapes/data-labels.js +15 -0
- package/dist/cjs/{hooks/useShapes → core/shapes}/funnel/prepare-data.d.ts +1 -1
- package/dist/{esm/hooks/useShapes → cjs/core/shapes}/funnel/prepare-data.js +1 -1
- package/dist/cjs/core/shapes/funnel/renderer.d.ts +6 -0
- package/dist/cjs/core/shapes/funnel/renderer.js +74 -0
- package/dist/cjs/{hooks/useShapes → core/shapes}/funnel/types.d.ts +2 -2
- package/dist/cjs/{hooks/useShapes → core/shapes}/heatmap/prepare-data.d.ts +3 -3
- package/dist/cjs/{hooks/useShapes → core/shapes}/heatmap/prepare-data.js +3 -2
- package/dist/cjs/core/shapes/heatmap/renderer.d.ts +6 -0
- package/dist/cjs/core/shapes/heatmap/renderer.js +50 -0
- package/dist/{esm/hooks/useShapes → cjs/core/shapes}/heatmap/types.d.ts +2 -1
- package/dist/{esm/hooks/useShapes → cjs/core/shapes}/line/prepare-data.d.ts +4 -4
- package/dist/cjs/{hooks/useShapes → core/shapes}/line/prepare-data.js +12 -4
- package/dist/cjs/core/shapes/line/renderer.d.ts +11 -0
- package/dist/cjs/core/shapes/line/renderer.js +161 -0
- package/dist/{esm/hooks/useShapes → cjs/core/shapes}/line/types.d.ts +7 -8
- package/dist/cjs/core/shapes/marker.d.ts +45 -0
- package/dist/{esm/hooks/useShapes → cjs/core/shapes}/marker.js +2 -2
- package/dist/cjs/{hooks/useShapes → core/shapes}/pie/prepare-data.d.ts +1 -1
- package/dist/cjs/{hooks/useShapes → core/shapes}/pie/prepare-data.js +3 -3
- package/dist/cjs/core/shapes/pie/renderer.d.ts +8 -0
- package/dist/cjs/core/shapes/pie/renderer.js +160 -0
- package/dist/cjs/{hooks/useShapes → core/shapes}/pie/types.d.ts +1 -1
- package/dist/cjs/{hooks/useShapes → core/shapes}/radar/prepare-data.d.ts +1 -1
- package/dist/{esm/hooks/useShapes → cjs/core/shapes}/radar/prepare-data.js +2 -2
- package/dist/cjs/core/shapes/radar/renderer.d.ts +6 -0
- package/dist/cjs/core/shapes/radar/renderer.js +122 -0
- package/dist/cjs/{hooks/useShapes → core/shapes}/radar/types.d.ts +1 -1
- package/dist/cjs/{hooks/useShapes → core/shapes}/sankey/prepare-data.d.ts +1 -1
- package/dist/cjs/{hooks/useShapes → core/shapes}/sankey/prepare-data.js +1 -1
- package/dist/cjs/core/shapes/sankey/renderer.d.ts +6 -0
- package/dist/cjs/core/shapes/sankey/renderer.js +44 -0
- package/dist/{esm/hooks/useShapes → cjs/core/shapes}/sankey/types.d.ts +1 -1
- package/dist/{esm/hooks/useShapes → cjs/core/shapes}/scatter/prepare-data.d.ts +3 -3
- package/dist/cjs/{hooks/useShapes → core/shapes}/scatter/prepare-data.js +2 -2
- package/dist/cjs/core/shapes/scatter/renderer.d.ts +6 -0
- package/dist/cjs/core/shapes/scatter/renderer.js +52 -0
- package/dist/cjs/{hooks/useShapes → core/shapes}/scatter/types.d.ts +1 -1
- package/dist/cjs/{hooks/useShapes → core/shapes}/treemap/prepare-data.d.ts +1 -1
- package/dist/{esm/hooks/useShapes → cjs/core/shapes}/treemap/prepare-data.js +3 -3
- package/dist/cjs/core/shapes/treemap/renderer.d.ts +6 -0
- package/dist/cjs/core/shapes/treemap/renderer.js +88 -0
- package/dist/cjs/{hooks/useShapes → core/shapes}/treemap/types.d.ts +1 -1
- package/dist/cjs/core/shapes/utils.d.ts +76 -0
- package/dist/cjs/core/shapes/utils.js +186 -0
- package/dist/cjs/{hooks/useShapes → core/shapes}/waterfall/prepare-data.d.ts +3 -3
- package/dist/{esm/hooks/useShapes → cjs/core/shapes}/waterfall/prepare-data.js +4 -4
- package/dist/cjs/core/shapes/waterfall/renderer.d.ts +6 -0
- package/dist/cjs/core/shapes/waterfall/renderer.js +109 -0
- package/dist/cjs/{hooks/useShapes → core/shapes}/waterfall/types.d.ts +1 -1
- package/dist/cjs/{hooks/useShapes → core/shapes}/x-range/prepare-data.d.ts +3 -3
- package/dist/cjs/{hooks/useShapes → core/shapes}/x-range/prepare-data.js +4 -4
- package/dist/cjs/core/shapes/x-range/renderer.d.ts +6 -0
- package/dist/cjs/core/shapes/x-range/renderer.js +88 -0
- package/dist/cjs/{hooks/useShapes → core/shapes}/x-range/types.d.ts +1 -1
- package/dist/cjs/core/types/chart/area.d.ts +0 -1
- package/dist/cjs/core/types/chart/axis.d.ts +0 -1
- package/dist/cjs/core/types/chart/base.d.ts +18 -7
- package/dist/cjs/core/types/chart/tooltip.d.ts +3 -3
- package/dist/cjs/core/types/formatter.d.ts +1 -40
- package/dist/{esm/hooks/utils/get-band-size.js → cjs/core/utils/band-size.js} +1 -1
- package/dist/cjs/{hooks → core}/utils/bar-y.d.ts +3 -3
- package/dist/{esm/hooks → cjs/core}/utils/bar-y.js +4 -4
- package/dist/cjs/core/utils/format.d.ts +2 -2
- package/dist/cjs/core/utils/get-closest-data.d.ts +1 -1
- package/dist/cjs/core/utils/get-closest-data.js +13 -8
- package/dist/cjs/core/utils/series/sorting.js +1 -1
- package/dist/cjs/core/utils/text.d.ts +0 -1
- package/dist/cjs/core/utils/text.js +0 -1
- package/dist/cjs/core/zoom/index.d.ts +2 -0
- package/dist/cjs/core/zoom/index.js +2 -0
- package/dist/{esm/hooks/useZoom → cjs/core/zoom}/utils.d.ts +3 -3
- package/dist/{esm/hooks/useZoom → cjs/core/zoom}/utils.js +1 -1
- package/dist/cjs/core/zoom/zoom.d.ts +3 -3
- package/dist/cjs/hooks/index.d.ts +3 -3
- package/dist/cjs/hooks/index.js +3 -3
- package/dist/cjs/hooks/types.d.ts +2 -8
- package/dist/cjs/hooks/useBrush/index.d.ts +1 -1
- package/dist/cjs/hooks/useBrush/index.js +1 -1
- package/dist/cjs/hooks/useRangeSlider/index.js +3 -3
- package/dist/cjs/hooks/useRangeSlider/types.d.ts +6 -8
- package/dist/cjs/hooks/useShapes/area/index.d.ts +2 -2
- package/dist/cjs/hooks/useShapes/area/index.js +13 -185
- package/dist/cjs/hooks/useShapes/bar-x/index.d.ts +4 -4
- package/dist/cjs/hooks/useShapes/bar-x/index.js +10 -119
- package/dist/cjs/hooks/useShapes/bar-y/index.d.ts +3 -3
- package/dist/cjs/hooks/useShapes/bar-y/index.js +5 -84
- package/dist/cjs/hooks/useShapes/funnel/index.d.ts +4 -4
- package/dist/cjs/hooks/useShapes/funnel/index.js +4 -83
- package/dist/cjs/hooks/useShapes/heatmap/index.d.ts +4 -4
- package/dist/cjs/hooks/useShapes/heatmap/index.js +4 -59
- package/dist/cjs/hooks/useShapes/index.d.ts +15 -16
- package/dist/cjs/hooks/useShapes/index.js +13 -13
- package/dist/cjs/hooks/useShapes/line/index.d.ts +2 -2
- package/dist/cjs/hooks/useShapes/line/index.js +14 -172
- package/dist/cjs/hooks/useShapes/pie/index.d.ts +3 -5
- package/dist/cjs/hooks/useShapes/pie/index.js +3 -158
- package/dist/cjs/hooks/useShapes/radar/index.d.ts +2 -2
- package/dist/cjs/hooks/useShapes/radar/index.js +2 -121
- package/dist/cjs/hooks/useShapes/sankey/index.d.ts +2 -2
- package/dist/cjs/hooks/useShapes/sankey/index.js +2 -51
- package/dist/cjs/hooks/useShapes/scatter/index.d.ts +3 -3
- package/dist/cjs/hooks/useShapes/scatter/index.js +3 -58
- package/dist/cjs/hooks/useShapes/treemap/index.d.ts +2 -2
- package/dist/cjs/hooks/useShapes/treemap/index.js +2 -88
- package/dist/cjs/hooks/useShapes/utils.d.ts +3 -53
- package/dist/cjs/hooks/useShapes/utils.js +3 -140
- package/dist/cjs/hooks/useShapes/waterfall/index.d.ts +4 -4
- package/dist/cjs/hooks/useShapes/waterfall/index.js +6 -119
- package/dist/cjs/hooks/useShapes/x-range/index.d.ts +4 -4
- package/dist/cjs/hooks/useShapes/x-range/index.js +3 -98
- package/dist/cjs/hooks/useZoom/index.d.ts +1 -1
- package/dist/cjs/hooks/useZoom/index.js +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/libs/format-number/index.js +82 -14
- package/dist/cjs/libs/format-number/presets.d.ts +40 -0
- package/dist/cjs/libs/format-number/presets.js +66 -0
- package/dist/cjs/libs/format-number/types.d.ts +82 -3
- package/dist/cjs/setup-jsdom.js +7 -0
- package/dist/esm/components/ChartInner/index.js +1 -0
- package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +1 -0
- package/dist/esm/components/ChartInner/useChartInnerProps.js +13 -6
- package/dist/esm/components/Legend/index.js +13 -14
- package/dist/esm/components/Tooltip/index.js +22 -1
- package/dist/esm/core/axes/x-axis.js +1 -1
- package/dist/esm/core/axes/y-axis.js +1 -1
- package/dist/esm/core/brush/index.d.ts +2 -0
- package/dist/esm/core/brush/index.js +2 -0
- package/dist/esm/{hooks/useBrush → core/brush}/types.d.ts +2 -2
- package/dist/esm/{hooks/useBrush → core/brush}/utils.d.ts +1 -1
- package/dist/esm/core/chart/index.d.ts +1 -0
- package/dist/esm/core/chart/index.js +1 -0
- package/dist/esm/core/chart/types.d.ts +8 -0
- package/dist/esm/core/index.d.ts +3 -0
- package/dist/esm/core/index.js +3 -0
- package/dist/esm/core/layout/chart-dimensions.d.ts +1 -1
- package/dist/esm/core/range-slider/index.d.ts +2 -0
- package/dist/esm/core/range-slider/index.js +2 -0
- package/dist/esm/core/range-slider/types.d.ts +4 -0
- package/dist/{cjs/hooks/useRangeSlider → esm/core/range-slider}/utils.d.ts +5 -5
- package/dist/{cjs/hooks/useRangeSlider → esm/core/range-slider}/utils.js +1 -1
- package/dist/esm/core/scales/utils.d.ts +1 -1
- package/dist/esm/core/scales/utils.js +1 -1
- package/dist/esm/core/scales/x-scale.d.ts +2 -2
- package/dist/esm/core/scales/x-scale.js +2 -2
- package/dist/esm/core/scales/y-scale.js +69 -4
- package/dist/esm/core/series/prepare-area.js +1 -1
- package/dist/esm/core/series/prepare-bar-x.js +1 -1
- package/dist/esm/core/series/prepare-bar-y.js +1 -1
- package/dist/esm/core/series/prepare-funnel.js +1 -1
- package/dist/esm/core/series/prepare-heatmap.js +1 -1
- package/dist/esm/core/series/prepare-legend.d.ts +1 -1
- package/dist/esm/core/series/prepare-legend.js +2 -2
- package/dist/esm/core/series/prepare-line.js +1 -1
- package/dist/esm/core/series/prepare-pie.js +1 -1
- package/dist/esm/core/series/prepare-radar.js +1 -1
- package/dist/esm/core/series/prepare-sankey.js +1 -1
- package/dist/esm/core/series/prepare-scatter.js +1 -1
- package/dist/esm/core/series/prepare-treemap.js +1 -1
- package/dist/esm/core/series/prepare-waterfall.js +1 -1
- package/dist/esm/core/series/prepare-x-range.js +1 -1
- package/dist/esm/core/series/prepareSeries.d.ts +7 -1
- package/dist/esm/core/series/prepareSeries.js +31 -0
- package/dist/esm/core/series/types.d.ts +5 -0
- package/dist/esm/core/series/utils.d.ts +4 -0
- package/dist/esm/core/series/utils.js +9 -1
- package/dist/esm/{hooks/useShapes/annotation/index.d.ts → core/shapes/annotation.d.ts} +1 -7
- package/dist/esm/{hooks/useShapes/annotation/index.js → core/shapes/annotation.js} +2 -2
- package/dist/esm/{hooks/useShapes → core/shapes}/area/prepare-data.d.ts +4 -4
- package/dist/esm/{hooks/useShapes → core/shapes}/area/prepare-data.js +9 -4
- package/dist/esm/core/shapes/area/renderer.d.ts +11 -0
- package/dist/esm/core/shapes/area/renderer.js +175 -0
- package/dist/esm/{hooks/useShapes → core/shapes}/area/types.d.ts +7 -8
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/bar-x/prepare-data.d.ts +4 -4
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/bar-x/prepare-data.js +6 -6
- package/dist/esm/core/shapes/bar-x/renderer.d.ts +9 -0
- package/dist/esm/core/shapes/bar-x/renderer.js +104 -0
- package/dist/esm/{hooks/useShapes → core/shapes}/bar-x/types.d.ts +1 -2
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/bar-y/prepare-data.d.ts +3 -3
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/bar-y/prepare-data.js +3 -3
- package/dist/esm/core/shapes/bar-y/renderer.d.ts +6 -0
- package/dist/esm/core/shapes/bar-y/renderer.js +74 -0
- package/dist/esm/{hooks/useShapes → core/shapes}/bar-y/types.d.ts +1 -1
- package/dist/esm/{hooks/useShapes → core/shapes}/bar-y/utils.js +1 -1
- package/dist/esm/core/shapes/data-labels.d.ts +15 -0
- package/dist/esm/core/shapes/data-labels.js +15 -0
- package/dist/esm/{hooks/useShapes → core/shapes}/funnel/prepare-data.d.ts +1 -1
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/funnel/prepare-data.js +1 -1
- package/dist/esm/core/shapes/funnel/renderer.d.ts +6 -0
- package/dist/esm/core/shapes/funnel/renderer.js +74 -0
- package/dist/esm/{hooks/useShapes → core/shapes}/funnel/types.d.ts +2 -2
- package/dist/esm/{hooks/useShapes → core/shapes}/heatmap/prepare-data.d.ts +3 -3
- package/dist/esm/{hooks/useShapes → core/shapes}/heatmap/prepare-data.js +3 -2
- package/dist/esm/core/shapes/heatmap/renderer.d.ts +6 -0
- package/dist/esm/core/shapes/heatmap/renderer.js +50 -0
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/heatmap/types.d.ts +2 -1
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/line/prepare-data.d.ts +4 -4
- package/dist/esm/{hooks/useShapes → core/shapes}/line/prepare-data.js +12 -4
- package/dist/esm/core/shapes/line/renderer.d.ts +11 -0
- package/dist/esm/core/shapes/line/renderer.js +161 -0
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/line/types.d.ts +7 -8
- package/dist/esm/core/shapes/marker.d.ts +45 -0
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/marker.js +2 -2
- package/dist/esm/{hooks/useShapes → core/shapes}/pie/prepare-data.d.ts +1 -1
- package/dist/esm/{hooks/useShapes → core/shapes}/pie/prepare-data.js +3 -3
- package/dist/esm/core/shapes/pie/renderer.d.ts +8 -0
- package/dist/esm/core/shapes/pie/renderer.js +160 -0
- package/dist/esm/{hooks/useShapes → core/shapes}/pie/types.d.ts +1 -1
- package/dist/esm/{hooks/useShapes → core/shapes}/radar/prepare-data.d.ts +1 -1
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/radar/prepare-data.js +2 -2
- package/dist/esm/core/shapes/radar/renderer.d.ts +6 -0
- package/dist/esm/core/shapes/radar/renderer.js +122 -0
- package/dist/esm/{hooks/useShapes → core/shapes}/radar/types.d.ts +1 -1
- package/dist/esm/{hooks/useShapes → core/shapes}/sankey/prepare-data.d.ts +1 -1
- package/dist/esm/{hooks/useShapes → core/shapes}/sankey/prepare-data.js +1 -1
- package/dist/esm/core/shapes/sankey/renderer.d.ts +6 -0
- package/dist/esm/core/shapes/sankey/renderer.js +44 -0
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/sankey/types.d.ts +1 -1
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/scatter/prepare-data.d.ts +3 -3
- package/dist/esm/{hooks/useShapes → core/shapes}/scatter/prepare-data.js +2 -2
- package/dist/esm/core/shapes/scatter/renderer.d.ts +6 -0
- package/dist/esm/core/shapes/scatter/renderer.js +52 -0
- package/dist/esm/{hooks/useShapes → core/shapes}/scatter/types.d.ts +1 -1
- package/dist/esm/{hooks/useShapes → core/shapes}/treemap/prepare-data.d.ts +1 -1
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/treemap/prepare-data.js +3 -3
- package/dist/esm/core/shapes/treemap/renderer.d.ts +6 -0
- package/dist/esm/core/shapes/treemap/renderer.js +88 -0
- package/dist/esm/{hooks/useShapes → core/shapes}/treemap/types.d.ts +1 -1
- package/dist/esm/core/shapes/treemap/types.js +1 -0
- package/dist/esm/core/shapes/utils.d.ts +76 -0
- package/dist/esm/core/shapes/utils.js +186 -0
- package/dist/esm/{hooks/useShapes → core/shapes}/waterfall/prepare-data.d.ts +3 -3
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/waterfall/prepare-data.js +4 -4
- package/dist/esm/core/shapes/waterfall/renderer.d.ts +6 -0
- package/dist/esm/core/shapes/waterfall/renderer.js +109 -0
- package/dist/esm/{hooks/useShapes → core/shapes}/waterfall/types.d.ts +1 -1
- package/dist/esm/core/shapes/waterfall/types.js +1 -0
- package/dist/esm/{hooks/useShapes → core/shapes}/x-range/prepare-data.d.ts +3 -3
- package/dist/esm/{hooks/useShapes → core/shapes}/x-range/prepare-data.js +4 -4
- package/dist/esm/core/shapes/x-range/renderer.d.ts +6 -0
- package/dist/esm/core/shapes/x-range/renderer.js +88 -0
- package/dist/esm/{hooks/useShapes → core/shapes}/x-range/types.d.ts +1 -1
- package/dist/esm/core/shapes/x-range/types.js +1 -0
- package/dist/esm/core/types/chart/area.d.ts +0 -1
- package/dist/esm/core/types/chart/axis.d.ts +0 -1
- package/dist/esm/core/types/chart/base.d.ts +18 -7
- package/dist/esm/core/types/chart/tooltip.d.ts +3 -3
- package/dist/esm/core/types/formatter.d.ts +1 -40
- package/dist/{cjs/hooks/utils/get-band-size.js → esm/core/utils/band-size.js} +1 -1
- package/dist/esm/{hooks → core}/utils/bar-y.d.ts +3 -3
- package/dist/{cjs/hooks → esm/core}/utils/bar-y.js +4 -4
- package/dist/esm/core/utils/format.d.ts +2 -2
- package/dist/esm/core/utils/get-closest-data.d.ts +1 -1
- package/dist/esm/core/utils/get-closest-data.js +13 -8
- package/dist/esm/core/utils/series/sorting.js +1 -1
- package/dist/esm/core/utils/text.d.ts +0 -1
- package/dist/esm/core/utils/text.js +0 -1
- package/dist/esm/core/zoom/index.d.ts +2 -0
- package/dist/esm/core/zoom/index.js +2 -0
- package/dist/esm/core/zoom/types.js +1 -0
- package/dist/{cjs/hooks/useZoom → esm/core/zoom}/utils.d.ts +3 -3
- package/dist/{cjs/hooks/useZoom → esm/core/zoom}/utils.js +1 -1
- package/dist/esm/core/zoom/zoom.d.ts +3 -3
- package/dist/esm/hooks/index.d.ts +3 -3
- package/dist/esm/hooks/index.js +3 -3
- package/dist/esm/hooks/types.d.ts +2 -8
- package/dist/esm/hooks/useBrush/index.d.ts +1 -1
- package/dist/esm/hooks/useBrush/index.js +1 -1
- package/dist/esm/hooks/useRangeSlider/index.js +3 -3
- package/dist/esm/hooks/useRangeSlider/types.d.ts +6 -8
- package/dist/esm/hooks/useShapes/area/index.d.ts +2 -2
- package/dist/esm/hooks/useShapes/area/index.js +13 -185
- package/dist/esm/hooks/useShapes/bar-x/index.d.ts +4 -4
- package/dist/esm/hooks/useShapes/bar-x/index.js +10 -119
- package/dist/esm/hooks/useShapes/bar-y/index.d.ts +3 -3
- package/dist/esm/hooks/useShapes/bar-y/index.js +5 -84
- package/dist/esm/hooks/useShapes/funnel/index.d.ts +4 -4
- package/dist/esm/hooks/useShapes/funnel/index.js +4 -83
- package/dist/esm/hooks/useShapes/heatmap/index.d.ts +4 -4
- package/dist/esm/hooks/useShapes/heatmap/index.js +4 -59
- package/dist/esm/hooks/useShapes/index.d.ts +15 -16
- package/dist/esm/hooks/useShapes/index.js +13 -13
- package/dist/esm/hooks/useShapes/line/index.d.ts +2 -2
- package/dist/esm/hooks/useShapes/line/index.js +14 -172
- package/dist/esm/hooks/useShapes/pie/index.d.ts +3 -5
- package/dist/esm/hooks/useShapes/pie/index.js +3 -158
- package/dist/esm/hooks/useShapes/radar/index.d.ts +2 -2
- package/dist/esm/hooks/useShapes/radar/index.js +2 -121
- package/dist/esm/hooks/useShapes/sankey/index.d.ts +2 -2
- package/dist/esm/hooks/useShapes/sankey/index.js +2 -51
- package/dist/esm/hooks/useShapes/scatter/index.d.ts +3 -3
- package/dist/esm/hooks/useShapes/scatter/index.js +3 -58
- package/dist/esm/hooks/useShapes/treemap/index.d.ts +2 -2
- package/dist/esm/hooks/useShapes/treemap/index.js +2 -88
- package/dist/esm/hooks/useShapes/utils.d.ts +3 -53
- package/dist/esm/hooks/useShapes/utils.js +3 -140
- package/dist/esm/hooks/useShapes/waterfall/index.d.ts +4 -4
- package/dist/esm/hooks/useShapes/waterfall/index.js +6 -119
- package/dist/esm/hooks/useShapes/x-range/index.d.ts +4 -4
- package/dist/esm/hooks/useShapes/x-range/index.js +3 -98
- package/dist/esm/hooks/useZoom/index.d.ts +1 -1
- package/dist/esm/hooks/useZoom/index.js +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/libs/format-number/index.js +82 -14
- package/dist/esm/libs/format-number/presets.d.ts +40 -0
- package/dist/esm/libs/format-number/presets.js +66 -0
- package/dist/esm/libs/format-number/types.d.ts +82 -3
- package/dist/esm/setup-jsdom.js +7 -0
- package/package.json +5 -2
- package/dist/cjs/hooks/useSeries/index.d.ts +0 -12
- package/dist/cjs/hooks/useSeries/index.js +0 -40
- package/dist/cjs/hooks/useSeries/types.d.ts +0 -1
- package/dist/cjs/hooks/useSeries/types.js +0 -1
- package/dist/cjs/hooks/useSeries/utils.d.ts +0 -1
- package/dist/cjs/hooks/useSeries/utils.js +0 -1
- package/dist/cjs/hooks/useShapes/marker.d.ts +0 -15
- package/dist/cjs/hooks/utils/index.d.ts +0 -1
- package/dist/cjs/hooks/utils/index.js +0 -1
- package/dist/esm/hooks/useSeries/index.d.ts +0 -12
- package/dist/esm/hooks/useSeries/index.js +0 -40
- package/dist/esm/hooks/useSeries/types.d.ts +0 -1
- package/dist/esm/hooks/useSeries/types.js +0 -1
- package/dist/esm/hooks/useSeries/utils.d.ts +0 -1
- package/dist/esm/hooks/useSeries/utils.js +0 -1
- package/dist/esm/hooks/useShapes/marker.d.ts +0 -15
- package/dist/esm/hooks/utils/index.d.ts +0 -1
- package/dist/esm/hooks/utils/index.js +0 -1
- /package/dist/cjs/{hooks/useBrush → core/brush}/types.js +0 -0
- /package/dist/cjs/{hooks/useBrush → core/brush}/utils.js +0 -0
- /package/dist/cjs/{hooks/useShapes/area → core/chart}/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes/bar-x → core/range-slider}/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes/bar-y → core/shapes/area}/types.js +0 -0
- /package/dist/cjs/{hooks/constants.d.ts → core/shapes/bar-constants.d.ts} +0 -0
- /package/dist/cjs/{hooks/constants.js → core/shapes/bar-constants.js} +0 -0
- /package/dist/cjs/{hooks/useShapes/funnel → core/shapes/bar-x}/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes/heatmap → core/shapes/bar-y}/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes → core/shapes}/bar-y/utils.d.ts +0 -0
- /package/dist/cjs/{hooks/useShapes/line → core/shapes/funnel}/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes/pie → core/shapes/heatmap}/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes/radar → core/shapes/line}/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes/sankey → core/shapes/pie}/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes → core/shapes}/pie/utils.d.ts +0 -0
- /package/dist/cjs/{hooks/useShapes → core/shapes}/pie/utils.js +0 -0
- /package/dist/cjs/{hooks/useShapes/scatter → core/shapes/radar}/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes → core/shapes}/sankey/sankey-layout.d.ts +0 -0
- /package/dist/cjs/{hooks/useShapes → core/shapes}/sankey/sankey-layout.js +0 -0
- /package/dist/cjs/{hooks/useShapes/treemap → core/shapes/sankey}/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes/waterfall → core/shapes/scatter}/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes/x-range → core/shapes/treemap}/types.js +0 -0
- /package/dist/cjs/{hooks/useZoom → core/shapes/waterfall}/types.js +0 -0
- /package/dist/{esm/hooks/useBrush → cjs/core/shapes/x-range}/types.js +0 -0
- /package/dist/cjs/{hooks/utils/get-band-size.d.ts → core/utils/band-size.d.ts} +0 -0
- /package/dist/cjs/{hooks/useZoom → core/zoom}/types.d.ts +0 -0
- /package/dist/{esm/hooks/useShapes/area → cjs/core/zoom}/types.js +0 -0
- /package/dist/esm/{hooks/useShapes/bar-x → core/brush}/types.js +0 -0
- /package/dist/esm/{hooks/useBrush → core/brush}/utils.js +0 -0
- /package/dist/esm/{hooks/useShapes/bar-y → core/chart}/types.js +0 -0
- /package/dist/esm/{hooks/useShapes/funnel → core/range-slider}/types.js +0 -0
- /package/dist/esm/{hooks/useShapes/heatmap → core/shapes/area}/types.js +0 -0
- /package/dist/esm/{hooks/constants.d.ts → core/shapes/bar-constants.d.ts} +0 -0
- /package/dist/esm/{hooks/constants.js → core/shapes/bar-constants.js} +0 -0
- /package/dist/esm/{hooks/useShapes/line → core/shapes/bar-x}/types.js +0 -0
- /package/dist/esm/{hooks/useShapes/pie → core/shapes/bar-y}/types.js +0 -0
- /package/dist/esm/{hooks/useShapes → core/shapes}/bar-y/utils.d.ts +0 -0
- /package/dist/esm/{hooks/useShapes/radar → core/shapes/funnel}/types.js +0 -0
- /package/dist/esm/{hooks/useShapes/sankey → core/shapes/heatmap}/types.js +0 -0
- /package/dist/esm/{hooks/useShapes/scatter → core/shapes/line}/types.js +0 -0
- /package/dist/esm/{hooks/useShapes/treemap → core/shapes/pie}/types.js +0 -0
- /package/dist/esm/{hooks/useShapes → core/shapes}/pie/utils.d.ts +0 -0
- /package/dist/esm/{hooks/useShapes → core/shapes}/pie/utils.js +0 -0
- /package/dist/esm/{hooks/useShapes/waterfall → core/shapes/radar}/types.js +0 -0
- /package/dist/esm/{hooks/useShapes → core/shapes}/sankey/sankey-layout.d.ts +0 -0
- /package/dist/esm/{hooks/useShapes → core/shapes}/sankey/sankey-layout.js +0 -0
- /package/dist/esm/{hooks/useShapes/x-range → core/shapes/sankey}/types.js +0 -0
- /package/dist/esm/{hooks/useZoom → core/shapes/scatter}/types.js +0 -0
- /package/dist/esm/{hooks/utils/get-band-size.d.ts → core/utils/band-size.d.ts} +0 -0
- /package/dist/esm/{hooks/useZoom → core/zoom}/types.d.ts +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Dispatch } from 'd3-dispatch';
|
|
3
|
-
import type { PreparedSeriesOptions } from '
|
|
4
|
-
import type { BarYShapesArgs } from '
|
|
5
|
-
export { prepareBarYData } from '
|
|
3
|
+
import type { PreparedSeriesOptions } from '../../../core/series/types';
|
|
4
|
+
import type { BarYShapesArgs } from '../../../core/shapes/bar-y/types';
|
|
5
|
+
export { prepareBarYData } from '../../../core/shapes/bar-y/prepare-data';
|
|
6
6
|
type Args = {
|
|
7
7
|
clipPathId: string;
|
|
8
8
|
htmlLayout: HTMLElement | null;
|
|
@@ -1,97 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { select } from 'd3-selection';
|
|
4
|
-
import get from 'lodash/get';
|
|
2
|
+
import { renderBarY } from '../../../core/shapes/bar-y/renderer';
|
|
5
3
|
import { block } from '../../../utils';
|
|
6
4
|
import { HtmlLayer } from '../HtmlLayer';
|
|
7
|
-
|
|
8
|
-
export { prepareBarYData } from './prepare-data';
|
|
5
|
+
export { prepareBarYData } from '../../../core/shapes/bar-y/prepare-data';
|
|
9
6
|
const b = block('bar-y');
|
|
10
7
|
export function BarYSeriesShapes(args) {
|
|
11
|
-
const { dispatcher, preparedData: {
|
|
12
|
-
const hoveredDataRef = React.useRef(null);
|
|
8
|
+
const { dispatcher, preparedData: { htmlElements }, seriesOptions, htmlLayout, clipPathId, } = args;
|
|
13
9
|
const ref = React.useRef(null);
|
|
14
10
|
React.useEffect(() => {
|
|
15
11
|
if (!ref.current) {
|
|
16
12
|
return () => { };
|
|
17
13
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const segmentSelection = svgElement
|
|
21
|
-
.selectAll(`path.${b('segment')}`)
|
|
22
|
-
.data(preparedData)
|
|
23
|
-
.join('path')
|
|
24
|
-
.attr('d', (d) => getAdjustedRectPath(d))
|
|
25
|
-
.attr('class', b('segment'))
|
|
26
|
-
.attr('x', (d) => d.x)
|
|
27
|
-
.attr('y', (d) => d.y)
|
|
28
|
-
.attr('height', (d) => d.height)
|
|
29
|
-
.attr('width', (d) => d.width)
|
|
30
|
-
.attr('fill', (d) => d.color)
|
|
31
|
-
.attr('opacity', (d) => d.data.opacity || null)
|
|
32
|
-
.attr('cursor', (d) => d.series.cursor);
|
|
33
|
-
const borderSelection = svgElement
|
|
34
|
-
.selectAll(`path.${b('segment-border')}`)
|
|
35
|
-
.data(preparedData.filter((d) => d.borderWidth > 0))
|
|
36
|
-
.join('path')
|
|
37
|
-
.attr('d', (d) => getAdjustedRectBorderPath(d))
|
|
38
|
-
.attr('class', b('segment-border'))
|
|
39
|
-
.attr('fill', (d) => d.borderColor)
|
|
40
|
-
.attr('fill-rule', 'evenodd')
|
|
41
|
-
.attr('opacity', (d) => d.data.opacity || null)
|
|
42
|
-
.attr('pointer-events', 'none');
|
|
43
|
-
const labelSelection = svgElement
|
|
44
|
-
.selectAll('text')
|
|
45
|
-
.data(dataLabels)
|
|
46
|
-
.join('text')
|
|
47
|
-
.html((d) => d.text)
|
|
48
|
-
.attr('class', b('label'))
|
|
49
|
-
.attr('x', (d) => d.x)
|
|
50
|
-
.attr('y', (d) => d.y)
|
|
51
|
-
.attr('text-anchor', (d) => d.textAnchor)
|
|
52
|
-
.style('font-size', (d) => d.style.fontSize)
|
|
53
|
-
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
54
|
-
.style('fill', (d) => d.style.fontColor || null);
|
|
55
|
-
const hoverOptions = get(seriesOptions, 'bar-y.states.hover');
|
|
56
|
-
const inactiveOptions = get(seriesOptions, 'bar-y.states.inactive');
|
|
57
|
-
function handleShapeHover(data) {
|
|
58
|
-
hoveredDataRef.current = data;
|
|
59
|
-
if (hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled) {
|
|
60
|
-
const hovered = data === null || data === void 0 ? void 0 : data.reduce((acc, d) => {
|
|
61
|
-
acc.add(d.data.y);
|
|
62
|
-
return acc;
|
|
63
|
-
}, new Set());
|
|
64
|
-
segmentSelection.attr('fill', (d) => {
|
|
65
|
-
var _a;
|
|
66
|
-
const fillColor = d.color;
|
|
67
|
-
if (hovered === null || hovered === void 0 ? void 0 : hovered.has(d.data.y)) {
|
|
68
|
-
return (((_a = color(fillColor)) === null || _a === void 0 ? void 0 : _a.brighter(hoverOptions.brightness).toString()) ||
|
|
69
|
-
fillColor);
|
|
70
|
-
}
|
|
71
|
-
return fillColor;
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
if (inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled) {
|
|
75
|
-
const hoveredSeries = data === null || data === void 0 ? void 0 : data.map((d) => d.series.id);
|
|
76
|
-
const newOpacity = (d) => {
|
|
77
|
-
if ((hoveredSeries === null || hoveredSeries === void 0 ? void 0 : hoveredSeries.length) && !hoveredSeries.includes(d.series.id)) {
|
|
78
|
-
return inactiveOptions.opacity || null;
|
|
79
|
-
}
|
|
80
|
-
return null;
|
|
81
|
-
};
|
|
82
|
-
segmentSelection.attr('opacity', newOpacity);
|
|
83
|
-
borderSelection.attr('opacity', newOpacity);
|
|
84
|
-
labelSelection.attr('opacity', newOpacity);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
if (hoveredDataRef.current !== null) {
|
|
88
|
-
handleShapeHover(hoveredDataRef.current);
|
|
89
|
-
}
|
|
90
|
-
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.bar-y', handleShapeHover);
|
|
91
|
-
return () => {
|
|
92
|
-
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.bar-y', null);
|
|
93
|
-
};
|
|
94
|
-
}, [dataLabels, dispatcher, preparedData, seriesOptions]);
|
|
14
|
+
return renderBarY({ plot: ref.current }, args.preparedData, seriesOptions, dispatcher);
|
|
15
|
+
}, [args.preparedData, dispatcher, seriesOptions]);
|
|
95
16
|
return (React.createElement(React.Fragment, null,
|
|
96
17
|
React.createElement("g", { ref: ref, className: b(), clipPath: `url(#${clipPathId})` }),
|
|
97
18
|
React.createElement(HtmlLayer, { preparedData: { htmlElements }, htmlLayout: htmlLayout })));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Dispatch } from 'd3-dispatch';
|
|
3
|
-
import type { PreparedSeriesOptions } from '
|
|
4
|
-
import type { PreparedFunnelData } from '
|
|
5
|
-
export { prepareFunnelData } from '
|
|
6
|
-
export * from '
|
|
3
|
+
import type { PreparedSeriesOptions } from '../../../core/series/types';
|
|
4
|
+
import type { PreparedFunnelData } from '../../../core/shapes/funnel/types';
|
|
5
|
+
export { prepareFunnelData } from '../../../core/shapes/funnel/prepare-data';
|
|
6
|
+
export * from '../../../core/shapes/funnel/types';
|
|
7
7
|
type Args = {
|
|
8
8
|
dispatcher?: Dispatch<object>;
|
|
9
9
|
preparedData: PreparedFunnelData;
|
|
@@ -1,96 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { select } from 'd3-selection';
|
|
4
|
-
import { getLineDashArray } from '../../../core/utils';
|
|
2
|
+
import { renderFunnel } from '../../../core/shapes/funnel/renderer';
|
|
5
3
|
import { block } from '../../../utils';
|
|
6
|
-
export { prepareFunnelData } from '
|
|
7
|
-
export * from '
|
|
4
|
+
export { prepareFunnelData } from '../../../core/shapes/funnel/prepare-data';
|
|
5
|
+
export * from '../../../core/shapes/funnel/types';
|
|
8
6
|
const b = block('funnel');
|
|
9
7
|
export const FunnelSeriesShapes = (args) => {
|
|
10
8
|
const { dispatcher, preparedData, seriesOptions } = args;
|
|
11
|
-
const hoveredDataRef = React.useRef(null);
|
|
12
9
|
const ref = React.useRef(null);
|
|
13
10
|
React.useEffect(() => {
|
|
14
|
-
var _a, _b;
|
|
15
11
|
if (!ref.current) {
|
|
16
12
|
return () => { };
|
|
17
13
|
}
|
|
18
|
-
|
|
19
|
-
const hoverOptions = (_b = (_a = seriesOptions.funnel) === null || _a === void 0 ? void 0 : _a.states) === null || _b === void 0 ? void 0 : _b.hover;
|
|
20
|
-
svgElement.selectAll('*').remove();
|
|
21
|
-
// funnel levels
|
|
22
|
-
const cellsSelection = svgElement
|
|
23
|
-
.selectAll('rect')
|
|
24
|
-
.data(preparedData.items)
|
|
25
|
-
.join('rect')
|
|
26
|
-
.attr('x', (d) => d.x)
|
|
27
|
-
.attr('y', (d) => d.y)
|
|
28
|
-
.attr('height', (d) => d.height)
|
|
29
|
-
.attr('width', (d) => d.width)
|
|
30
|
-
.attr('fill', (d) => d.color)
|
|
31
|
-
.attr('stroke', (d) => d.borderColor)
|
|
32
|
-
.attr('stroke-width', (d) => d.borderWidth);
|
|
33
|
-
// connectors
|
|
34
|
-
const connectorAreaClassName = b('connector-area');
|
|
35
|
-
svgElement
|
|
36
|
-
.selectAll(`.${connectorAreaClassName}`)
|
|
37
|
-
.data(preparedData.connectors)
|
|
38
|
-
.join('path')
|
|
39
|
-
.attr('d', (d) => d.areaPath.toString())
|
|
40
|
-
.attr('class', connectorAreaClassName)
|
|
41
|
-
.attr('fill', (d) => d.areaColor)
|
|
42
|
-
.attr('opacity', (d) => d.areaOpacity);
|
|
43
|
-
const connectorLineClassName = b('connector-line');
|
|
44
|
-
const connectorLines = svgElement
|
|
45
|
-
.selectAll(`.${connectorLineClassName}`)
|
|
46
|
-
.data(preparedData.connectors)
|
|
47
|
-
.join('g')
|
|
48
|
-
.attr('class', connectorLineClassName)
|
|
49
|
-
.attr('stroke', (d) => d.lineColor)
|
|
50
|
-
.attr('stroke-width', (d) => d.lineWidth)
|
|
51
|
-
.attr('stroke-dasharray', (d) => getLineDashArray(d.dashStyle, d.lineWidth))
|
|
52
|
-
.attr('fill', 'none')
|
|
53
|
-
.attr('opacity', (d) => d.lineOpacity);
|
|
54
|
-
connectorLines.append('path').attr('d', (d) => d.linePath[0].toString());
|
|
55
|
-
connectorLines.append('path').attr('d', (d) => d.linePath[1].toString());
|
|
56
|
-
// dataLabels
|
|
57
|
-
svgElement
|
|
58
|
-
.selectAll('text')
|
|
59
|
-
.data(preparedData.svgLabels)
|
|
60
|
-
.join('text')
|
|
61
|
-
.html((d) => d.text)
|
|
62
|
-
.attr('class', b('label'))
|
|
63
|
-
.attr('x', (d) => d.x)
|
|
64
|
-
.attr('y', (d) => d.y)
|
|
65
|
-
.style('font-size', (d) => d.style.fontSize)
|
|
66
|
-
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
67
|
-
.style('fill', (d) => d.style.fontColor || null);
|
|
68
|
-
function handleShapeHover(data) {
|
|
69
|
-
hoveredDataRef.current = data;
|
|
70
|
-
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
71
|
-
if (hoverEnabled) {
|
|
72
|
-
const hovered = data === null || data === void 0 ? void 0 : data.reduce((acc, d) => {
|
|
73
|
-
acc.add(d.data);
|
|
74
|
-
return acc;
|
|
75
|
-
}, new Set());
|
|
76
|
-
cellsSelection.attr('fill', (d) => {
|
|
77
|
-
var _a;
|
|
78
|
-
const fillColor = d.color;
|
|
79
|
-
if (hovered === null || hovered === void 0 ? void 0 : hovered.has(d.data)) {
|
|
80
|
-
return (((_a = color(fillColor)) === null || _a === void 0 ? void 0 : _a.brighter(hoverOptions.brightness).toString()) ||
|
|
81
|
-
fillColor);
|
|
82
|
-
}
|
|
83
|
-
return fillColor;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
if (hoveredDataRef.current !== null) {
|
|
88
|
-
handleShapeHover(hoveredDataRef.current);
|
|
89
|
-
}
|
|
90
|
-
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.funnel', handleShapeHover);
|
|
91
|
-
return () => {
|
|
92
|
-
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.funnel', null);
|
|
93
|
-
};
|
|
14
|
+
return renderFunnel({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
|
|
94
15
|
}, [dispatcher, preparedData, seriesOptions]);
|
|
95
16
|
return (React.createElement(React.Fragment, null,
|
|
96
17
|
React.createElement("g", { ref: ref, className: b() })));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Dispatch } from 'd3-dispatch';
|
|
3
|
-
import type { PreparedSeriesOptions } from '
|
|
4
|
-
import type { PreparedHeatmapData } from '
|
|
5
|
-
export { prepareHeatmapData } from '
|
|
6
|
-
export * from '
|
|
3
|
+
import type { PreparedSeriesOptions } from '../../../core/series/types';
|
|
4
|
+
import type { PreparedHeatmapData } from '../../../core/shapes/heatmap/types';
|
|
5
|
+
export { prepareHeatmapData } from '../../../core/shapes/heatmap/prepare-data';
|
|
6
|
+
export * from '../../../core/shapes/heatmap/types';
|
|
7
7
|
type Args = {
|
|
8
8
|
htmlLayout: HTMLElement | null;
|
|
9
9
|
preparedData: PreparedHeatmapData;
|
|
@@ -1,73 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { select } from 'd3-selection';
|
|
2
|
+
import { renderHeatmap } from '../../../core/shapes/heatmap/renderer';
|
|
4
3
|
import { block } from '../../../utils';
|
|
5
4
|
import { HtmlLayer } from '../HtmlLayer';
|
|
6
|
-
export { prepareHeatmapData } from '
|
|
7
|
-
export * from '
|
|
5
|
+
export { prepareHeatmapData } from '../../../core/shapes/heatmap/prepare-data';
|
|
6
|
+
export * from '../../../core/shapes/heatmap/types';
|
|
8
7
|
const b = block('heatmap');
|
|
9
8
|
export const HeatmapSeriesShapes = (args) => {
|
|
10
9
|
const { dispatcher, preparedData, seriesOptions, htmlLayout } = args;
|
|
11
|
-
const hoveredDataRef = React.useRef(null);
|
|
12
10
|
const ref = React.useRef(null);
|
|
13
11
|
React.useEffect(() => {
|
|
14
|
-
var _a, _b;
|
|
15
12
|
if (!ref.current) {
|
|
16
13
|
return () => { };
|
|
17
14
|
}
|
|
18
|
-
|
|
19
|
-
const hoverOptions = (_b = (_a = seriesOptions.heatmap) === null || _a === void 0 ? void 0 : _a.states) === null || _b === void 0 ? void 0 : _b.hover;
|
|
20
|
-
svgElement.selectAll('*').remove();
|
|
21
|
-
// heatmap cells
|
|
22
|
-
const cellsSelection = svgElement
|
|
23
|
-
.selectAll('rect')
|
|
24
|
-
.data(preparedData.items)
|
|
25
|
-
.join('rect')
|
|
26
|
-
.attr('x', (d) => d.x)
|
|
27
|
-
.attr('y', (d) => d.y)
|
|
28
|
-
.attr('height', (d) => d.height)
|
|
29
|
-
.attr('width', (d) => d.width)
|
|
30
|
-
.attr('fill', (d) => d.color)
|
|
31
|
-
.attr('stroke', (d) => d.borderColor)
|
|
32
|
-
.attr('stroke-width', (d) => d.borderWidth);
|
|
33
|
-
// dataLabels
|
|
34
|
-
svgElement
|
|
35
|
-
.selectAll('text')
|
|
36
|
-
.data(preparedData.labels)
|
|
37
|
-
.join('text')
|
|
38
|
-
.html((d) => d.text)
|
|
39
|
-
.attr('class', b('label'))
|
|
40
|
-
.attr('x', (d) => d.x)
|
|
41
|
-
.attr('y', (d) => d.y)
|
|
42
|
-
.style('font-size', (d) => d.style.fontSize)
|
|
43
|
-
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
44
|
-
.style('fill', (d) => d.style.fontColor || null);
|
|
45
|
-
function handleShapeHover(data) {
|
|
46
|
-
hoveredDataRef.current = data;
|
|
47
|
-
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
48
|
-
if (hoverEnabled) {
|
|
49
|
-
const hovered = data === null || data === void 0 ? void 0 : data.reduce((acc, d) => {
|
|
50
|
-
acc.add(d.data);
|
|
51
|
-
return acc;
|
|
52
|
-
}, new Set());
|
|
53
|
-
cellsSelection.attr('fill', (d) => {
|
|
54
|
-
var _a;
|
|
55
|
-
const fillColor = d.color;
|
|
56
|
-
if (hovered === null || hovered === void 0 ? void 0 : hovered.has(d.data)) {
|
|
57
|
-
return (((_a = color(fillColor)) === null || _a === void 0 ? void 0 : _a.brighter(hoverOptions.brightness).toString()) ||
|
|
58
|
-
fillColor);
|
|
59
|
-
}
|
|
60
|
-
return fillColor;
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (hoveredDataRef.current !== null) {
|
|
65
|
-
handleShapeHover(hoveredDataRef.current);
|
|
66
|
-
}
|
|
67
|
-
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.heatmap', handleShapeHover);
|
|
68
|
-
return () => {
|
|
69
|
-
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.heatmap', null);
|
|
70
|
-
};
|
|
15
|
+
return renderHeatmap({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
|
|
71
16
|
}, [dispatcher, preparedData, seriesOptions]);
|
|
72
17
|
return (React.createElement(React.Fragment, null,
|
|
73
18
|
React.createElement("g", { ref: ref, className: b() }),
|
|
@@ -3,23 +3,21 @@ import type { Dispatch } from 'd3-dispatch';
|
|
|
3
3
|
import type { SeriesType } from '../../core/constants';
|
|
4
4
|
import type { PreparedSplit } from '../../core/layout/split-types';
|
|
5
5
|
import type { ChartScale } from '../../core/scales/types';
|
|
6
|
+
import type { PreparedSeries, PreparedSeriesOptions } from '../../core/series/types';
|
|
7
|
+
import type { PreparedAreaData } from '../../core/shapes/area/types';
|
|
8
|
+
import type { PreparedBarXData } from '../../core/shapes/bar-x/types';
|
|
9
|
+
import type { PreparedBarYData } from '../../core/shapes/bar-y/types';
|
|
10
|
+
import type { PreparedFunnelData } from '../../core/shapes/funnel/types';
|
|
11
|
+
import type { PreparedHeatmapData } from '../../core/shapes/heatmap/types';
|
|
12
|
+
import type { PreparedLineData } from '../../core/shapes/line/types';
|
|
13
|
+
import type { PreparedPieData } from '../../core/shapes/pie/types';
|
|
14
|
+
import type { PreparedRadarData } from '../../core/shapes/radar/types';
|
|
15
|
+
import type { PreparedSankeyData } from '../../core/shapes/sankey/types';
|
|
16
|
+
import type { PreparedScatterData } from '../../core/shapes/scatter/types';
|
|
17
|
+
import type { PreparedWaterfallData } from '../../core/shapes/waterfall/types';
|
|
18
|
+
import type { PreparedXRangeData } from '../../core/shapes/x-range/types';
|
|
19
|
+
import type { ZoomState } from '../../core/zoom/types';
|
|
6
20
|
import type { PreparedXAxis, PreparedYAxis } from '../useAxis/types';
|
|
7
|
-
import type { PreparedSeries, PreparedSeriesOptions } from '../useSeries/types';
|
|
8
|
-
import type { ZoomState } from '../useZoom/types';
|
|
9
|
-
import type { PreparedAreaData } from './area/types';
|
|
10
|
-
import type { PreparedBarXData } from './bar-x';
|
|
11
|
-
import type { PreparedBarYData } from './bar-y/types';
|
|
12
|
-
import type { PreparedFunnelData } from './funnel';
|
|
13
|
-
import type { PreparedHeatmapData } from './heatmap';
|
|
14
|
-
import type { PreparedLineData } from './line/types';
|
|
15
|
-
import type { PreparedPieData } from './pie/types';
|
|
16
|
-
import type { PreparedRadarData } from './radar/types';
|
|
17
|
-
import type { PreparedSankeyData } from './sankey/types';
|
|
18
|
-
import type { PreparedScatterData } from './scatter/types';
|
|
19
|
-
export type { PreparedBarXData } from './bar-x';
|
|
20
|
-
export type { PreparedScatterData } from './scatter/types';
|
|
21
|
-
import type { PreparedWaterfallData } from './waterfall';
|
|
22
|
-
import type { PreparedXRangeData } from './x-range';
|
|
23
21
|
import './styles.css';
|
|
24
22
|
export type ShapeData = PreparedBarXData | PreparedBarYData | PreparedScatterData | PreparedLineData | PreparedPieData | PreparedAreaData | PreparedWaterfallData | PreparedSankeyData | PreparedRadarData | PreparedHeatmapData | PreparedFunnelData | PreparedXRangeData;
|
|
25
23
|
export type ClipPathBySeriesType = Partial<Record<SeriesType, boolean>>;
|
|
@@ -50,3 +48,4 @@ export declare const useShapes: (args: Args) => {
|
|
|
50
48
|
shapesData: ShapeData[];
|
|
51
49
|
shapesReady: boolean;
|
|
52
50
|
};
|
|
51
|
+
export {};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { group } from 'd3-array';
|
|
3
3
|
import { SERIES_TYPE } from '../../core/constants';
|
|
4
|
+
import { prepareAreaData } from '../../core/shapes/area/prepare-data';
|
|
5
|
+
import { prepareLineData } from '../../core/shapes/line/prepare-data';
|
|
6
|
+
import { preparePieData } from '../../core/shapes/pie/prepare-data';
|
|
7
|
+
import { prepareRadarData } from '../../core/shapes/radar/prepare-data';
|
|
8
|
+
import { prepareSankeyData } from '../../core/shapes/sankey/prepare-data';
|
|
9
|
+
import { prepareTreemapData } from '../../core/shapes/treemap/prepare-data';
|
|
4
10
|
import { getOnlyVisibleSeries } from '../../core/utils';
|
|
5
11
|
import { ChartError } from '../../libs';
|
|
6
12
|
import { AreaSeriesShapes } from './area';
|
|
7
|
-
import { prepareAreaData } from './area/prepare-data';
|
|
8
13
|
import { BarXSeriesShapes, prepareBarXData } from './bar-x';
|
|
9
14
|
import { BarYSeriesShapes, prepareBarYData } from './bar-y';
|
|
10
15
|
import { FunnelSeriesShapes, prepareFunnelData } from './funnel';
|
|
11
16
|
import { HeatmapSeriesShapes, prepareHeatmapData } from './heatmap';
|
|
12
17
|
import { LineSeriesShapes } from './line';
|
|
13
|
-
import { prepareLineData } from './line/prepare-data';
|
|
14
18
|
import { PieSeriesShapes } from './pie';
|
|
15
|
-
import { preparePieData } from './pie/prepare-data';
|
|
16
19
|
import { RadarSeriesShapes } from './radar';
|
|
17
|
-
import { prepareRadarData } from './radar/prepare-data';
|
|
18
20
|
import { SankeySeriesShape } from './sankey';
|
|
19
|
-
import { prepareSankeyData } from './sankey/prepare-data';
|
|
20
21
|
import { ScatterSeriesShape, prepareScatterData } from './scatter';
|
|
21
22
|
import { TreemapSeriesShape } from './treemap';
|
|
22
|
-
import { prepareTreemapData } from './treemap/prepare-data';
|
|
23
23
|
import { getSeriesClipPathId } from './utils';
|
|
24
24
|
import { WaterfallSeriesShapes, prepareWaterfallData } from './waterfall';
|
|
25
25
|
import { XRangeSeriesShapes, prepareXRangeData } from './x-range';
|
|
@@ -217,13 +217,13 @@ export async function getShapes(args) {
|
|
|
217
217
|
}
|
|
218
218
|
break;
|
|
219
219
|
}
|
|
220
|
-
case
|
|
220
|
+
case SERIES_TYPE.Funnel: {
|
|
221
221
|
const preparedData = await prepareFunnelData({
|
|
222
222
|
series: chartSeries,
|
|
223
223
|
boundsWidth,
|
|
224
224
|
boundsHeight,
|
|
225
225
|
});
|
|
226
|
-
shapes[index] = (React.createElement(FunnelSeriesShapes, { key:
|
|
226
|
+
shapes[index] = (React.createElement(FunnelSeriesShapes, { key: SERIES_TYPE.Funnel, dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
|
|
227
227
|
shapesData.splice(index, 0, preparedData);
|
|
228
228
|
break;
|
|
229
229
|
}
|
|
@@ -254,8 +254,8 @@ export async function getShapes(args) {
|
|
|
254
254
|
}
|
|
255
255
|
export const useShapes = (args) => {
|
|
256
256
|
const { boundsWidth, boundsHeight, clipPathId, clipPathBySeriesType, dispatcher, htmlLayout, isOutsideBounds = IS_OUTSIDE_BOUNDS, isRangeSlider, series, seriesOptions, split, xAxis, xScale, yAxis, yScale, zoomState, } = args;
|
|
257
|
-
const [
|
|
258
|
-
const [
|
|
257
|
+
const [shapesElements, setShapesElements] = React.useState([]);
|
|
258
|
+
const [shapesElementsData, setShapesElementsData] = React.useState([]);
|
|
259
259
|
const shapesReadyRef = React.useRef(false);
|
|
260
260
|
const countedRef = React.useRef(0);
|
|
261
261
|
React.useEffect(() => {
|
|
@@ -286,7 +286,7 @@ export const useShapes = (args) => {
|
|
|
286
286
|
if (countedRef.current === currentRun) {
|
|
287
287
|
shapesReadyRef.current = true;
|
|
288
288
|
setShapesElements(shapes);
|
|
289
|
-
|
|
289
|
+
setShapesElementsData(shapesData);
|
|
290
290
|
}
|
|
291
291
|
})();
|
|
292
292
|
}, [
|
|
@@ -308,8 +308,8 @@ export const useShapes = (args) => {
|
|
|
308
308
|
zoomState,
|
|
309
309
|
]);
|
|
310
310
|
return {
|
|
311
|
-
shapes:
|
|
312
|
-
shapesData:
|
|
311
|
+
shapes: shapesElements,
|
|
312
|
+
shapesData: shapesElementsData,
|
|
313
313
|
shapesReady: shapesReadyRef.current,
|
|
314
314
|
};
|
|
315
315
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Dispatch } from 'd3-dispatch';
|
|
3
|
-
import type { PreparedSeriesOptions } from '
|
|
4
|
-
import type { PreparedLineData } from '
|
|
3
|
+
import type { PreparedSeriesOptions } from '../../../core/series/types';
|
|
4
|
+
import type { PreparedLineData } from '../../../core/shapes/line/types';
|
|
5
5
|
type Args = {
|
|
6
6
|
boundsHeight: number;
|
|
7
7
|
boundsWidth: number;
|