@gravity-ui/charts 1.46.0 → 1.46.1
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/useChartInnerProps.js +1 -1
- 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/scales/utils.d.ts +1 -1
- package/dist/cjs/core/scales/utils.js +1 -1
- package/dist/cjs/core/scales/x-scale.js +2 -2
- package/dist/cjs/core/scales/y-scale.js +48 -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.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 +4 -4
- package/dist/cjs/core/shapes/area/renderer.d.ts +11 -0
- package/dist/cjs/core/shapes/area/renderer.js +181 -0
- package/dist/{esm/hooks/useShapes → cjs/core/shapes}/area/types.d.ts +1 -3
- 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 +110 -0
- package/dist/{esm/hooks/useShapes → cjs/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 +80 -0
- package/dist/cjs/{hooks/useShapes → core/shapes}/bar-y/types.d.ts +1 -1
- package/dist/{esm/hooks/useShapes → cjs/core/shapes}/bar-y/utils.js +1 -1
- package/dist/cjs/{hooks/useShapes → core/shapes}/funnel/prepare-data.d.ts +1 -1
- package/dist/cjs/{hooks/useShapes → 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 +79 -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/{esm/hooks/useShapes → cjs/core/shapes}/heatmap/prepare-data.js +2 -2
- package/dist/cjs/core/shapes/heatmap/renderer.d.ts +6 -0
- package/dist/cjs/core/shapes/heatmap/renderer.js +55 -0
- package/dist/{esm/hooks/useShapes → cjs/core/shapes}/heatmap/types.d.ts +1 -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 +3 -3
- package/dist/cjs/core/shapes/line/renderer.d.ts +11 -0
- package/dist/cjs/core/shapes/line/renderer.js +167 -0
- package/dist/cjs/{hooks/useShapes → core/shapes}/line/types.d.ts +2 -4
- 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/{esm/hooks/useShapes → cjs/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 +126 -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 +50 -0
- package/dist/cjs/{hooks/useShapes → 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/{esm/hooks/useShapes → cjs/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/{esm/hooks/useShapes → cjs/core/shapes}/scatter/types.d.ts +1 -1
- package/dist/cjs/{hooks/useShapes → core/shapes}/treemap/prepare-data.d.ts +1 -1
- package/dist/cjs/{hooks/useShapes → 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/{esm/hooks/useShapes → cjs/core/shapes}/treemap/types.d.ts +1 -1
- package/dist/cjs/core/shapes/utils.d.ts +52 -0
- package/dist/cjs/core/shapes/utils.js +138 -0
- package/dist/cjs/{hooks/useShapes → core/shapes}/waterfall/prepare-data.d.ts +3 -3
- package/dist/cjs/{hooks/useShapes → 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 +115 -0
- package/dist/{esm/hooks/useShapes → cjs/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 +94 -0
- package/dist/{esm/hooks/useShapes → cjs/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 +1 -4
- package/dist/cjs/{hooks/utils/get-band-size.js → core/utils/band-size.js} +1 -1
- package/dist/{esm/hooks → cjs/core}/utils/bar-y.d.ts +3 -3
- package/dist/cjs/{hooks → core}/utils/bar-y.js +4 -4
- package/dist/cjs/core/utils/get-closest-data.d.ts +1 -1
- 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/hooks/index.d.ts +1 -1
- package/dist/cjs/hooks/index.js +1 -1
- package/dist/cjs/hooks/useRangeSlider/types.d.ts +1 -1
- package/dist/cjs/hooks/useRangeSlider/utils.d.ts +1 -1
- 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 +14 -15
- 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 +2 -52
- 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/setup-jsdom.js +7 -0
- package/dist/esm/components/ChartInner/useChartInnerProps.js +1 -1
- 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/scales/utils.d.ts +1 -1
- package/dist/esm/core/scales/utils.js +1 -1
- package/dist/esm/core/scales/x-scale.js +2 -2
- package/dist/esm/core/scales/y-scale.js +48 -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.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 +4 -4
- package/dist/esm/core/shapes/area/renderer.d.ts +11 -0
- package/dist/esm/core/shapes/area/renderer.js +181 -0
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/area/types.d.ts +1 -3
- 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 +110 -0
- package/dist/{cjs/hooks/useShapes → esm/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 +80 -0
- package/dist/esm/{hooks/useShapes → core/shapes}/bar-y/types.d.ts +1 -1
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/bar-y/utils.js +1 -1
- package/dist/esm/{hooks/useShapes → core/shapes}/funnel/prepare-data.d.ts +1 -1
- package/dist/esm/{hooks/useShapes → 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 +79 -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/{cjs/hooks/useShapes → esm/core/shapes}/heatmap/prepare-data.js +2 -2
- package/dist/esm/core/shapes/heatmap/renderer.d.ts +6 -0
- package/dist/esm/core/shapes/heatmap/renderer.js +55 -0
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/heatmap/types.d.ts +1 -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 +3 -3
- package/dist/esm/core/shapes/line/renderer.d.ts +11 -0
- package/dist/esm/core/shapes/line/renderer.js +167 -0
- package/dist/esm/{hooks/useShapes → core/shapes}/line/types.d.ts +2 -4
- 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/{cjs/hooks/useShapes → esm/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 +126 -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 +50 -0
- package/dist/esm/{hooks/useShapes → 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/{cjs/hooks/useShapes → esm/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/{cjs/hooks/useShapes → esm/core/shapes}/scatter/types.d.ts +1 -1
- package/dist/esm/{hooks/useShapes → core/shapes}/treemap/prepare-data.d.ts +1 -1
- package/dist/esm/{hooks/useShapes → 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/{cjs/hooks/useShapes → esm/core/shapes}/treemap/types.d.ts +1 -1
- package/dist/esm/core/shapes/utils.d.ts +52 -0
- package/dist/esm/core/shapes/utils.js +138 -0
- package/dist/esm/{hooks/useShapes → core/shapes}/waterfall/prepare-data.d.ts +3 -3
- package/dist/esm/{hooks/useShapes → 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 +115 -0
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/waterfall/types.d.ts +1 -1
- 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 +94 -0
- package/dist/{cjs/hooks/useShapes → esm/core/shapes}/x-range/types.d.ts +1 -1
- 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 +1 -4
- package/dist/esm/{hooks/utils/get-band-size.js → core/utils/band-size.js} +1 -1
- package/dist/{cjs/hooks → esm/core}/utils/bar-y.d.ts +3 -3
- package/dist/esm/{hooks → core}/utils/bar-y.js +4 -4
- package/dist/esm/core/utils/get-closest-data.d.ts +1 -1
- 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/hooks/index.d.ts +1 -1
- package/dist/esm/hooks/index.js +1 -1
- package/dist/esm/hooks/useRangeSlider/types.d.ts +1 -1
- package/dist/esm/hooks/useRangeSlider/utils.d.ts +1 -1
- 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 +14 -15
- 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 +2 -52
- 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/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/useShapes → 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 → core/shapes}/bar-x/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes → 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 → core/shapes}/funnel/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes → core/shapes}/heatmap/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes → core/shapes}/line/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes → 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 → 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 → core/shapes}/sankey/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes → core/shapes}/scatter/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes → core/shapes}/treemap/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes → core/shapes}/waterfall/types.js +0 -0
- /package/dist/cjs/{hooks/useShapes → 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/esm/{hooks/useShapes → 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 → core/shapes}/bar-x/types.js +0 -0
- /package/dist/esm/{hooks/useShapes → 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 → core/shapes}/funnel/types.js +0 -0
- /package/dist/esm/{hooks/useShapes → core/shapes}/heatmap/types.js +0 -0
- /package/dist/esm/{hooks/useShapes → core/shapes}/line/types.js +0 -0
- /package/dist/esm/{hooks/useShapes → 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 → 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 → core/shapes}/sankey/types.js +0 -0
- /package/dist/esm/{hooks/useShapes → core/shapes}/scatter/types.js +0 -0
- /package/dist/esm/{hooks/useShapes → core/shapes}/treemap/types.js +0 -0
- /package/dist/esm/{hooks/useShapes → core/shapes}/waterfall/types.js +0 -0
- /package/dist/esm/{hooks/useShapes → core/shapes}/x-range/types.js +0 -0
- /package/dist/esm/{hooks/utils/get-band-size.d.ts → core/utils/band-size.d.ts} +0 -0
|
@@ -1,190 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { select } from 'd3-selection';
|
|
4
|
-
import { line as lineGenerator } from 'd3-shape';
|
|
5
|
-
import get from 'lodash/get';
|
|
6
|
-
import { getLineDashArray } from '../../../core/utils';
|
|
2
|
+
import { renderLine } from '../../../core/shapes/line/renderer';
|
|
7
3
|
import { block } from '../../../utils';
|
|
8
4
|
import { HtmlLayer } from '../HtmlLayer';
|
|
9
|
-
import { renderAnnotations } from '../annotation';
|
|
10
|
-
import { getMarkerHaloVisibility, getMarkerVisibility, renderMarker, selectMarkerHalo, selectMarkerSymbol, setMarker, } from '../marker';
|
|
11
|
-
import { setActiveState } from '../utils';
|
|
12
5
|
const b = block('line');
|
|
13
6
|
export const LineSeriesShapes = (args) => {
|
|
14
7
|
const { boundsHeight, boundsWidth, dispatcher, preparedData, seriesOptions, htmlLayout, clipPathId, } = args;
|
|
15
|
-
const hoveredDataRef = React.useRef(null);
|
|
16
8
|
const plotRef = React.useRef(null);
|
|
17
9
|
const markersRef = React.useRef(null);
|
|
18
10
|
const hoverMarkersRef = React.useRef(null);
|
|
19
11
|
const annotationsRef = React.useRef(null);
|
|
20
12
|
React.useEffect(() => {
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
if (!plotRef.current ||
|
|
14
|
+
!markersRef.current ||
|
|
15
|
+
!hoverMarkersRef.current ||
|
|
16
|
+
!annotationsRef.current) {
|
|
23
17
|
return () => { };
|
|
24
18
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
.y((d) => d.y);
|
|
34
|
-
plotSvgElement.selectAll('*').remove();
|
|
35
|
-
markersSvgElement.selectAll('*').remove();
|
|
36
|
-
const lineSelection = plotSvgElement
|
|
37
|
-
.selectAll('path')
|
|
38
|
-
.data(preparedData)
|
|
39
|
-
.join('path')
|
|
40
|
-
.attr('d', (d) => line(d.points))
|
|
41
|
-
.attr('fill', 'none')
|
|
42
|
-
.attr('stroke', (d) => d.color)
|
|
43
|
-
.attr('stroke-width', (d) => d.lineWidth)
|
|
44
|
-
.attr('stroke-linejoin', (d) => d.linejoin)
|
|
45
|
-
.attr('stroke-linecap', (d) => d.linecap)
|
|
46
|
-
.attr('stroke-dasharray', (d) => getLineDashArray(d.dashStyle, d.lineWidth))
|
|
47
|
-
.attr('opacity', (d) => d.opacity)
|
|
48
|
-
.attr('cursor', (d) => d.series.cursor);
|
|
49
|
-
const dataLabels = preparedData.reduce((acc, d) => {
|
|
50
|
-
return acc.concat(d.svgLabels);
|
|
51
|
-
}, []);
|
|
52
|
-
const labelsSelection = plotSvgElement
|
|
53
|
-
.selectAll('text')
|
|
54
|
-
.data(dataLabels)
|
|
55
|
-
.join('text')
|
|
56
|
-
.html((d) => d.text)
|
|
57
|
-
.attr('class', b('label'))
|
|
58
|
-
.attr('x', (d) => d.x)
|
|
59
|
-
.attr('y', (d) => d.y)
|
|
60
|
-
.attr('text-anchor', (d) => d.textAnchor)
|
|
61
|
-
.style('font-size', (d) => d.style.fontSize)
|
|
62
|
-
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
63
|
-
.style('fill', (d) => d.style.fontColor || null);
|
|
64
|
-
const markers = preparedData.reduce((acc, d) => acc.concat(d.markers), []);
|
|
65
|
-
const markerSelection = markersSvgElement
|
|
66
|
-
.selectAll('marker')
|
|
67
|
-
.data(markers)
|
|
68
|
-
.join('g')
|
|
69
|
-
.call(renderMarker);
|
|
70
|
-
if (annotationsRef.current) {
|
|
71
|
-
const anchors = preparedData.flatMap((d) => d.annotations);
|
|
72
|
-
renderAnnotations({
|
|
73
|
-
anchors,
|
|
74
|
-
container: select(annotationsRef.current),
|
|
75
|
-
plotHeight: boundsHeight,
|
|
76
|
-
plotWidth: boundsWidth,
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
80
|
-
const inactiveEnabled = inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled;
|
|
81
|
-
function handleShapeHover(data) {
|
|
82
|
-
hoveredDataRef.current = data;
|
|
83
|
-
const selected = (data === null || data === void 0 ? void 0 : data.filter((d) => d.series.type === 'line')) || [];
|
|
84
|
-
const selectedDataItems = selected.map((d) => d.data);
|
|
85
|
-
const selectedSeriesIds = selected.map((d) => { var _a; return (_a = d.series) === null || _a === void 0 ? void 0 : _a.id; });
|
|
86
|
-
lineSelection.datum((d, index, list) => {
|
|
87
|
-
const elementSelection = select(list[index]);
|
|
88
|
-
const hovered = Boolean(hoverEnabled && selectedSeriesIds.includes(d.id));
|
|
89
|
-
if (d.hovered !== hovered) {
|
|
90
|
-
d.hovered = hovered;
|
|
91
|
-
elementSelection.attr('stroke', (dSelection) => {
|
|
92
|
-
var _a;
|
|
93
|
-
const initialColor = dSelection.color || '';
|
|
94
|
-
if (dSelection.hovered) {
|
|
95
|
-
return (((_a = color(initialColor)) === null || _a === void 0 ? void 0 : _a.brighter(hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.brightness).toString()) || initialColor);
|
|
96
|
-
}
|
|
97
|
-
return initialColor;
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
return setActiveState({
|
|
101
|
-
element: list[index],
|
|
102
|
-
state: inactiveOptions,
|
|
103
|
-
active: Boolean(!inactiveEnabled ||
|
|
104
|
-
!selectedSeriesIds.length ||
|
|
105
|
-
selectedSeriesIds.includes(d.id)),
|
|
106
|
-
datum: d,
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
labelsSelection.datum((d, index, list) => {
|
|
110
|
-
return setActiveState({
|
|
111
|
-
element: list[index],
|
|
112
|
-
state: inactiveOptions,
|
|
113
|
-
active: Boolean(!inactiveEnabled ||
|
|
114
|
-
!selectedSeriesIds.length ||
|
|
115
|
-
selectedSeriesIds.includes(d.series.id)),
|
|
116
|
-
datum: d,
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
markerSelection.datum((d, index, list) => {
|
|
120
|
-
const elementSelection = select(list[index]);
|
|
121
|
-
const hovered = Boolean(hoverEnabled && selectedDataItems.includes(d.point.data));
|
|
122
|
-
if (d.hovered !== hovered) {
|
|
123
|
-
d.hovered = hovered;
|
|
124
|
-
elementSelection.attr('visibility', getMarkerVisibility(d));
|
|
125
|
-
selectMarkerHalo(elementSelection).attr('visibility', getMarkerHaloVisibility);
|
|
126
|
-
selectMarkerSymbol(elementSelection).call(setMarker, hovered ? 'hover' : 'normal');
|
|
127
|
-
}
|
|
128
|
-
if (d.point.series.marker.states.normal.enabled) {
|
|
129
|
-
const isActive = Boolean(!inactiveEnabled ||
|
|
130
|
-
!selectedSeriesIds.length ||
|
|
131
|
-
selectedSeriesIds.includes(d.point.series.id));
|
|
132
|
-
setActiveState({
|
|
133
|
-
element: list[index],
|
|
134
|
-
state: inactiveOptions,
|
|
135
|
-
active: isActive,
|
|
136
|
-
datum: d,
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
return d;
|
|
140
|
-
});
|
|
141
|
-
hoverMarkersSvgElement.selectAll('*').remove();
|
|
142
|
-
if (hoverEnabled && selected.length > 0) {
|
|
143
|
-
const hoverOnlyMarkers = [];
|
|
144
|
-
for (const chunk of selected) {
|
|
145
|
-
const seriesData = preparedData.find((pd) => pd.id === chunk.series.id);
|
|
146
|
-
if (!seriesData) {
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
const { series } = seriesData;
|
|
150
|
-
if (series.marker.states.normal.enabled ||
|
|
151
|
-
!series.marker.states.hover.enabled) {
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
const point = seriesData.points.find((p) => p.data === chunk.data);
|
|
155
|
-
if (!point || point.x === null || point.y === null) {
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
|
-
hoverOnlyMarkers.push({
|
|
159
|
-
point: point,
|
|
160
|
-
active: true,
|
|
161
|
-
hovered: true,
|
|
162
|
-
clipped: false,
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
if (hoverOnlyMarkers.length > 0) {
|
|
166
|
-
hoverMarkersSvgElement
|
|
167
|
-
.selectAll('g')
|
|
168
|
-
.data(hoverOnlyMarkers)
|
|
169
|
-
.join('g')
|
|
170
|
-
.call(renderMarker)
|
|
171
|
-
.each((_d, i, nodes) => {
|
|
172
|
-
selectMarkerSymbol(select(nodes[i])).call(setMarker, 'hover');
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
if (hoveredDataRef.current !== null) {
|
|
178
|
-
handleShapeHover(hoveredDataRef.current);
|
|
179
|
-
}
|
|
180
|
-
const eventName = `hover-shape.line-${(_b = (_a = preparedData[0]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : 'unknown'}`;
|
|
181
|
-
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on(eventName, handleShapeHover);
|
|
182
|
-
return () => {
|
|
183
|
-
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on(eventName, null);
|
|
184
|
-
};
|
|
19
|
+
return renderLine({
|
|
20
|
+
plot: plotRef.current,
|
|
21
|
+
markers: markersRef.current,
|
|
22
|
+
hoverMarkers: hoverMarkersRef.current,
|
|
23
|
+
annotations: annotationsRef.current,
|
|
24
|
+
boundsWidth,
|
|
25
|
+
boundsHeight,
|
|
26
|
+
}, preparedData, seriesOptions, dispatcher);
|
|
185
27
|
}, [boundsHeight, boundsWidth, dispatcher, preparedData, seriesOptions]);
|
|
186
28
|
const htmlLayerData = React.useMemo(() => {
|
|
187
|
-
const items = preparedData.
|
|
29
|
+
const items = preparedData.flatMap((d) => d.htmlLabels);
|
|
188
30
|
return { htmlElements: items };
|
|
189
31
|
}, [preparedData]);
|
|
190
32
|
return (React.createElement(React.Fragment, null,
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Dispatch } from 'd3-dispatch';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
|
|
3
|
+
import type { PreparedSeriesOptions } from '../../../core/series/types';
|
|
4
|
+
import type { PreparedPieData } from '../../../core/shapes/pie/types';
|
|
5
|
+
export { getHaloVisibility } from '../../../core/shapes/pie/renderer';
|
|
6
6
|
type PreparePieSeriesArgs = {
|
|
7
7
|
htmlLayout: HTMLElement | null;
|
|
8
8
|
preparedData: PreparedPieData[];
|
|
9
9
|
seriesOptions: PreparedSeriesOptions;
|
|
10
10
|
dispatcher?: Dispatch<object>;
|
|
11
11
|
};
|
|
12
|
-
export declare function getHaloVisibility(d: PieArcDatum<SegmentData>): "" | "hidden";
|
|
13
12
|
export declare function PieSeriesShapes(args: PreparePieSeriesArgs): React.JSX.Element;
|
|
14
|
-
export {};
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { select } from 'd3-selection';
|
|
4
|
-
import { arc } from 'd3-shape';
|
|
5
|
-
import get from 'lodash/get';
|
|
6
|
-
import { setEllipsisForOverflowTexts } from '../../../core/utils';
|
|
2
|
+
import { renderPie } from '../../../core/shapes/pie/renderer';
|
|
7
3
|
import { block } from '../../../utils';
|
|
8
4
|
import { HtmlLayer } from '../HtmlLayer';
|
|
9
|
-
|
|
5
|
+
export { getHaloVisibility } from '../../../core/shapes/pie/renderer';
|
|
10
6
|
const b = block('pie');
|
|
11
|
-
export function getHaloVisibility(d) {
|
|
12
|
-
const enabled = d.data.pie.halo.enabled && d.data.hovered;
|
|
13
|
-
return enabled ? '' : 'hidden';
|
|
14
|
-
}
|
|
15
7
|
export function PieSeriesShapes(args) {
|
|
16
8
|
const { dispatcher, preparedData, seriesOptions, htmlLayout } = args;
|
|
17
9
|
const ref = React.useRef(null);
|
|
@@ -19,154 +11,7 @@ export function PieSeriesShapes(args) {
|
|
|
19
11
|
if (!ref.current) {
|
|
20
12
|
return () => { };
|
|
21
13
|
}
|
|
22
|
-
|
|
23
|
-
svgElement.selectAll('*').remove();
|
|
24
|
-
const segmentSelector = `.${b('segment')}`;
|
|
25
|
-
const connectorSelector = `.${b('connector')}`;
|
|
26
|
-
const shapesSelection = svgElement
|
|
27
|
-
.selectAll('pie')
|
|
28
|
-
.data(preparedData)
|
|
29
|
-
.join('g')
|
|
30
|
-
.attr('id', (pieData) => pieData.id)
|
|
31
|
-
.attr('class', b('item'))
|
|
32
|
-
.attr('transform', (pieData) => {
|
|
33
|
-
const [x, y] = pieData.center;
|
|
34
|
-
return `translate(${x}, ${y})`;
|
|
35
|
-
})
|
|
36
|
-
.style('stroke-width', (pieData) => pieData.borderWidth)
|
|
37
|
-
.attr('cursor', (pieData) => pieData.series.cursor);
|
|
38
|
-
// Render halo appearing outside the hovered slice
|
|
39
|
-
shapesSelection
|
|
40
|
-
.selectAll('halo')
|
|
41
|
-
.data((pieData) => {
|
|
42
|
-
if (pieData.halo.enabled) {
|
|
43
|
-
return pieData.segments;
|
|
44
|
-
}
|
|
45
|
-
return [];
|
|
46
|
-
})
|
|
47
|
-
.join('path')
|
|
48
|
-
.attr('d', (d) => {
|
|
49
|
-
const arcGenerator = arc()
|
|
50
|
-
.innerRadius(d.data.pie.innerRadius)
|
|
51
|
-
.outerRadius(d.data.radius + d.data.pie.halo.size)
|
|
52
|
-
.cornerRadius(d.data.pie.borderRadius);
|
|
53
|
-
return arcGenerator(d);
|
|
54
|
-
})
|
|
55
|
-
.attr('class', b('halo'))
|
|
56
|
-
.attr('fill', (d) => d.data.color)
|
|
57
|
-
.attr('opacity', (d) => d.data.pie.halo.opacity)
|
|
58
|
-
.attr('z-index', -1)
|
|
59
|
-
.attr('visibility', getHaloVisibility);
|
|
60
|
-
// Render segments
|
|
61
|
-
shapesSelection
|
|
62
|
-
.selectAll(segmentSelector)
|
|
63
|
-
.data((pieData) => pieData.segments)
|
|
64
|
-
.join('path')
|
|
65
|
-
.attr('d', (d) => {
|
|
66
|
-
const arcGenerator = arc()
|
|
67
|
-
.innerRadius(d.data.pie.innerRadius)
|
|
68
|
-
.outerRadius(d.data.radius)
|
|
69
|
-
.cornerRadius(d.data.pie.borderRadius);
|
|
70
|
-
return arcGenerator(d);
|
|
71
|
-
})
|
|
72
|
-
.attr('class', b('segment'))
|
|
73
|
-
.style('stroke', (d) => d.data.series.borderColor)
|
|
74
|
-
.attr('fill', (d) => d.data.color)
|
|
75
|
-
.attr('opacity', (d) => d.data.opacity);
|
|
76
|
-
// render Labels
|
|
77
|
-
shapesSelection
|
|
78
|
-
.selectAll('text')
|
|
79
|
-
.data((pieData) => pieData.labels)
|
|
80
|
-
.join('text')
|
|
81
|
-
.html((d) => d.text)
|
|
82
|
-
.attr('class', b('label'))
|
|
83
|
-
.attr('x', (d) => d.x)
|
|
84
|
-
.attr('y', (d) => d.y)
|
|
85
|
-
.attr('text-anchor', (d) => d.textAnchor)
|
|
86
|
-
.style('font-size', (d) => d.style.fontSize)
|
|
87
|
-
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
88
|
-
.style('fill', (d) => d.style.fontColor || null)
|
|
89
|
-
.call(setEllipsisForOverflowTexts, (d) => d.size.width > d.maxWidth ? d.maxWidth : Infinity);
|
|
90
|
-
// Add the polyline between chart and labels
|
|
91
|
-
shapesSelection
|
|
92
|
-
.selectAll(connectorSelector)
|
|
93
|
-
.data((pieData) => pieData.connectors)
|
|
94
|
-
.enter()
|
|
95
|
-
.append('path')
|
|
96
|
-
.attr('class', b('connector'))
|
|
97
|
-
.attr('d', (d) => d.path)
|
|
98
|
-
.attr('stroke', (d) => d.color)
|
|
99
|
-
.attr('stroke-width', 1)
|
|
100
|
-
.attr('stroke-linejoin', 'round')
|
|
101
|
-
.attr('stroke-linecap', 'round')
|
|
102
|
-
.style('fill', 'none');
|
|
103
|
-
// Render custom shapes if defined
|
|
104
|
-
shapesSelection.each(async function (d, index, nodes) {
|
|
105
|
-
var _a, _b;
|
|
106
|
-
const customShape = await ((_b = (_a = d.series).renderCustomShape) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
107
|
-
series: {
|
|
108
|
-
innerRadius: d.innerRadius,
|
|
109
|
-
},
|
|
110
|
-
}));
|
|
111
|
-
if (customShape) {
|
|
112
|
-
nodes[index].append(customShape);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
const eventName = `hover-shape.pie`;
|
|
116
|
-
const hoverOptions = get(seriesOptions, 'pie.states.hover');
|
|
117
|
-
const inactiveOptions = get(seriesOptions, 'pie.states.inactive');
|
|
118
|
-
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on(eventName, (data) => {
|
|
119
|
-
var _a, _b;
|
|
120
|
-
const selectedSeriesId = (_b = (_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.series) === null || _b === void 0 ? void 0 : _b.id;
|
|
121
|
-
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
122
|
-
const inactiveEnabled = inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled;
|
|
123
|
-
shapesSelection.datum((_d, index, list) => {
|
|
124
|
-
const pieSelection = select(list[index]);
|
|
125
|
-
const haloSelection = pieSelection.selectAll(`.${b('halo')}`);
|
|
126
|
-
pieSelection
|
|
127
|
-
.selectAll(segmentSelector)
|
|
128
|
-
.datum((d, i, elements) => {
|
|
129
|
-
const hovered = Boolean(hoverEnabled && d.data.series.id === selectedSeriesId);
|
|
130
|
-
if (d.data.hovered !== hovered) {
|
|
131
|
-
d.data.hovered = hovered;
|
|
132
|
-
select(elements[i]).attr('fill', () => {
|
|
133
|
-
var _a;
|
|
134
|
-
const initialColor = d.data.color;
|
|
135
|
-
if (d.data.hovered) {
|
|
136
|
-
return (((_a = color(initialColor)) === null || _a === void 0 ? void 0 : _a.brighter(hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.brightness).toString()) || initialColor);
|
|
137
|
-
}
|
|
138
|
-
return initialColor;
|
|
139
|
-
});
|
|
140
|
-
const currentSegmentHalo = haloSelection.nodes()[i];
|
|
141
|
-
select(currentSegmentHalo).attr('visibility', getHaloVisibility);
|
|
142
|
-
}
|
|
143
|
-
setActiveState({
|
|
144
|
-
element: elements[i],
|
|
145
|
-
state: inactiveOptions,
|
|
146
|
-
active: Boolean(!inactiveEnabled ||
|
|
147
|
-
!selectedSeriesId ||
|
|
148
|
-
selectedSeriesId === d.data.series.id),
|
|
149
|
-
datum: d.data,
|
|
150
|
-
});
|
|
151
|
-
return d;
|
|
152
|
-
});
|
|
153
|
-
const labelSelection = pieSelection.selectAll(`.${b('label')} tspan`);
|
|
154
|
-
const connectorSelection = pieSelection.selectAll(connectorSelector);
|
|
155
|
-
labelSelection.merge(connectorSelection).datum((d, i, elements) => {
|
|
156
|
-
return setActiveState({
|
|
157
|
-
element: elements[i],
|
|
158
|
-
state: inactiveOptions,
|
|
159
|
-
active: Boolean(!inactiveEnabled ||
|
|
160
|
-
!selectedSeriesId ||
|
|
161
|
-
selectedSeriesId === d.series.id),
|
|
162
|
-
datum: d,
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
return () => {
|
|
168
|
-
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on(eventName, null);
|
|
169
|
-
};
|
|
14
|
+
return renderPie({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
|
|
170
15
|
}, [dispatcher, preparedData, seriesOptions]);
|
|
171
16
|
const htmlElements = preparedData.map((d) => d.htmlLabels).flat();
|
|
172
17
|
return (React.createElement(React.Fragment, null,
|
|
@@ -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 { PreparedRadarData } from '
|
|
3
|
+
import type { PreparedSeriesOptions } from '../../../core/series/types';
|
|
4
|
+
import type { PreparedRadarData } from '../../../core/shapes/radar/types';
|
|
5
5
|
type PrepareRadarSeriesArgs = {
|
|
6
6
|
htmlLayout: HTMLElement | null;
|
|
7
7
|
series: PreparedRadarData[];
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { select } from 'd3-selection';
|
|
4
|
-
import { line } from 'd3-shape';
|
|
5
|
-
import get from 'lodash/get';
|
|
2
|
+
import { renderRadar } from '../../../core/shapes/radar/renderer';
|
|
6
3
|
import { block } from '../../../utils';
|
|
7
4
|
import { HtmlLayer } from '../HtmlLayer';
|
|
8
|
-
import { getMarkerHaloVisibility, getMarkerVisibility, renderMarker, selectMarkerHalo, selectMarkerSymbol, setMarker, } from '../marker';
|
|
9
|
-
import { setActiveState } from '../utils';
|
|
10
5
|
const b = block('radar');
|
|
11
6
|
export function RadarSeriesShapes(args) {
|
|
12
7
|
const { dispatcher, series: preparedData, seriesOptions, htmlLayout } = args;
|
|
@@ -15,121 +10,7 @@ export function RadarSeriesShapes(args) {
|
|
|
15
10
|
if (!ref.current) {
|
|
16
11
|
return () => { };
|
|
17
12
|
}
|
|
18
|
-
|
|
19
|
-
svgElement.selectAll('*').remove();
|
|
20
|
-
const areaSelector = `.${b('area')}`;
|
|
21
|
-
const radarSelection = svgElement
|
|
22
|
-
.selectAll('radar')
|
|
23
|
-
.data(preparedData)
|
|
24
|
-
.join('g')
|
|
25
|
-
.attr('id', (radarData) => radarData.id)
|
|
26
|
-
.attr('class', b('item'))
|
|
27
|
-
.attr('cursor', (radarData) => radarData.cursor);
|
|
28
|
-
// render axes
|
|
29
|
-
radarSelection
|
|
30
|
-
.selectAll(`.${b('axis')}`)
|
|
31
|
-
.data((radarData) => radarData.axes)
|
|
32
|
-
.join('line')
|
|
33
|
-
.attr('class', b('axis'))
|
|
34
|
-
.attr('x1', (d) => d.radar.center[0])
|
|
35
|
-
.attr('y1', (d) => d.radar.center[1])
|
|
36
|
-
.attr('x2', (d) => d.point[0])
|
|
37
|
-
.attr('y2', (d) => d.point[1])
|
|
38
|
-
.attr('stroke', (d) => d.strokeColor)
|
|
39
|
-
.attr('stroke-width', (d) => d.strokeWidth);
|
|
40
|
-
// render grid lines
|
|
41
|
-
radarSelection
|
|
42
|
-
.selectAll(`.${b('grid')}`)
|
|
43
|
-
.data((radarData) => radarData.grid)
|
|
44
|
-
.join('path')
|
|
45
|
-
.attr('class', b('grid'))
|
|
46
|
-
.attr('d', (d) => `${line()(d.path)} Z`)
|
|
47
|
-
.attr('fill', 'none')
|
|
48
|
-
.attr('stroke', (d) => d.strokeColor)
|
|
49
|
-
.attr('stroke-width', (d) => d.strokeWidth);
|
|
50
|
-
// render radar area
|
|
51
|
-
const shapesSelection = radarSelection
|
|
52
|
-
.selectAll(areaSelector)
|
|
53
|
-
.data((radarData) => radarData.shapes)
|
|
54
|
-
.join('g')
|
|
55
|
-
.attr('class', b('area'));
|
|
56
|
-
shapesSelection
|
|
57
|
-
.append('path')
|
|
58
|
-
.attr('d', (d) => d.path)
|
|
59
|
-
.attr('fill', (d) => d.color)
|
|
60
|
-
.attr('fill-opacity', (d) => d.fillOpacity)
|
|
61
|
-
.attr('stroke', (d) => d.borderColor)
|
|
62
|
-
.attr('stroke-width', (d) => d.borderWidth);
|
|
63
|
-
// render markers
|
|
64
|
-
const markerSelection = shapesSelection
|
|
65
|
-
.selectAll('marker')
|
|
66
|
-
.data((radarData) => radarData.points)
|
|
67
|
-
.join('g')
|
|
68
|
-
.call(renderMarker);
|
|
69
|
-
// Render labels
|
|
70
|
-
radarSelection
|
|
71
|
-
.selectAll('text')
|
|
72
|
-
.data((radarData) => radarData.labels)
|
|
73
|
-
.join('text')
|
|
74
|
-
.html((d) => d.text)
|
|
75
|
-
.attr('class', b('label'))
|
|
76
|
-
.attr('x', (d) => d.x)
|
|
77
|
-
.attr('y', (d) => d.y)
|
|
78
|
-
.attr('text-anchor', (d) => d.textAnchor)
|
|
79
|
-
.style('font-size', (d) => d.style.fontSize)
|
|
80
|
-
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
81
|
-
.style('fill', (d) => d.style.fontColor || null);
|
|
82
|
-
// Handle hover events
|
|
83
|
-
const eventName = `hover-shape.radar`;
|
|
84
|
-
const hoverOptions = get(seriesOptions, 'radar.states.hover');
|
|
85
|
-
const inactiveOptions = get(seriesOptions, 'radar.states.inactive');
|
|
86
|
-
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on(eventName, (data) => {
|
|
87
|
-
const closest = data === null || data === void 0 ? void 0 : data.find((d) => d.closest);
|
|
88
|
-
const selectedSeries = closest === null || closest === void 0 ? void 0 : closest.series;
|
|
89
|
-
const selectedSeriesData = closest === null || closest === void 0 ? void 0 : closest.data;
|
|
90
|
-
const selectedSeriesId = selectedSeries === null || selectedSeries === void 0 ? void 0 : selectedSeries.id;
|
|
91
|
-
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
92
|
-
const inactiveEnabled = inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled;
|
|
93
|
-
shapesSelection.datum((d, i, elements) => {
|
|
94
|
-
var _a;
|
|
95
|
-
const hovered = Boolean(hoverEnabled && ((_a = d.series) === null || _a === void 0 ? void 0 : _a.id) === selectedSeriesId);
|
|
96
|
-
if (d.hovered !== hovered) {
|
|
97
|
-
d.hovered = hovered;
|
|
98
|
-
select(elements[i]).attr('fill', () => {
|
|
99
|
-
var _a;
|
|
100
|
-
const initialColor = d.color;
|
|
101
|
-
if (d.hovered) {
|
|
102
|
-
return (((_a = color(initialColor)) === null || _a === void 0 ? void 0 : _a.brighter(hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.brightness).toString()) || initialColor);
|
|
103
|
-
}
|
|
104
|
-
return initialColor;
|
|
105
|
-
});
|
|
106
|
-
if (hovered) {
|
|
107
|
-
select(elements[i]).raise();
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
setActiveState({
|
|
111
|
-
element: elements[i],
|
|
112
|
-
state: inactiveOptions,
|
|
113
|
-
active: Boolean(!inactiveEnabled || !selectedSeriesId || selectedSeriesId === d.series.id),
|
|
114
|
-
datum: d,
|
|
115
|
-
});
|
|
116
|
-
markerSelection.datum((markerData, index, markers) => {
|
|
117
|
-
const hoveredState = Boolean(hoverEnabled && markerData.data === selectedSeriesData);
|
|
118
|
-
if (markerData.hovered !== hoveredState) {
|
|
119
|
-
markerData.hovered = hoveredState;
|
|
120
|
-
const elementSelection = select(markers[index]);
|
|
121
|
-
elementSelection.attr('visibility', getMarkerVisibility(markerData));
|
|
122
|
-
selectMarkerHalo(elementSelection).attr('visibility', getMarkerHaloVisibility);
|
|
123
|
-
selectMarkerSymbol(elementSelection).call(setMarker, hoveredState ? 'hover' : 'normal');
|
|
124
|
-
}
|
|
125
|
-
return markerData;
|
|
126
|
-
});
|
|
127
|
-
return d;
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
return () => {
|
|
131
|
-
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on(eventName, null);
|
|
132
|
-
};
|
|
13
|
+
return renderRadar({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
|
|
133
14
|
}, [dispatcher, preparedData, seriesOptions]);
|
|
134
15
|
const htmlElements = preparedData.map((d) => d.htmlLabels).flat();
|
|
135
16
|
return (React.createElement(React.Fragment, null,
|
|
@@ -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 { PreparedSankeyData } from '
|
|
3
|
+
import type { PreparedSeriesOptions } from '../../../core/series/types';
|
|
4
|
+
import type { PreparedSankeyData } from '../../../core/shapes/sankey/types';
|
|
5
5
|
type ShapeProps = {
|
|
6
6
|
htmlLayout: HTMLElement | null;
|
|
7
7
|
preparedData: PreparedSankeyData;
|
|
@@ -1,65 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { renderSankey } from '../../../core/shapes/sankey/renderer';
|
|
3
3
|
import { block } from '../../../utils';
|
|
4
4
|
import { HtmlLayer } from '../HtmlLayer';
|
|
5
5
|
const b = block('sankey');
|
|
6
6
|
export const SankeySeriesShape = (props) => {
|
|
7
7
|
const { dispatcher, preparedData, seriesOptions, htmlLayout } = props;
|
|
8
|
-
const hoveredDataRef = React.useRef(null);
|
|
9
8
|
const ref = React.useRef(null);
|
|
10
9
|
React.useEffect(() => {
|
|
11
10
|
if (!ref.current) {
|
|
12
11
|
return () => { };
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
svgElement.selectAll('*').remove();
|
|
16
|
-
// nodes
|
|
17
|
-
svgElement
|
|
18
|
-
.append('g')
|
|
19
|
-
.selectAll()
|
|
20
|
-
.data(preparedData.nodes)
|
|
21
|
-
.join('rect')
|
|
22
|
-
.attr('x', (d) => d.x0)
|
|
23
|
-
.attr('y', (d) => d.y0)
|
|
24
|
-
.attr('height', (d) => d.y1 - d.y0)
|
|
25
|
-
.attr('width', (d) => d.x1 - d.x0)
|
|
26
|
-
.attr('fill', (d) => d.color);
|
|
27
|
-
// links
|
|
28
|
-
svgElement
|
|
29
|
-
.append('g')
|
|
30
|
-
.attr('fill', 'none')
|
|
31
|
-
.selectAll()
|
|
32
|
-
.data(preparedData.links)
|
|
33
|
-
.join('g')
|
|
34
|
-
.append('path')
|
|
35
|
-
.attr('stroke-opacity', (d) => d.opacity)
|
|
36
|
-
.attr('d', (d) => d.path)
|
|
37
|
-
.attr('stroke', (d) => d.color)
|
|
38
|
-
.attr('stroke-width', (d) => d.strokeWidth);
|
|
39
|
-
// dataLabels
|
|
40
|
-
svgElement
|
|
41
|
-
.append('g')
|
|
42
|
-
.selectAll()
|
|
43
|
-
.data(preparedData.labels)
|
|
44
|
-
.join('text')
|
|
45
|
-
.html((d) => d.text)
|
|
46
|
-
.attr('class', b('label'))
|
|
47
|
-
.attr('x', (d) => d.x)
|
|
48
|
-
.attr('y', (d) => d.y)
|
|
49
|
-
.attr('dy', '0.35em')
|
|
50
|
-
.attr('text-anchor', (d) => d.textAnchor)
|
|
51
|
-
.attr('fill', (d) => { var _a; return (_a = d.style.fontColor) !== null && _a !== void 0 ? _a : null; });
|
|
52
|
-
const eventName = `hover-shape.sankey`;
|
|
53
|
-
function handleShapeHover(data) {
|
|
54
|
-
hoveredDataRef.current = data;
|
|
55
|
-
}
|
|
56
|
-
if (hoveredDataRef.current !== null) {
|
|
57
|
-
handleShapeHover(hoveredDataRef.current);
|
|
58
|
-
}
|
|
59
|
-
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on(eventName, handleShapeHover);
|
|
60
|
-
return () => {
|
|
61
|
-
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on(eventName, null);
|
|
62
|
-
};
|
|
13
|
+
return renderSankey({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
|
|
63
14
|
}, [dispatcher, preparedData, seriesOptions]);
|
|
64
15
|
return (React.createElement(React.Fragment, null,
|
|
65
16
|
React.createElement("g", { ref: ref, className: b() }),
|
|
@@ -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 { PreparedScatterData } from '
|
|
5
|
-
export { prepareScatterData } from '
|
|
3
|
+
import type { PreparedSeriesOptions } from '../../../core/series/types';
|
|
4
|
+
import type { PreparedScatterData } from '../../../core/shapes/scatter/types';
|
|
5
|
+
export { prepareScatterData } from '../../../core/shapes/scatter/prepare-data';
|
|
6
6
|
type ScatterSeriesShapeProps = {
|
|
7
7
|
htmlLayout: HTMLElement | null;
|
|
8
8
|
preparedData: PreparedScatterData[];
|