@gravity-ui/charts 1.45.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/index.js +2 -2
- package/dist/cjs/components/ChartInner/styles.css +2 -2
- package/dist/cjs/components/ChartInner/useChartInnerProps.js +2 -2
- package/dist/cjs/components/ChartInner/utils/title.d.ts +2 -1
- package/dist/cjs/components/ChartInner/utils/title.js +51 -14
- package/dist/cjs/components/Legend/index.js +13 -14
- package/dist/cjs/components/Title/index.d.ts +4 -2
- package/dist/cjs/components/Title/index.js +9 -2
- 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/core/types/chart/title.d.ts +18 -0
- 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/types.d.ts +6 -3
- 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/HtmlLayer.js +4 -3
- 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/cjs/types/chart-ui.d.ts +2 -0
- package/dist/esm/components/ChartInner/index.js +2 -2
- package/dist/esm/components/ChartInner/styles.css +2 -2
- package/dist/esm/components/ChartInner/useChartInnerProps.js +2 -2
- package/dist/esm/components/ChartInner/utils/title.d.ts +2 -1
- package/dist/esm/components/ChartInner/utils/title.js +51 -14
- package/dist/esm/components/Legend/index.js +13 -14
- package/dist/esm/components/Title/index.d.ts +4 -2
- package/dist/esm/components/Title/index.js +9 -2
- 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/core/types/chart/title.d.ts +18 -0
- 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/types.d.ts +6 -3
- 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/HtmlLayer.js +4 -3
- 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/dist/esm/types/chart-ui.d.ts +2 -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,11 +1,11 @@
|
|
|
1
1
|
import { ascending, descending, max, min, reverse, sort } from 'd3-array';
|
|
2
2
|
import get from 'lodash/get';
|
|
3
|
-
import { prepareAnnotation } from '
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { prepareAnnotation } from '../../series/prepare-annotation';
|
|
4
|
+
import { getSeriesStackId } from '../../series/utils';
|
|
5
|
+
import { MIN_BAR_GAP, MIN_BAR_GROUP_GAP, MIN_BAR_WIDTH } from '../../shapes/bar-constants';
|
|
6
|
+
import { getDataCategoryValue, getLabelsSize } from '../../utils';
|
|
7
|
+
import { getBandSize } from '../../utils/band-size';
|
|
8
|
+
import { getFormattedValue } from '../../utils/format';
|
|
9
9
|
const isSeriesDataValid = (d) => d.y !== null;
|
|
10
10
|
async function getLabelData(d, xMax) {
|
|
11
11
|
var _a;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Dispatch } from 'd3-dispatch';
|
|
2
|
+
import type { PreparedSeriesOptions } from '../../series/types';
|
|
3
|
+
import type { PreparedBarXData } from './types';
|
|
4
|
+
export declare function renderBarX(elements: {
|
|
5
|
+
plot: SVGGElement;
|
|
6
|
+
annotations: SVGGElement;
|
|
7
|
+
boundsWidth: number;
|
|
8
|
+
boundsHeight: number;
|
|
9
|
+
}, preparedData: PreparedBarXData[], seriesOptions: PreparedSeriesOptions, allowOverlapDataLabels: boolean, dispatcher?: Dispatch<object>): () => void;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { color } from 'd3-color';
|
|
2
|
+
import { select } from 'd3-selection';
|
|
3
|
+
import get from 'lodash/get';
|
|
4
|
+
import { block } from '../../../utils';
|
|
5
|
+
import { filterOverlappingLabels } from '../../utils';
|
|
6
|
+
import { renderAnnotations } from '../annotation';
|
|
7
|
+
import { getRectPath } from '../utils';
|
|
8
|
+
const b = block('bar-x');
|
|
9
|
+
export function renderBarX(elements, preparedData, seriesOptions, allowOverlapDataLabels, dispatcher) {
|
|
10
|
+
const svgElement = select(elements.plot);
|
|
11
|
+
const annotationsSvgElement = select(elements.annotations);
|
|
12
|
+
const hoverOptions = get(seriesOptions, 'bar-x.states.hover');
|
|
13
|
+
const inactiveOptions = get(seriesOptions, 'bar-x.states.inactive');
|
|
14
|
+
svgElement.selectAll('*').remove();
|
|
15
|
+
const rectSelection = svgElement
|
|
16
|
+
.selectAll('allRects')
|
|
17
|
+
.data(preparedData)
|
|
18
|
+
.join('path')
|
|
19
|
+
.attr('d', (d) => {
|
|
20
|
+
const borderRadius = d.isLastStackItem
|
|
21
|
+
? Math.min(d.height, d.width / 2, d.series.borderRadius)
|
|
22
|
+
: 0;
|
|
23
|
+
const p = getRectPath({
|
|
24
|
+
x: d.x,
|
|
25
|
+
y: d.y,
|
|
26
|
+
width: d.width,
|
|
27
|
+
height: d.height,
|
|
28
|
+
borderRadius: [borderRadius, borderRadius, 0, 0],
|
|
29
|
+
});
|
|
30
|
+
return p.toString();
|
|
31
|
+
})
|
|
32
|
+
.attr('class', b('segment'))
|
|
33
|
+
.attr('fill', (d) => d.data.color || d.series.color)
|
|
34
|
+
.attr('opacity', (d) => d.opacity)
|
|
35
|
+
.attr('cursor', (d) => d.series.cursor);
|
|
36
|
+
let dataLabels = preparedData.map((d) => d.svgLabels).flat();
|
|
37
|
+
if (!allowOverlapDataLabels) {
|
|
38
|
+
dataLabels = filterOverlappingLabels(dataLabels);
|
|
39
|
+
}
|
|
40
|
+
const labelSelection = svgElement
|
|
41
|
+
.selectAll('text')
|
|
42
|
+
.data(dataLabels)
|
|
43
|
+
.join('text')
|
|
44
|
+
.html((d) => d.text)
|
|
45
|
+
.attr('class', b('label'))
|
|
46
|
+
.attr('x', (d) => d.x)
|
|
47
|
+
.attr('y', (d) => d.y)
|
|
48
|
+
.attr('text-anchor', (d) => d.textAnchor)
|
|
49
|
+
.style('font-size', (d) => d.style.fontSize)
|
|
50
|
+
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
51
|
+
.style('fill', (d) => d.style.fontColor || null);
|
|
52
|
+
const annotationAnchors = [];
|
|
53
|
+
for (const d of preparedData) {
|
|
54
|
+
if (d.annotation) {
|
|
55
|
+
annotationAnchors.push({
|
|
56
|
+
annotation: d.annotation,
|
|
57
|
+
x: d.x + d.width / 2,
|
|
58
|
+
y: d.y,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
renderAnnotations({
|
|
63
|
+
anchors: annotationAnchors,
|
|
64
|
+
container: annotationsSvgElement,
|
|
65
|
+
plotHeight: elements.boundsHeight,
|
|
66
|
+
plotWidth: elements.boundsWidth,
|
|
67
|
+
});
|
|
68
|
+
function handleShapeHover(data) {
|
|
69
|
+
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
70
|
+
const inactiveEnabled = inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled;
|
|
71
|
+
if (!data) {
|
|
72
|
+
if (hoverEnabled) {
|
|
73
|
+
rectSelection.attr('fill', (d) => d.data.color || d.series.color);
|
|
74
|
+
}
|
|
75
|
+
if (inactiveEnabled) {
|
|
76
|
+
rectSelection.attr('opacity', null);
|
|
77
|
+
labelSelection.attr('opacity', null);
|
|
78
|
+
}
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (hoverEnabled) {
|
|
82
|
+
const hoveredValues = data.map((d) => d.data.x);
|
|
83
|
+
rectSelection.attr('fill', (d) => {
|
|
84
|
+
var _a;
|
|
85
|
+
const fillColor = d.data.color || d.series.color;
|
|
86
|
+
if (hoveredValues.includes(d.data.x)) {
|
|
87
|
+
return (((_a = color(fillColor)) === null || _a === void 0 ? void 0 : _a.brighter(hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.brightness).toString()) || fillColor);
|
|
88
|
+
}
|
|
89
|
+
return fillColor;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (inactiveEnabled) {
|
|
93
|
+
const hoveredSeries = data.map((d) => d.series.id);
|
|
94
|
+
rectSelection.attr('opacity', (d) => {
|
|
95
|
+
return hoveredSeries.includes(d.series.id)
|
|
96
|
+
? null
|
|
97
|
+
: (inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.opacity) || null;
|
|
98
|
+
});
|
|
99
|
+
labelSelection.attr('opacity', (d) => {
|
|
100
|
+
return hoveredSeries.includes(d.series.id)
|
|
101
|
+
? null
|
|
102
|
+
: (inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.opacity) || null;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.bar-x', handleShapeHover);
|
|
107
|
+
return () => {
|
|
108
|
+
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.bar-x', null);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { PreparedAnnotation } from '../../../core/series/types';
|
|
2
1
|
import type { HtmlItem, LabelData, TooltipDataChunkBarX } from '../../../types';
|
|
3
|
-
import type { PreparedBarXSeries } from '../../
|
|
2
|
+
import type { PreparedAnnotation, PreparedBarXSeries } from '../../series/types';
|
|
4
3
|
export type PreparedBarXData = Omit<TooltipDataChunkBarX, 'series'> & {
|
|
5
4
|
annotation?: PreparedAnnotation;
|
|
6
5
|
x: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { PreparedBarYSeries, PreparedSeriesOptions } from '../../
|
|
1
|
+
import type { PreparedXAxis, PreparedYAxis } from '../../axes/types';
|
|
2
|
+
import type { ChartScale } from '../../scales/types';
|
|
3
|
+
import type { PreparedBarYSeries, PreparedSeriesOptions } from '../../series/types';
|
|
4
4
|
import type { BarYShapesArgs } from './types';
|
|
5
5
|
export declare function prepareBarYData(args: {
|
|
6
6
|
boundsHeight: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ascending, descending, sort } from 'd3-array';
|
|
2
2
|
import get from 'lodash/get';
|
|
3
|
-
import { filterOverlappingLabels, getHtmlLabelConstraintedPosition, getLabelsSize, getSvgLabelConstraintedPosition, getTextSizeFn, } from '
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { filterOverlappingLabels, getHtmlLabelConstraintedPosition, getLabelsSize, getSvgLabelConstraintedPosition, getTextSizeFn, } from '../../utils';
|
|
4
|
+
import { getBarYLayout, groupBarYDataByYValue } from '../../utils/bar-y';
|
|
5
|
+
import { getFormattedValue } from '../../utils/format';
|
|
6
6
|
export async function prepareBarYData(args) {
|
|
7
7
|
var _a, _b;
|
|
8
8
|
const { boundsHeight, boundsWidth, series, seriesOptions, xAxis, yAxis, xScale, yScale: [yScale], } = args;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Dispatch } from 'd3-dispatch';
|
|
2
|
+
import type { PreparedSeriesOptions } from '../../series/types';
|
|
3
|
+
import type { BarYShapesArgs } from './types';
|
|
4
|
+
export declare function renderBarY(elements: {
|
|
5
|
+
plot: SVGGElement;
|
|
6
|
+
}, preparedData: BarYShapesArgs, seriesOptions: PreparedSeriesOptions, dispatcher?: Dispatch<object>): () => void;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { color } from 'd3-color';
|
|
2
|
+
import { select } from 'd3-selection';
|
|
3
|
+
import get from 'lodash/get';
|
|
4
|
+
import { block } from '../../../utils';
|
|
5
|
+
import { getAdjustedRectBorderPath, getAdjustedRectPath } from './utils';
|
|
6
|
+
const b = block('bar-y');
|
|
7
|
+
export function renderBarY(elements, preparedData, seriesOptions, dispatcher) {
|
|
8
|
+
const { shapes, labels: dataLabels } = preparedData;
|
|
9
|
+
const svgElement = select(elements.plot);
|
|
10
|
+
svgElement.selectAll('*').remove();
|
|
11
|
+
const segmentSelection = svgElement
|
|
12
|
+
.selectAll(`path.${b('segment')}`)
|
|
13
|
+
.data(shapes)
|
|
14
|
+
.join('path')
|
|
15
|
+
.attr('d', (d) => getAdjustedRectPath(d))
|
|
16
|
+
.attr('class', b('segment'))
|
|
17
|
+
.attr('x', (d) => d.x)
|
|
18
|
+
.attr('y', (d) => d.y)
|
|
19
|
+
.attr('height', (d) => d.height)
|
|
20
|
+
.attr('width', (d) => d.width)
|
|
21
|
+
.attr('fill', (d) => d.color)
|
|
22
|
+
.attr('opacity', (d) => d.data.opacity || null)
|
|
23
|
+
.attr('cursor', (d) => d.series.cursor);
|
|
24
|
+
const borderSelection = svgElement
|
|
25
|
+
.selectAll(`path.${b('segment-border')}`)
|
|
26
|
+
.data(shapes.filter((d) => d.borderWidth > 0))
|
|
27
|
+
.join('path')
|
|
28
|
+
.attr('d', (d) => getAdjustedRectBorderPath(d))
|
|
29
|
+
.attr('class', b('segment-border'))
|
|
30
|
+
.attr('fill', (d) => d.borderColor)
|
|
31
|
+
.attr('fill-rule', 'evenodd')
|
|
32
|
+
.attr('opacity', (d) => d.data.opacity || null)
|
|
33
|
+
.attr('pointer-events', 'none');
|
|
34
|
+
const labelSelection = svgElement
|
|
35
|
+
.selectAll('text')
|
|
36
|
+
.data(dataLabels)
|
|
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
|
+
.attr('text-anchor', (d) => d.textAnchor)
|
|
43
|
+
.style('font-size', (d) => d.style.fontSize)
|
|
44
|
+
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
45
|
+
.style('fill', (d) => d.style.fontColor || null);
|
|
46
|
+
const hoverOptions = get(seriesOptions, 'bar-y.states.hover');
|
|
47
|
+
const inactiveOptions = get(seriesOptions, 'bar-y.states.inactive');
|
|
48
|
+
function handleShapeHover(data) {
|
|
49
|
+
if (hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled) {
|
|
50
|
+
const hovered = data === null || data === void 0 ? void 0 : data.reduce((acc, d) => {
|
|
51
|
+
acc.add(d.data.y);
|
|
52
|
+
return acc;
|
|
53
|
+
}, new Set());
|
|
54
|
+
segmentSelection.attr('fill', (d) => {
|
|
55
|
+
var _a;
|
|
56
|
+
const fillColor = d.color;
|
|
57
|
+
if (hovered === null || hovered === void 0 ? void 0 : hovered.has(d.data.y)) {
|
|
58
|
+
return (((_a = color(fillColor)) === null || _a === void 0 ? void 0 : _a.brighter(hoverOptions.brightness).toString()) || fillColor);
|
|
59
|
+
}
|
|
60
|
+
return fillColor;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled) {
|
|
64
|
+
const hoveredSeries = data === null || data === void 0 ? void 0 : data.map((d) => d.series.id);
|
|
65
|
+
const newOpacity = (d) => {
|
|
66
|
+
if ((hoveredSeries === null || hoveredSeries === void 0 ? void 0 : hoveredSeries.length) && !hoveredSeries.includes(d.series.id)) {
|
|
67
|
+
return inactiveOptions.opacity || null;
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
};
|
|
71
|
+
segmentSelection.attr('opacity', newOpacity);
|
|
72
|
+
borderSelection.attr('opacity', newOpacity);
|
|
73
|
+
labelSelection.attr('opacity', newOpacity);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.bar-y', handleShapeHover);
|
|
77
|
+
return () => {
|
|
78
|
+
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.bar-y', null);
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HtmlItem, LabelData, TooltipDataChunkBarY } from '../../../types';
|
|
2
|
-
import type { PreparedBarYSeries } from '../../
|
|
2
|
+
import type { PreparedBarYSeries } from '../../series/types';
|
|
3
3
|
export type PreparedBarYData = Omit<TooltipDataChunkBarY, 'series'> & {
|
|
4
4
|
x: number;
|
|
5
5
|
y: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getRectBorderPath, getRectPath } from '
|
|
1
|
+
import { getRectBorderPath, getRectPath } from '../../shapes/utils';
|
|
2
2
|
export function getAdjustedRectPath(d) {
|
|
3
3
|
const borderRadius = d.isLastStackItem
|
|
4
4
|
? Math.min(d.height, d.width / 2, d.series.borderRadius)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { path } from 'd3-path';
|
|
2
|
-
import { calculateNumericProperty, getFormattedValue, getTextSizeFn } from '
|
|
2
|
+
import { calculateNumericProperty, getFormattedValue, getTextSizeFn } from '../../utils';
|
|
3
3
|
function getLineConnectorPaths(args) {
|
|
4
4
|
const { points } = args;
|
|
5
5
|
const leftPath = path();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Dispatch } from 'd3-dispatch';
|
|
2
|
+
import type { PreparedSeriesOptions } from '../../series/types';
|
|
3
|
+
import type { PreparedFunnelData } from './types';
|
|
4
|
+
export declare function renderFunnel(elements: {
|
|
5
|
+
plot: SVGGElement;
|
|
6
|
+
}, preparedData: PreparedFunnelData, seriesOptions: PreparedSeriesOptions, dispatcher?: Dispatch<object>): () => void;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { color } from 'd3-color';
|
|
2
|
+
import { select } from 'd3-selection';
|
|
3
|
+
import { block } from '../../../utils';
|
|
4
|
+
import { getLineDashArray } from '../../utils';
|
|
5
|
+
const b = block('funnel');
|
|
6
|
+
export function renderFunnel(elements, preparedData, seriesOptions, dispatcher) {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
const svgElement = select(elements.plot);
|
|
9
|
+
const hoverOptions = (_b = (_a = seriesOptions.funnel) === null || _a === void 0 ? void 0 : _a.states) === null || _b === void 0 ? void 0 : _b.hover;
|
|
10
|
+
svgElement.selectAll('*').remove();
|
|
11
|
+
// funnel levels
|
|
12
|
+
const cellsSelection = svgElement
|
|
13
|
+
.selectAll('rect')
|
|
14
|
+
.data(preparedData.items)
|
|
15
|
+
.join('rect')
|
|
16
|
+
.attr('x', (d) => d.x)
|
|
17
|
+
.attr('y', (d) => d.y)
|
|
18
|
+
.attr('height', (d) => d.height)
|
|
19
|
+
.attr('width', (d) => d.width)
|
|
20
|
+
.attr('fill', (d) => d.color)
|
|
21
|
+
.attr('stroke', (d) => d.borderColor)
|
|
22
|
+
.attr('stroke-width', (d) => d.borderWidth);
|
|
23
|
+
// connectors
|
|
24
|
+
const connectorAreaClassName = b('connector-area');
|
|
25
|
+
svgElement
|
|
26
|
+
.selectAll(`.${connectorAreaClassName}`)
|
|
27
|
+
.data(preparedData.connectors)
|
|
28
|
+
.join('path')
|
|
29
|
+
.attr('d', (d) => d.areaPath.toString())
|
|
30
|
+
.attr('class', connectorAreaClassName)
|
|
31
|
+
.attr('fill', (d) => d.areaColor)
|
|
32
|
+
.attr('opacity', (d) => d.areaOpacity);
|
|
33
|
+
const connectorLineClassName = b('connector-line');
|
|
34
|
+
const connectorLines = svgElement
|
|
35
|
+
.selectAll(`.${connectorLineClassName}`)
|
|
36
|
+
.data(preparedData.connectors)
|
|
37
|
+
.join('g')
|
|
38
|
+
.attr('class', connectorLineClassName)
|
|
39
|
+
.attr('stroke', (d) => d.lineColor)
|
|
40
|
+
.attr('stroke-width', (d) => d.lineWidth)
|
|
41
|
+
.attr('stroke-dasharray', (d) => getLineDashArray(d.dashStyle, d.lineWidth))
|
|
42
|
+
.attr('fill', 'none')
|
|
43
|
+
.attr('opacity', (d) => d.lineOpacity);
|
|
44
|
+
connectorLines.append('path').attr('d', (d) => d.linePath[0].toString());
|
|
45
|
+
connectorLines.append('path').attr('d', (d) => d.linePath[1].toString());
|
|
46
|
+
// dataLabels
|
|
47
|
+
svgElement
|
|
48
|
+
.selectAll('text')
|
|
49
|
+
.data(preparedData.svgLabels)
|
|
50
|
+
.join('text')
|
|
51
|
+
.html((d) => d.text)
|
|
52
|
+
.attr('class', b('label'))
|
|
53
|
+
.attr('x', (d) => d.x)
|
|
54
|
+
.attr('y', (d) => d.y)
|
|
55
|
+
.style('font-size', (d) => d.style.fontSize)
|
|
56
|
+
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
57
|
+
.style('fill', (d) => d.style.fontColor || null);
|
|
58
|
+
function handleShapeHover(data) {
|
|
59
|
+
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
60
|
+
if (hoverEnabled) {
|
|
61
|
+
const hovered = data === null || data === void 0 ? void 0 : data.reduce((acc, d) => {
|
|
62
|
+
acc.add(d.data);
|
|
63
|
+
return acc;
|
|
64
|
+
}, new Set());
|
|
65
|
+
cellsSelection.attr('fill', (d) => {
|
|
66
|
+
var _a;
|
|
67
|
+
const fillColor = d.color;
|
|
68
|
+
if (hovered === null || hovered === void 0 ? void 0 : hovered.has(d.data)) {
|
|
69
|
+
return (((_a = color(fillColor)) === null || _a === void 0 ? void 0 : _a.brighter(hoverOptions.brightness).toString()) || fillColor);
|
|
70
|
+
}
|
|
71
|
+
return fillColor;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.funnel', handleShapeHover);
|
|
76
|
+
return () => {
|
|
77
|
+
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.funnel', null);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Path } from 'd3-path';
|
|
2
|
-
import type { DashStyle } from 'src/core/constants';
|
|
3
2
|
import type { FunnelSeriesData, LabelData } from '../../../types';
|
|
4
|
-
import type {
|
|
3
|
+
import type { DashStyle } from '../../constants';
|
|
4
|
+
import type { PreparedFunnelSeries } from '../../series/types';
|
|
5
5
|
export type FunnelItemData = {
|
|
6
6
|
x: number;
|
|
7
7
|
y: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { PreparedHeatmapSeries } from '../../
|
|
1
|
+
import type { PreparedXAxis, PreparedYAxis } from '../../axes/types';
|
|
2
|
+
import type { ChartScale } from '../../scales/types';
|
|
3
|
+
import type { PreparedHeatmapSeries } from '../../series/types';
|
|
4
4
|
import type { PreparedHeatmapData } from './types';
|
|
5
5
|
type PrepareHeatmapDataArgs = {
|
|
6
6
|
series: PreparedHeatmapSeries;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getDomainDataXBySeries, getDomainDataYBySeries, getFormattedValue, getLabelsSize, getTextSizeFn, getTextWithElipsis, isBandScale, } from '
|
|
2
|
-
import { getBandSize } from '
|
|
1
|
+
import { getDomainDataXBySeries, getDomainDataYBySeries, getFormattedValue, getLabelsSize, getTextSizeFn, getTextWithElipsis, isBandScale, } from '../../utils';
|
|
2
|
+
import { getBandSize } from '../../utils/band-size';
|
|
3
3
|
export async function prepareHeatmapData({ series, xAxis, xScale, yAxis, yScale, }) {
|
|
4
4
|
var _a, _b, _c, _d, _e;
|
|
5
5
|
const yDomainData = getDomainDataYBySeries([series]);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Dispatch } from 'd3-dispatch';
|
|
2
|
+
import type { PreparedSeriesOptions } from '../../series/types';
|
|
3
|
+
import type { PreparedHeatmapData } from './types';
|
|
4
|
+
export declare function renderHeatmap(elements: {
|
|
5
|
+
plot: SVGGElement;
|
|
6
|
+
}, preparedData: PreparedHeatmapData, seriesOptions: PreparedSeriesOptions, dispatcher?: Dispatch<object>): () => void;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { color } from 'd3-color';
|
|
2
|
+
import { select } from 'd3-selection';
|
|
3
|
+
import { block } from '../../../utils';
|
|
4
|
+
const b = block('heatmap');
|
|
5
|
+
export function renderHeatmap(elements, preparedData, seriesOptions, dispatcher) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const svgElement = select(elements.plot);
|
|
8
|
+
const hoverOptions = (_b = (_a = seriesOptions.heatmap) === null || _a === void 0 ? void 0 : _a.states) === null || _b === void 0 ? void 0 : _b.hover;
|
|
9
|
+
svgElement.selectAll('*').remove();
|
|
10
|
+
// heatmap cells
|
|
11
|
+
const cellsSelection = svgElement
|
|
12
|
+
.selectAll('rect')
|
|
13
|
+
.data(preparedData.items)
|
|
14
|
+
.join('rect')
|
|
15
|
+
.attr('x', (d) => d.x)
|
|
16
|
+
.attr('y', (d) => d.y)
|
|
17
|
+
.attr('height', (d) => d.height)
|
|
18
|
+
.attr('width', (d) => d.width)
|
|
19
|
+
.attr('fill', (d) => d.color)
|
|
20
|
+
.attr('stroke', (d) => d.borderColor)
|
|
21
|
+
.attr('stroke-width', (d) => d.borderWidth);
|
|
22
|
+
// dataLabels
|
|
23
|
+
svgElement
|
|
24
|
+
.selectAll('text')
|
|
25
|
+
.data(preparedData.labels)
|
|
26
|
+
.join('text')
|
|
27
|
+
.html((d) => d.text)
|
|
28
|
+
.attr('class', b('label'))
|
|
29
|
+
.attr('x', (d) => d.x)
|
|
30
|
+
.attr('y', (d) => d.y)
|
|
31
|
+
.style('font-size', (d) => d.style.fontSize)
|
|
32
|
+
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
33
|
+
.style('fill', (d) => d.style.fontColor || null);
|
|
34
|
+
function handleShapeHover(data) {
|
|
35
|
+
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
36
|
+
if (hoverEnabled) {
|
|
37
|
+
const hovered = data === null || data === void 0 ? void 0 : data.reduce((acc, d) => {
|
|
38
|
+
acc.add(d.data);
|
|
39
|
+
return acc;
|
|
40
|
+
}, new Set());
|
|
41
|
+
cellsSelection.attr('fill', (d) => {
|
|
42
|
+
var _a;
|
|
43
|
+
const fillColor = d.color;
|
|
44
|
+
if (hovered === null || hovered === void 0 ? void 0 : hovered.has(d.data)) {
|
|
45
|
+
return (((_a = color(fillColor)) === null || _a === void 0 ? void 0 : _a.brighter(hoverOptions.brightness).toString()) || fillColor);
|
|
46
|
+
}
|
|
47
|
+
return fillColor;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.heatmap', handleShapeHover);
|
|
52
|
+
return () => {
|
|
53
|
+
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.heatmap', null);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseTextStyle, HeatmapSeriesData, HtmlItem } from '../../../types';
|
|
2
|
-
import type { PreparedHeatmapSeries } from '../../
|
|
2
|
+
import type { PreparedHeatmapSeries } from '../../series/types';
|
|
3
3
|
export type HeatmapItem = {
|
|
4
4
|
x: number;
|
|
5
5
|
y: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { PreparedSplit } from '../../../core/layout/split-types';
|
|
2
|
-
import type { ChartScale } from '../../../core/scales/types';
|
|
3
1
|
import type { ShapeDataWithLabels } from '../../../types';
|
|
4
|
-
import type { PreparedXAxis, PreparedYAxis } from '../../
|
|
5
|
-
import type {
|
|
2
|
+
import type { PreparedXAxis, PreparedYAxis } from '../../axes/types';
|
|
3
|
+
import type { PreparedSplit } from '../../layout/split-types';
|
|
4
|
+
import type { ChartScale } from '../../scales/types';
|
|
5
|
+
import type { PreparedLineSeries, PreparedSeriesOptions } from '../../series/types';
|
|
6
6
|
import type { PreparedLineData } from './types';
|
|
7
7
|
export declare const prepareLineData: (args: {
|
|
8
8
|
series: PreparedLineSeries[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { prepareAnnotation } from '
|
|
2
|
-
import { filterOverlappingLabels, getLabelsSize, getTextSizeFn } from '
|
|
3
|
-
import { getFormattedValue } from '
|
|
1
|
+
import { prepareAnnotation } from '../../series/prepare-annotation';
|
|
2
|
+
import { filterOverlappingLabels, getLabelsSize, getTextSizeFn } from '../../utils';
|
|
3
|
+
import { getFormattedValue } from '../../utils/format';
|
|
4
4
|
import { getXValue, getYValue } from '../utils';
|
|
5
5
|
async function getHtmlLabel(point, series, xMax) {
|
|
6
6
|
var _a;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Dispatch } from 'd3-dispatch';
|
|
2
|
+
import type { PreparedSeriesOptions } from '../../series/types';
|
|
3
|
+
import type { PreparedLineData } from './types';
|
|
4
|
+
export declare function renderLine(elements: {
|
|
5
|
+
plot: SVGGElement;
|
|
6
|
+
markers: SVGGElement;
|
|
7
|
+
hoverMarkers: SVGGElement;
|
|
8
|
+
annotations: SVGGElement;
|
|
9
|
+
boundsWidth: number;
|
|
10
|
+
boundsHeight: number;
|
|
11
|
+
}, preparedData: PreparedLineData[], seriesOptions: PreparedSeriesOptions, dispatcher?: Dispatch<object>): () => void;
|