@elliemae/ds-dataviz 3.80.0-next.65 → 3.80.0-next.69
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/constants/index.js +73 -0
- package/dist/cjs/constants/index.js.map +7 -0
- package/dist/cjs/graphs/Chart/Chart.js +6 -1
- package/dist/cjs/graphs/Chart/Chart.js.map +2 -2
- package/dist/cjs/graphs/Chart/ChartContext.js.map +2 -2
- package/dist/cjs/graphs/Chart/SingleStackedBar/SingleStackedBar.js +36 -24
- package/dist/cjs/graphs/Chart/SingleStackedBar/SingleStackedBar.js.map +3 -3
- package/dist/cjs/graphs/Chart/SingleStackedBar/styles.js +12 -5
- package/dist/cjs/graphs/Chart/SingleStackedBar/styles.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/chartInteractionStore.js +98 -0
- package/dist/cjs/graphs/Chart/config/chartInteractionStore.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useChart.js +56 -40
- package/dist/cjs/graphs/Chart/config/useChart.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useChartDescription.js +62 -0
- package/dist/cjs/graphs/Chart/config/useChartDescription.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useEntranceAnimation.js +141 -0
- package/dist/cjs/graphs/Chart/config/useEntranceAnimation.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useGetters.js +10 -0
- package/dist/cjs/graphs/Chart/config/useGetters.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useInternalMargins.js +25 -5
- package/dist/cjs/graphs/Chart/config/useInternalMargins.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js +35 -51
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useScales.js +200 -67
- package/dist/cjs/graphs/Chart/config/useScales.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useValidateProps.js +53 -4
- package/dist/cjs/graphs/Chart/config/useValidateProps.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useValueAxisTransition.js +128 -0
- package/dist/cjs/graphs/Chart/config/useValueAxisTransition.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useWheelScroll.js +111 -0
- package/dist/cjs/graphs/Chart/config/useWheelScroll.js.map +7 -0
- package/dist/cjs/graphs/Chart/helpers/alignedTicks.js +56 -0
- package/dist/cjs/graphs/Chart/helpers/alignedTicks.js.map +7 -0
- package/dist/cjs/graphs/Chart/helpers/barPath.js +53 -0
- package/dist/cjs/graphs/Chart/helpers/barPath.js.map +7 -0
- package/dist/cjs/graphs/Chart/{react-desc-prop-types.js → helpers/dataInView.js} +26 -27
- package/dist/cjs/graphs/Chart/helpers/dataInView.js.map +7 -0
- package/dist/cjs/graphs/Chart/helpers/index.js +34 -0
- package/dist/cjs/graphs/Chart/helpers/index.js.map +2 -2
- package/dist/cjs/graphs/Chart/{SingleStackedBar/exported-related/theming.js → helpers/logAxis.js} +13 -9
- package/dist/cjs/graphs/Chart/helpers/logAxis.js.map +7 -0
- package/dist/cjs/graphs/Chart/helpers/tickRotation.js +54 -0
- package/dist/cjs/graphs/Chart/helpers/tickRotation.js.map +7 -0
- package/dist/cjs/graphs/Chart/helpers/timeTicks.js +56 -0
- package/dist/cjs/graphs/Chart/helpers/timeTicks.js.map +7 -0
- package/dist/cjs/graphs/Chart/helpers/trend.js +45 -0
- package/dist/cjs/graphs/Chart/helpers/trend.js.map +7 -0
- package/dist/cjs/graphs/Chart/{SingleStackedBar/exported-related/index.js → helpers/useSerieDimming.js} +20 -6
- package/dist/cjs/graphs/Chart/helpers/useSerieDimming.js.map +7 -0
- package/dist/cjs/graphs/Chart/helpers/useUniqueData.js +15 -18
- package/dist/cjs/graphs/Chart/helpers/useUniqueData.js.map +2 -2
- package/dist/cjs/graphs/Chart/helpers/useVirtualizedSeries.js +12 -5
- package/dist/cjs/graphs/Chart/helpers/useVirtualizedSeries.js.map +2 -2
- package/dist/cjs/graphs/Chart/{DataTestIds.js → helpers/zeroLine.js} +12 -9
- package/dist/cjs/graphs/Chart/helpers/zeroLine.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/A11yRegion.js +8 -2
- package/dist/cjs/graphs/Chart/parts/A11yRegion.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/Axis.js +40 -4
- package/dist/cjs/graphs/Chart/parts/Axis/Axis.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js +18 -4
- package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js +14 -6
- package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js +14 -4
- package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/GridLine.js +15 -1
- package/dist/cjs/graphs/Chart/parts/Axis/GridLine.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/Tick.js +10 -4
- package/dist/cjs/graphs/Chart/parts/Axis/Tick.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/useTickTransition.js +170 -0
- package/dist/cjs/graphs/Chart/parts/Axis/useTickTransition.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js +41 -19
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/FocusableRegion.js +6 -3
- package/dist/cjs/graphs/Chart/parts/FocusableRegion.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/HoverBand.js +86 -0
- package/dist/cjs/graphs/Chart/parts/HoverBand.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Labels/Label.js +12 -1
- package/dist/cjs/graphs/Chart/parts/Labels/Label.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Labels/index.js +12 -4
- package/dist/cjs/graphs/Chart/parts/Labels/index.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/BottomLegend.js +6 -3
- package/dist/cjs/graphs/Chart/parts/Legend/BottomLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/LeftLegend.js +2 -6
- package/dist/cjs/graphs/Chart/parts/Legend/LeftLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js +91 -9
- package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/RightLegend.js +3 -4
- package/dist/cjs/graphs/Chart/parts/Legend/RightLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/TopLegend.js +8 -6
- package/dist/cjs/graphs/Chart/parts/Legend/TopLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/Scrapper.js +29 -3
- package/dist/cjs/graphs/Chart/parts/Scrapper/Scrapper.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js +82 -55
- package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +3 -3
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapper.js +14 -6
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +67 -43
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +2 -2
- package/dist/cjs/graphs/Chart/{SingleStackedBar/exported-related/data-test-ids.js → parts/ScreenReaderText.js} +17 -7
- package/dist/cjs/graphs/Chart/parts/ScreenReaderText.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Scroller/BlurMask.js +14 -9
- package/dist/cjs/graphs/Chart/parts/Scroller/BlurMask.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/Controllers.js +152 -49
- package/dist/cjs/graphs/Chart/parts/Scroller/Controllers.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarX.js +22 -6
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarX.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarY.js +13 -6
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarY.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerX.js +42 -35
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerY.js +9 -4
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerY.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/SeriesFactory.js +39 -30
- package/dist/cjs/graphs/Chart/parts/SeriesFactory.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/TrendHighlight.js +57 -19
- package/dist/cjs/graphs/Chart/parts/TrendHighlight.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/ZeroLine.js +66 -0
- package/dist/cjs/graphs/Chart/parts/ZeroLine.js.map +7 -0
- package/dist/cjs/graphs/Chart/scales/index.js +50 -20
- package/dist/cjs/graphs/Chart/scales/index.js.map +3 -3
- package/dist/cjs/graphs/Chart/series/Area.js +76 -9
- package/dist/cjs/graphs/Chart/series/Area.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Bars.js +3 -1
- package/dist/cjs/graphs/Chart/series/Bars.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/HorizontalBars.js +4 -1
- package/dist/cjs/graphs/Chart/series/HorizontalBars.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/HorizontalStackedBars.js +14 -7
- package/dist/cjs/graphs/Chart/series/HorizontalStackedBars.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Line.js +9 -7
- package/dist/cjs/graphs/Chart/series/Line.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Point.js +114 -128
- package/dist/cjs/graphs/Chart/series/Point.js.map +3 -3
- package/dist/cjs/graphs/Chart/series/Points.js +8 -2
- package/dist/cjs/graphs/Chart/series/Points.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Rect.js +133 -122
- package/dist/cjs/graphs/Chart/series/Rect.js.map +3 -3
- package/dist/cjs/graphs/Chart/series/StackedBar.js +14 -6
- package/dist/cjs/graphs/Chart/series/StackedBar.js.map +2 -2
- package/dist/cjs/graphs/Chart/styles.js +65 -34
- package/dist/cjs/graphs/Chart/styles.js.map +2 -2
- package/dist/cjs/graphs/constants.js +24 -9
- package/dist/cjs/graphs/constants.js.map +2 -2
- package/dist/cjs/index.js +17 -6
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/react-desc-prop-types.js +150 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/typescript-testing/slot-props.js +69 -0
- package/dist/cjs/typescript-testing/slot-props.js.map +7 -0
- package/dist/cjs/typescript-testing/typescript-data-viz-valid.js +34 -2
- package/dist/cjs/typescript-testing/typescript-data-viz-valid.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-single-stacked-bar-valid.js +93 -0
- package/dist/cjs/typescript-testing/typescript-single-stacked-bar-valid.js.map +7 -0
- package/dist/esm/constants/index.js +43 -0
- package/dist/esm/constants/index.js.map +7 -0
- package/dist/esm/graphs/Chart/Chart.js +6 -1
- package/dist/esm/graphs/Chart/Chart.js.map +2 -2
- package/dist/esm/graphs/Chart/ChartContext.js.map +2 -2
- package/dist/esm/graphs/Chart/SingleStackedBar/SingleStackedBar.js +40 -23
- package/dist/esm/graphs/Chart/SingleStackedBar/SingleStackedBar.js.map +2 -2
- package/dist/esm/graphs/Chart/SingleStackedBar/styles.js +12 -5
- package/dist/esm/graphs/Chart/SingleStackedBar/styles.js.map +2 -2
- package/dist/esm/graphs/Chart/config/chartInteractionStore.js +68 -0
- package/dist/esm/graphs/Chart/config/chartInteractionStore.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useChart.js +58 -42
- package/dist/esm/graphs/Chart/config/useChart.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useChartDescription.js +32 -0
- package/dist/esm/graphs/Chart/config/useChartDescription.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useEntranceAnimation.js +111 -0
- package/dist/esm/graphs/Chart/config/useEntranceAnimation.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useGetters.js +10 -0
- package/dist/esm/graphs/Chart/config/useGetters.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useInternalMargins.js +26 -6
- package/dist/esm/graphs/Chart/config/useInternalMargins.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js +35 -51
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useScales.js +202 -69
- package/dist/esm/graphs/Chart/config/useScales.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useValidateProps.js +53 -4
- package/dist/esm/graphs/Chart/config/useValidateProps.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useValueAxisTransition.js +98 -0
- package/dist/esm/graphs/Chart/config/useValueAxisTransition.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useWheelScroll.js +81 -0
- package/dist/esm/graphs/Chart/config/useWheelScroll.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/alignedTicks.js +26 -0
- package/dist/esm/graphs/Chart/helpers/alignedTicks.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/barPath.js +23 -0
- package/dist/esm/graphs/Chart/helpers/barPath.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/dataInView.js +28 -0
- package/dist/esm/graphs/Chart/helpers/dataInView.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/index.js +34 -0
- package/dist/esm/graphs/Chart/helpers/index.js.map +2 -2
- package/dist/esm/graphs/Chart/helpers/logAxis.js +14 -0
- package/dist/esm/graphs/Chart/helpers/logAxis.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/tickRotation.js +24 -0
- package/dist/esm/graphs/Chart/helpers/tickRotation.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/timeTicks.js +26 -0
- package/dist/esm/graphs/Chart/helpers/timeTicks.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/trend.js +15 -0
- package/dist/esm/graphs/Chart/helpers/trend.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/useSerieDimming.js +15 -0
- package/dist/esm/graphs/Chart/helpers/useSerieDimming.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/useUniqueData.js +15 -18
- package/dist/esm/graphs/Chart/helpers/useUniqueData.js.map +2 -2
- package/dist/esm/graphs/Chart/helpers/useVirtualizedSeries.js +12 -5
- package/dist/esm/graphs/Chart/helpers/useVirtualizedSeries.js.map +2 -2
- package/dist/esm/graphs/Chart/helpers/zeroLine.js +13 -0
- package/dist/esm/graphs/Chart/helpers/zeroLine.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/A11yRegion.js +7 -1
- package/dist/esm/graphs/Chart/parts/A11yRegion.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/Axis.js +40 -4
- package/dist/esm/graphs/Chart/parts/Axis/Axis.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js +18 -4
- package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js +14 -6
- package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js +14 -4
- package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/GridLine.js +16 -2
- package/dist/esm/graphs/Chart/parts/Axis/GridLine.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/Tick.js +11 -5
- package/dist/esm/graphs/Chart/parts/Axis/Tick.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/useTickTransition.js +140 -0
- package/dist/esm/graphs/Chart/parts/Axis/useTickTransition.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/ChartContainer.js +41 -19
- package/dist/esm/graphs/Chart/parts/ChartContainer.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/FocusableRegion.js +7 -4
- package/dist/esm/graphs/Chart/parts/FocusableRegion.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/HoverBand.js +56 -0
- package/dist/esm/graphs/Chart/parts/HoverBand.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Labels/Label.js +12 -1
- package/dist/esm/graphs/Chart/parts/Labels/Label.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Labels/index.js +12 -4
- package/dist/esm/graphs/Chart/parts/Labels/index.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/BottomLegend.js +7 -4
- package/dist/esm/graphs/Chart/parts/Legend/BottomLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/LeftLegend.js +3 -7
- package/dist/esm/graphs/Chart/parts/Legend/LeftLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js +91 -9
- package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/RightLegend.js +4 -5
- package/dist/esm/graphs/Chart/parts/Legend/RightLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/TopLegend.js +9 -7
- package/dist/esm/graphs/Chart/parts/Legend/TopLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/Scrapper.js +29 -3
- package/dist/esm/graphs/Chart/parts/Scrapper/Scrapper.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js +83 -56
- package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +3 -3
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapper.js +14 -6
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +68 -44
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/ScreenReaderText.js +18 -0
- package/dist/esm/graphs/Chart/parts/ScreenReaderText.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Scroller/BlurMask.js +14 -9
- package/dist/esm/graphs/Chart/parts/Scroller/BlurMask.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/Controllers.js +154 -51
- package/dist/esm/graphs/Chart/parts/Scroller/Controllers.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarX.js +22 -6
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarX.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarY.js +13 -6
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarY.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerX.js +43 -36
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerY.js +10 -5
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerY.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/SeriesFactory.js +40 -31
- package/dist/esm/graphs/Chart/parts/SeriesFactory.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/TrendHighlight.js +58 -20
- package/dist/esm/graphs/Chart/parts/TrendHighlight.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/ZeroLine.js +36 -0
- package/dist/esm/graphs/Chart/parts/ZeroLine.js.map +7 -0
- package/dist/esm/graphs/Chart/scales/index.js +51 -21
- package/dist/esm/graphs/Chart/scales/index.js.map +3 -3
- package/dist/esm/graphs/Chart/series/Area.js +77 -10
- package/dist/esm/graphs/Chart/series/Area.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Bars.js +3 -1
- package/dist/esm/graphs/Chart/series/Bars.js.map +2 -2
- package/dist/esm/graphs/Chart/series/HorizontalBars.js +4 -1
- package/dist/esm/graphs/Chart/series/HorizontalBars.js.map +2 -2
- package/dist/esm/graphs/Chart/series/HorizontalStackedBars.js +15 -8
- package/dist/esm/graphs/Chart/series/HorizontalStackedBars.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Line.js +9 -7
- package/dist/esm/graphs/Chart/series/Line.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Point.js +120 -130
- package/dist/esm/graphs/Chart/series/Point.js.map +3 -3
- package/dist/esm/graphs/Chart/series/Points.js +8 -2
- package/dist/esm/graphs/Chart/series/Points.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Rect.js +134 -123
- package/dist/esm/graphs/Chart/series/Rect.js.map +3 -3
- package/dist/esm/graphs/Chart/series/StackedBar.js +15 -7
- package/dist/esm/graphs/Chart/series/StackedBar.js.map +2 -2
- package/dist/esm/graphs/Chart/styles.js +66 -35
- package/dist/esm/graphs/Chart/styles.js.map +2 -2
- package/dist/esm/graphs/constants.js +25 -10
- package/dist/esm/graphs/constants.js.map +2 -2
- package/dist/esm/index.js +19 -7
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +125 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/esm/typescript-testing/slot-props.js +46 -0
- package/dist/esm/typescript-testing/slot-props.js.map +7 -0
- package/dist/esm/typescript-testing/typescript-data-viz-valid.js +35 -3
- package/dist/esm/typescript-testing/typescript-data-viz-valid.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-single-stacked-bar-valid.js +70 -0
- package/dist/esm/typescript-testing/typescript-single-stacked-bar-valid.js.map +7 -0
- package/dist/types/constants/index.d.ts +42 -0
- package/dist/types/graphs/Chart/Chart.d.ts +4 -2
- package/dist/types/graphs/Chart/ChartContext.d.ts +9 -11
- package/dist/types/graphs/Chart/SingleStackedBar/SingleStackedBar.d.ts +1 -1
- package/dist/types/graphs/Chart/config/chartInteractionStore.d.ts +32 -0
- package/dist/types/graphs/Chart/config/useChart.d.ts +9 -11
- package/dist/types/graphs/Chart/config/useChartDescription.d.ts +5 -0
- package/dist/types/graphs/Chart/config/useEntranceAnimation.d.ts +16 -0
- package/dist/types/graphs/Chart/config/useGetters.d.ts +1 -1
- package/dist/types/graphs/Chart/config/useInternalMargins.d.ts +4 -1
- package/dist/types/graphs/Chart/config/useKeyboardNavigation.d.ts +1 -1
- package/dist/types/graphs/Chart/config/useScales.d.ts +8 -2
- package/dist/types/graphs/Chart/config/useValidateProps.d.ts +7 -1
- package/dist/types/graphs/Chart/config/useValueAxisTransition.d.ts +6 -0
- package/dist/types/graphs/Chart/config/useWheelScroll.d.ts +2 -0
- package/dist/types/graphs/Chart/helpers/alignedTicks.d.ts +1 -0
- package/dist/types/graphs/Chart/helpers/barPath.d.ts +11 -0
- package/dist/types/graphs/Chart/helpers/dataInView.d.ts +6 -0
- package/dist/types/graphs/Chart/helpers/index.d.ts +10 -1
- package/dist/types/graphs/Chart/helpers/logAxis.d.ts +8 -0
- package/dist/types/graphs/Chart/helpers/tickRotation.d.ts +2 -0
- package/dist/types/graphs/Chart/helpers/timeTicks.d.ts +2 -0
- package/dist/types/graphs/Chart/helpers/trend.d.ts +3 -0
- package/dist/types/graphs/Chart/helpers/useSerieDimming.d.ts +3 -0
- package/dist/types/graphs/Chart/helpers/useUniqueData.d.ts +1 -1
- package/dist/types/graphs/Chart/helpers/useVirtualizedSeries.d.ts +1 -1
- package/dist/types/graphs/Chart/helpers/zeroLine.d.ts +2 -0
- package/dist/types/graphs/Chart/parts/Axis/Axis.d.ts +4 -1
- package/dist/types/graphs/Chart/parts/Axis/Tick.d.ts +1 -0
- package/dist/types/graphs/Chart/parts/Axis/useTickTransition.d.ts +24 -0
- package/dist/types/graphs/Chart/parts/HoverBand.d.ts +2 -0
- package/dist/types/graphs/Chart/parts/Labels/Label.d.ts +3 -0
- package/dist/types/graphs/Chart/parts/Scrapper/ScrapperLine.d.ts +11 -1
- package/dist/types/graphs/Chart/parts/Scrapper/VerticalScrapperLine.d.ts +6 -7
- package/dist/types/graphs/Chart/parts/ScreenReaderText.d.ts +5 -0
- package/dist/types/graphs/Chart/parts/TrendHighlight.d.ts +3 -2
- package/dist/types/graphs/Chart/parts/ZeroLine.d.ts +2 -0
- package/dist/types/graphs/Chart/scales/index.d.ts +10 -3
- package/dist/types/graphs/Chart/series/Area.d.ts +1 -1
- package/dist/types/graphs/Chart/series/Bars.d.ts +1 -1
- package/dist/types/graphs/Chart/series/HorizontalBars.d.ts +1 -1
- package/dist/types/graphs/Chart/series/HorizontalStackedBars.d.ts +1 -1
- package/dist/types/graphs/Chart/series/Line.d.ts +1 -1
- package/dist/types/graphs/Chart/series/Point.d.ts +3 -2
- package/dist/types/graphs/Chart/series/Points.d.ts +1 -1
- package/dist/types/graphs/Chart/series/Rect.d.ts +3 -2
- package/dist/types/graphs/Chart/series/StackedBar.d.ts +1 -1
- package/dist/types/graphs/Chart/styles.d.ts +18 -5
- package/dist/types/graphs/constants.d.ts +13 -1
- package/dist/types/index.d.ts +6 -1
- package/dist/types/react-desc-prop-types.d.ts +228 -0
- package/package.json +8 -7
- package/dist/cjs/graphs/Chart/DataTestIds.js.map +0 -7
- package/dist/cjs/graphs/Chart/SingleStackedBar/exported-related/data-test-ids.js.map +0 -7
- package/dist/cjs/graphs/Chart/SingleStackedBar/exported-related/index.js.map +0 -7
- package/dist/cjs/graphs/Chart/SingleStackedBar/exported-related/theming.js.map +0 -7
- package/dist/cjs/graphs/Chart/SingleStackedBar/index.js +0 -31
- package/dist/cjs/graphs/Chart/SingleStackedBar/index.js.map +0 -7
- package/dist/cjs/graphs/Chart/SingleStackedBar/react-desc-prop-types.js +0 -51
- package/dist/cjs/graphs/Chart/SingleStackedBar/react-desc-prop-types.js.map +0 -7
- package/dist/cjs/graphs/Chart/index.js +0 -33
- package/dist/cjs/graphs/Chart/index.js.map +0 -7
- package/dist/cjs/graphs/Chart/react-desc-prop-types.js.map +0 -7
- package/dist/cjs/graphs/index.js +0 -31
- package/dist/cjs/graphs/index.js.map +0 -7
- package/dist/esm/graphs/Chart/DataTestIds.js +0 -10
- package/dist/esm/graphs/Chart/DataTestIds.js.map +0 -7
- package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/data-test-ids.js +0 -8
- package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/data-test-ids.js.map +0 -7
- package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/index.js +0 -4
- package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/index.js.map +0 -7
- package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/theming.js +0 -10
- package/dist/esm/graphs/Chart/SingleStackedBar/exported-related/theming.js.map +0 -7
- package/dist/esm/graphs/Chart/SingleStackedBar/index.js +0 -4
- package/dist/esm/graphs/Chart/SingleStackedBar/index.js.map +0 -7
- package/dist/esm/graphs/Chart/SingleStackedBar/react-desc-prop-types.js +0 -21
- package/dist/esm/graphs/Chart/SingleStackedBar/react-desc-prop-types.js.map +0 -7
- package/dist/esm/graphs/Chart/index.js +0 -6
- package/dist/esm/graphs/Chart/index.js.map +0 -7
- package/dist/esm/graphs/Chart/react-desc-prop-types.js +0 -29
- package/dist/esm/graphs/Chart/react-desc-prop-types.js.map +0 -7
- package/dist/esm/graphs/index.js +0 -4
- package/dist/esm/graphs/index.js.map +0 -7
- package/dist/types/graphs/Chart/DataTestIds.d.ts +0 -5
- package/dist/types/graphs/Chart/SingleStackedBar/exported-related/data-test-ids.d.ts +0 -3
- package/dist/types/graphs/Chart/SingleStackedBar/exported-related/index.d.ts +0 -2
- package/dist/types/graphs/Chart/SingleStackedBar/exported-related/theming.d.ts +0 -4
- package/dist/types/graphs/Chart/SingleStackedBar/index.d.ts +0 -3
- package/dist/types/graphs/Chart/SingleStackedBar/react-desc-prop-types.d.ts +0 -44
- package/dist/types/graphs/Chart/index.d.ts +0 -4
- package/dist/types/graphs/Chart/react-desc-prop-types.d.ts +0 -510
- package/dist/types/graphs/index.d.ts +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/scales/index.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-classes-per-file */\n/* eslint-disable max-lines */\nimport type { ScaleBand, ScaleLinear, ScaleLogarithmic, ScaleTime } from 'd3';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-classes-per-file */\n/* eslint-disable max-lines */\nimport type { ScaleBand, ScaleLinear, ScaleLogarithmic, ScaleTime } from 'd3';\nimport { utcFormat, format } from 'd3';\nimport type { DSChartT } from '../../../react-desc-prop-types.js';\nimport { TIME_INTERVALS } from '../../constants.js';\nimport { formatTimeTick } from '../helpers/timeTicks.js';\n\nexport const AXIS_TYPE = {\n BAND: 'BAND',\n LINEAR: 'LINEAR',\n DATETIME: 'DATETIME',\n LOG: 'LOG',\n} as const;\n\nconst getInterval = (interval?: string) =>\n interval && interval in TIME_INTERVALS ? TIME_INTERVALS[interval as DSChartT.IntervalT] : null;\n\nexport class Scale {\n scale: ScaleBand<string> | ScaleLinear<number, number, never> | ScaleTime<number, number, never>;\n\n type: string;\n\n constructor(scale: ScaleBand<string> | ScaleLinear<number, number, never> | ScaleTime<number, number, never>) {\n this.type = '';\n this.scale = scale;\n }\n\n getBandwidth() {\n return 0;\n }\n}\nexport class BandScale extends Scale {\n type: keyof typeof AXIS_TYPE;\n\n scale: ScaleBand<string>;\n\n axisProps: DSChartT.AxisT;\n\n constructor(scale: ScaleBand<string>, axisProps: DSChartT.AxisT) {\n super(scale);\n this.scale = scale;\n this.type = 'BAND';\n this.axisProps = axisProps;\n }\n\n get(value: string) {\n if (typeof value !== 'string') return 0;\n return this.scale(value);\n }\n\n getTicks() {\n return this.scale.domain();\n }\n\n getTickFormatted(t: number | string | Date) {\n if (typeof t !== 'string') return t;\n if (typeof this.axisProps?.tick?.tickFormat === 'function') {\n return this.axisProps?.tick?.tickFormat(t);\n }\n return t;\n }\n\n getTicksScaled() {\n return this.scale.domain().map((d) => (this.get(d) ?? 0) + this.getBandwidth() / 2);\n }\n\n getBandwidth() {\n return this.scale.bandwidth();\n }\n\n // the distance from the start of a band to the start of the next one: the band and the padding after it\n getStep() {\n return this.scale.step();\n }\n}\n\nexport class LinearScale extends Scale {\n type: keyof typeof AXIS_TYPE;\n\n scale: ScaleLinear<number, number, never>;\n\n axisProps: DSChartT.AxisT;\n\n // the ticks of an axis aligned with another one (see getAlignedTicks), instead of the ones of its own count\n alignedTicks: number[] | null;\n\n constructor(\n scale: ScaleLinear<number, number, never>,\n axisProps: DSChartT.AxisT,\n alignedTicks: number[] | null = null,\n ) {\n super(scale);\n this.scale = scale;\n this.type = 'LINEAR';\n this.axisProps = axisProps;\n this.alignedTicks = alignedTicks;\n }\n\n get(value: number) {\n if (typeof value !== 'number') return 0;\n return this.scale(value);\n }\n\n getTickFormatted(t: number | string | Date) {\n if (typeof t !== 'number') return t.toString();\n if (typeof this.axisProps?.tick?.tickFormat === 'function') {\n return this.axisProps?.tick?.tickFormat(t);\n }\n if (typeof this.axisProps?.tick?.tickFormat === 'string') {\n return format(this.axisProps?.tick?.tickFormat)(t);\n }\n return t.toString();\n }\n\n getTickCount(dimension: number) {\n return this.axisProps?.tick?.tickCount ?? Math.ceil(dimension / 80);\n }\n\n getTicks(dimension: number) {\n if (this.alignedTicks) return this.withTickValues([...this.alignedTicks]);\n return this.withTickValues(this.scale.ticks?.(this.getTickCount(dimension)));\n }\n\n // the ticks given through tick.tickValues: instead of the computed ones with overwriteTicks, added to them otherwise\n withTickValues(ticks: number[]) {\n if (this.axisProps?.tick?.tickValues) {\n if (this.axisProps?.tick?.overwriteTicks) return this.axisProps?.tick?.tickValues;\n this.axisProps?.tick?.tickValues.forEach((t) => {\n if (typeof t !== 'number') return;\n const isTickAlreadyPresent = ticks.find((tick) => tick === t);\n if (isTickAlreadyPresent) return;\n ticks.push(t);\n });\n }\n return ticks;\n }\n\n getTicksScaled(dimension: number) {\n const ticks = this.getTicks(dimension);\n return ticks.map((t) => (typeof t === 'number' ? this.get(t) : 0));\n }\n}\n\n// the leading digits of the ticks a log axis can keep, from the sparsest set to the densest\nconst LOG_TICK_DIGITS = [[1], [1, 2, 5], [1, 2, 3, 4, 5, 6, 7, 8, 9]];\n\nexport class LogScale extends LinearScale {\n type: keyof typeof AXIS_TYPE;\n\n scale: ScaleLogarithmic<number, number, never>;\n\n axisProps: DSChartT.AxisT;\n\n constructor(scale: ScaleLogarithmic<number, number, never>, axisProps: DSChartT.AxisT) {\n super(scale, axisProps);\n this.scale = scale;\n this.type = 'LOG';\n this.axisProps = axisProps;\n }\n\n // When the domain spans few powers of ten, d3 places a tick on every 1 to 9 of each one, and on a regular axis their\n // labels overlap. Of those ticks, the axis keeps the densest set that fits its tick count: the powers of ten, then 1,\n // 2 and 5 of each power, then all of them. A domain that holds no power of ten keeps 1, 2 and 5 of its own.\n getTicks(dimension: number) {\n const count = Math.max(1, this.getTickCount(dimension));\n const candidates = this.scale.ticks();\n const leadingDigit = (tick: number) => Math.round(Math.abs(tick) / 10 ** Math.floor(Math.log10(Math.abs(tick))));\n const tickSets = LOG_TICK_DIGITS.map((digits) => candidates.filter((tick) => digits.includes(leadingDigit(tick))));\n const fitting = tickSets.filter((ticks) => ticks.length > 0 && ticks.length <= count);\n const ticks = fitting[fitting.length - 1] ?? tickSets.find((set) => set.length > 0) ?? candidates;\n return this.withTickValues([...ticks]);\n }\n\n getTickFormatted(t: number | string | Date) {\n if (typeof t !== 'number') return t.toString();\n if (typeof this.axisProps?.tick?.tickFormat === 'function') {\n return this.axisProps?.tick?.tickFormat(t);\n }\n if (typeof this.axisProps?.tick?.tickFormat === 'string') {\n return format(this.axisProps?.tick?.tickFormat)(t);\n }\n return format('~s')(t);\n }\n}\n\nexport class TimeLinearScale extends Scale {\n type: keyof typeof AXIS_TYPE;\n\n scale: ScaleTime<number, number, never>;\n\n axisProps: DSChartT.AxisT;\n\n // the smallest step between the dates of the axis, in milliseconds (see getMinTimeStep), 0 when unknown\n minTimeStep: number;\n\n constructor(scale: ScaleTime<number, number, never>, axisProps: DSChartT.AxisT, minTimeStep = 0) {\n super(scale);\n this.scale = scale;\n this.type = 'DATETIME';\n this.axisProps = axisProps;\n this.minTimeStep = minTimeStep;\n }\n\n get(value: Date) {\n if (typeof value !== 'object') return 0;\n return this.scale(value);\n }\n\n getTickFormatted(t: number | string | Date) {\n if (typeof t !== 'object') return t.toString();\n if (typeof this.axisProps?.tick?.tickFormat === 'function') {\n return this.axisProps?.tick?.tickFormat(t);\n }\n // The ticks of a time axis sit on UTC boundaries (scaleUtc), so they are formatted in UTC as well: in local time a\n // tick at 00:00 UTC read as the day before west of UTC, and every timezone showed different labels (PUI-16334).\n // Without a format, each tick reads the coarsest unit it starts (see formatTimeTick)\n if (typeof this.axisProps?.tick?.tickFormat === 'string') {\n return utcFormat(this.axisProps?.tick?.tickFormat)(t);\n }\n return formatTimeTick(t);\n }\n\n // Without intervalType, a tick about every 80px of the plot: the plot grows with the zoom, so zooming in turns the\n // ticks from months to weeks, days and hours. They are never closer than the dates of the data, so a daily series\n // gets no ticks on the hours between its days; a tickCount the consumer sets is kept as it is.\n getTickCount(dimension: number) {\n const { tickCount } = this.axisProps?.tick ?? {};\n if (tickCount !== undefined) return tickCount;\n const count = Math.ceil(dimension / 80);\n const [start, end] = this.scale.domain();\n if (!this.minTimeStep || !start || !end) return count;\n return Math.max(1, Math.min(count, Math.floor((+end - +start) / this.minTimeStep)));\n }\n\n getTicks(dimension: number, intervalType?: string) {\n const interval = getInterval(intervalType);\n const finalTickConfig = interval || this.getTickCount(dimension);\n const ticks = this.scale.ticks?.(finalTickConfig as number);\n const ticksValues = this.axisProps?.tick?.tickValues;\n if (ticksValues) {\n if (this.axisProps?.tick?.overwriteTicks) return ticksValues;\n const newTicks = [] as Date[];\n ticks.forEach((t) => {\n if (typeof t !== 'object') return;\n const exists = ticksValues.some(\n (tickValue) => typeof tickValue === 'object' && tickValue.getTime() === t.getTime(),\n );\n if (!exists) newTicks.push(t);\n });\n return [...newTicks, ...ticksValues];\n }\n return ticks;\n }\n\n getTicksScaled(dimension: number, intervalType?: string) {\n const ticks = this.getTicks(dimension, intervalType);\n return ticks.map((t) => (typeof t === 'object' ? this.get(t) : 0));\n }\n}\n\nexport type ScaleT = BandScale | LinearScale | TimeLinearScale;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,gBAAkC;AAElC,uBAA+B;AAC/B,uBAA+B;AAExB,MAAM,YAAY;AAAA,EACvB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,KAAK;AACP;AAEA,MAAM,cAAc,CAAC,aACnB,YAAY,YAAY,kCAAiB,gCAAe,QAA8B,IAAI;AAErF,MAAM,MAAM;AAAA,EACjB;AAAA,EAEA;AAAA,EAEA,YAAY,OAAkG;AAC5G,SAAK,OAAO;AACZ,SAAK,QAAQ;AAAA,EACf;AAAA,EAEA,eAAe;AACb,WAAO;AAAA,EACT;AACF;AACO,MAAM,kBAAkB,MAAM;AAAA,EACnC;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA,YAAY,OAA0B,WAA2B;AAC/D,UAAM,KAAK;AACX,SAAK,QAAQ;AACb,SAAK,OAAO;AACZ,SAAK,YAAY;AAAA,EACnB;AAAA,EAEA,IAAI,OAAe;AACjB,QAAI,OAAO,UAAU,SAAU,QAAO;AACtC,WAAO,KAAK,MAAM,KAAK;AAAA,EACzB;AAAA,EA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A,WAAO;AAAA,EACT;AAAA,EAEA,eAAe,WAAmB,cAAuB;AACvD,UAAM,QAAQ,KAAK,SAAS,WAAW,YAAY;AACnD,WAAO,MAAM,IAAI,CAAC,MAAO,OAAO,MAAM,WAAW,KAAK,IAAI,CAAC,IAAI,CAAE;AAAA,EACnE;AACF;",
|
|
6
|
+
"names": ["ticks"]
|
|
7
7
|
}
|
|
@@ -38,31 +38,98 @@ var import_d3 = require("d3");
|
|
|
38
38
|
var import_styles = require("../styles.js");
|
|
39
39
|
var import_ChartContext = require("../ChartContext.js");
|
|
40
40
|
var import_helpers = require("../helpers/index.js");
|
|
41
|
+
var import_zeroLine = require("../helpers/zeroLine.js");
|
|
42
|
+
var import_scales = require("../scales/index.js");
|
|
41
43
|
var import_Points = require("./Points.js");
|
|
44
|
+
var import_TrendHighlight = require("../parts/TrendHighlight.js");
|
|
45
|
+
var import_useSerieDimming = require("../helpers/useSerieDimming.js");
|
|
42
46
|
var import_constants = require("../../constants.js");
|
|
43
47
|
const Area = ({ serie }) => {
|
|
44
|
-
const {
|
|
48
|
+
const {
|
|
49
|
+
xScale,
|
|
50
|
+
yScale,
|
|
51
|
+
y2Scale,
|
|
52
|
+
getXScaleValue,
|
|
53
|
+
getY2ScaleValue,
|
|
54
|
+
getYScaleValue,
|
|
55
|
+
innerHeight,
|
|
56
|
+
colorScale,
|
|
57
|
+
stackedData,
|
|
58
|
+
getOwnerProps,
|
|
59
|
+
chartId
|
|
60
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
45
61
|
const finalYScale = serie.scale === "y2" ? getY2ScaleValue : getYScaleValue;
|
|
62
|
+
const valueScale = serie.scale === "y2" && y2Scale ? y2Scale : yScale;
|
|
63
|
+
const baseline = (0, import_react.useMemo)(() => {
|
|
64
|
+
if (!(valueScale instanceof import_scales.LinearScale) || valueScale instanceof import_scales.LogScale) return innerHeight;
|
|
65
|
+
const [start, end] = valueScale.scale.domain();
|
|
66
|
+
const closestToZero = Math.min(Math.max(0, Math.min(start, end)), Math.max(start, end));
|
|
67
|
+
const position = valueScale.get(closestToZero);
|
|
68
|
+
return Number.isFinite(position) ? position : innerHeight;
|
|
69
|
+
}, [innerHeight, valueScale]);
|
|
70
|
+
const zeroLinePosition = (0, import_zeroLine.getZeroLinePosition)(valueScale);
|
|
46
71
|
const curveStyle = (0, import_react.useMemo)(() => import_constants.curveStyleMap[serie.curveStyle ?? import_constants.LINE.CURVE_STYLE.LINEAR], [serie.curveStyle]);
|
|
47
72
|
const areaD3 = (0, import_react.useMemo)(() => {
|
|
48
73
|
const serieWithStackedValues = (0, import_helpers.getStackedData)(stackedData, serie);
|
|
49
74
|
if (serieWithStackedValues) {
|
|
50
75
|
return (0, import_d3.area)().x((_, i) => getXScaleValue(serie.data[i])).y0(([, y2]) => finalYScale(y2)).y1(([y1]) => finalYScale(y1)).curve(curveStyle)(serieWithStackedValues);
|
|
51
76
|
}
|
|
52
|
-
return (0, import_d3.area)().x((_, i) => getXScaleValue(serie.data[i])).y0(
|
|
53
|
-
}, [stackedData, serie,
|
|
77
|
+
return (0, import_d3.area)().x((_, i) => getXScaleValue(serie.data[i])).y0(baseline).y1((_, i) => finalYScale(serie.data[i])).curve(curveStyle)(serie.data);
|
|
78
|
+
}, [stackedData, serie, baseline, curveStyle, getXScaleValue, finalYScale]);
|
|
54
79
|
const lineD3 = (0, import_react.useMemo)(() => {
|
|
55
80
|
const serieWithStackedValues = (0, import_helpers.getStackedData)(stackedData, serie);
|
|
56
81
|
if (serieWithStackedValues) {
|
|
57
82
|
return (0, import_d3.line)().x((_, i) => getXScaleValue(serie.data[i])).y(([, y2]) => finalYScale(y2)).curve(curveStyle)(serieWithStackedValues);
|
|
58
83
|
}
|
|
59
|
-
return (0, import_d3.line)().x((_, i) => getXScaleValue(serie.data[i])).y((_, i) =>
|
|
60
|
-
}, [stackedData, serie, curveStyle, getXScaleValue, finalYScale
|
|
84
|
+
return (0, import_d3.line)().x((_, i) => getXScaleValue(serie.data[i])).y((_, i) => finalYScale(serie.data[i])).curve(curveStyle)(serie.data);
|
|
85
|
+
}, [stackedData, serie, curveStyle, getXScaleValue, finalYScale]);
|
|
61
86
|
const xTranslate = (xScale?.getBandwidth() ?? 0) / 2;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
87
|
+
const color = colorScale(serie.name);
|
|
88
|
+
const gradientId = `area-gradient-${chartId}-${serie.key.replace(/[^\w-]/g, "_")}`;
|
|
89
|
+
const dimmedStyle = (0, import_useSerieDimming.useSerieDimming)(serie.name);
|
|
90
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { style: dimmedStyle, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { transform: `translate(${xTranslate}, 0)`, children: [
|
|
91
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
92
|
+
"linearGradient",
|
|
93
|
+
{
|
|
94
|
+
id: gradientId,
|
|
95
|
+
x1: "0",
|
|
96
|
+
x2: "0",
|
|
97
|
+
...zeroLinePosition !== null ? {
|
|
98
|
+
gradientUnits: "userSpaceOnUse",
|
|
99
|
+
// from the far end of the plot: the top, or the bottom when the zero is at the top
|
|
100
|
+
y1: zeroLinePosition > 0 ? 0 : innerHeight,
|
|
101
|
+
y2: zeroLinePosition,
|
|
102
|
+
spreadMethod: "reflect"
|
|
103
|
+
} : { y1: "0", y2: "1" },
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "0%", stopColor: color, stopOpacity: import_constants.MARKS.AREA_TOP_OPACITY }),
|
|
106
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "100%", stopColor: color, stopOpacity: import_constants.MARKS.AREA_BOTTOM_OPACITY })
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
) }),
|
|
110
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
111
|
+
import_styles.StyledArea,
|
|
112
|
+
{
|
|
113
|
+
d: areaD3 ?? "",
|
|
114
|
+
fill: `url(#${gradientId})`,
|
|
115
|
+
getOwnerProps,
|
|
116
|
+
getOwnerPropsArguments: () => ({ serie })
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
120
|
+
"path",
|
|
121
|
+
{
|
|
122
|
+
d: lineD3 ?? "",
|
|
123
|
+
fill: "none",
|
|
124
|
+
strokeWidth: 2,
|
|
125
|
+
strokeLinecap: "round",
|
|
126
|
+
strokeLinejoin: "round",
|
|
127
|
+
stroke: color,
|
|
128
|
+
vectorEffect: "non-scaling-stroke"
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TrendHighlight.TrendHighlight, { serie, linePath: lineD3 }),
|
|
132
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Points.Points, { serie })
|
|
66
133
|
] }) });
|
|
67
134
|
};
|
|
68
135
|
//# sourceMappingURL=Area.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/series/Area.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext, useMemo } from 'react';\nimport { area, line } from 'd3';\nimport { StyledArea } from '../styles.js';\nimport { ChartContext } from '../ChartContext.js';\nimport { getStackedData } from '../helpers/index.js';\nimport { Points } from './Points.js';\nimport { LINE, curveStyleMap } from '../../constants.js';\nimport type { DSChartT } from '
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useMemo } from 'react';\nimport { area, line } from 'd3';\nimport { StyledArea } from '../styles.js';\nimport { ChartContext } from '../ChartContext.js';\nimport { getStackedData } from '../helpers/index.js';\nimport { getZeroLinePosition } from '../helpers/zeroLine.js';\nimport { LinearScale, LogScale } from '../scales/index.js';\nimport { Points } from './Points.js';\nimport { TrendHighlight } from '../parts/TrendHighlight.js';\nimport { useSerieDimming } from '../helpers/useSerieDimming.js';\nimport { LINE, MARKS, curveStyleMap } from '../../constants.js';\nimport type { DSChartT } from '../../../react-desc-prop-types.js';\n\nexport const Area: React.ComponentType<DSChartT.SerieComponentT> = ({ serie }) => {\n const {\n xScale,\n yScale,\n y2Scale,\n getXScaleValue,\n getY2ScaleValue,\n getYScaleValue,\n innerHeight,\n colorScale,\n stackedData,\n getOwnerProps,\n chartId,\n } = useContext(ChartContext);\n\n const finalYScale = serie.scale === 'y2' ? getY2ScaleValue : getYScaleValue;\n const valueScale = serie.scale === 'y2' && y2Scale ? y2Scale : yScale;\n\n // An area without a stack used to fill from the bottom of the plot, so below zero it filled the wrong side: from the\n // negative values down instead of up to zero. It fills from its zero when the axis holds it, and from the end of the\n // axis closest to zero otherwise (the bottom when every value is positive). A log axis has no zero: its bottom.\n const baseline = useMemo(() => {\n if (!(valueScale instanceof LinearScale) || valueScale instanceof LogScale) return innerHeight;\n const [start, end] = valueScale.scale.domain();\n const closestToZero = Math.min(Math.max(0, Math.min(start, end)), Math.max(start, end));\n const position = valueScale.get(closestToZero);\n return Number.isFinite(position) ? position : innerHeight;\n }, [innerHeight, valueScale]);\n // with the zero inside the plot the wash fades toward the zero from both sides, so a value and its negative weigh the\n // same; otherwise it fades from the top of the area to its base\n const zeroLinePosition = getZeroLinePosition(valueScale);\n\n const curveStyle = useMemo(() => curveStyleMap[serie.curveStyle ?? LINE.CURVE_STYLE.LINEAR], [serie.curveStyle]);\n const areaD3 = useMemo(() => {\n const serieWithStackedValues = getStackedData(stackedData, serie);\n if (serieWithStackedValues) {\n return area()\n .x((_, i) => getXScaleValue(serie.data[i]))\n .y0(([, y2]) => finalYScale(y2))\n .y1(([y1]) => finalYScale(y1))\n .curve(curveStyle)(serieWithStackedValues as [number, number][]);\n }\n return area()\n .x((_, i) => getXScaleValue(serie.data[i]))\n .y0(baseline)\n .y1((_, i) => finalYScale(serie.data[i]))\n .curve(curveStyle)(serie.data as unknown as [number, number][]);\n }, [stackedData, serie, baseline, curveStyle, getXScaleValue, finalYScale]);\n\n const lineD3 = useMemo(() => {\n const serieWithStackedValues = getStackedData(stackedData, serie);\n if (serieWithStackedValues) {\n return line()\n .x((_, i) => getXScaleValue(serie.data[i]))\n .y(([, y2]) => finalYScale(y2))\n .curve(curveStyle)(serieWithStackedValues as unknown as [number, number][]);\n }\n return line()\n .x((_, i) => getXScaleValue(serie.data[i]))\n .y((_, i) => finalYScale(serie.data[i]))\n .curve(curveStyle)(serie.data as unknown as [number, number][]);\n }, [stackedData, serie, curveStyle, getXScaleValue, finalYScale]);\n\n const xTranslate = (xScale?.getBandwidth() ?? 0) / 2;\n const color = colorScale(serie.name) as string;\n // the area fades from the series color at its top to almost nothing at its base\n const gradientId = `area-gradient-${chartId}-${serie.key.replace(/[^\\w-]/g, '_')}`;\n\n const dimmedStyle = useSerieDimming(serie.name);\n return (\n <g style={dimmedStyle}>\n <g transform={`translate(${xTranslate}, 0)`}>\n <defs>\n <linearGradient\n id={gradientId}\n x1=\"0\"\n x2=\"0\"\n {...(zeroLinePosition !== null\n ? {\n gradientUnits: 'userSpaceOnUse',\n // from the far end of the plot: the top, or the bottom when the zero is at the top\n y1: zeroLinePosition > 0 ? 0 : innerHeight,\n y2: zeroLinePosition,\n spreadMethod: 'reflect',\n }\n : { y1: '0', y2: '1' })}\n >\n <stop offset=\"0%\" stopColor={color} stopOpacity={MARKS.AREA_TOP_OPACITY} />\n <stop offset=\"100%\" stopColor={color} stopOpacity={MARKS.AREA_BOTTOM_OPACITY} />\n </linearGradient>\n </defs>\n {/* the wash first, then its outline, and the markers on top */}\n <StyledArea\n d={areaD3 ?? ''}\n fill={`url(#${gradientId})`}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={() => ({ serie })}\n />\n <path\n d={lineD3 ?? ''}\n fill=\"none\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n stroke={color}\n // the width stays the same while a transform scales the line (see useValueAxisTransition)\n vectorEffect=\"non-scaling-stroke\"\n />\n <TrendHighlight serie={serie} linePath={lineD3} />\n <Points serie={serie} />\n </g>\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADsFb;AAtFV,mBAA2C;AAC3C,gBAA2B;AAC3B,oBAA2B;AAC3B,0BAA6B;AAC7B,qBAA+B;AAC/B,sBAAoC;AACpC,oBAAsC;AACtC,oBAAuB;AACvB,4BAA+B;AAC/B,6BAAgC;AAChC,uBAA2C;AAGpC,MAAM,OAAsD,CAAC,EAAE,MAAM,MAAM;AAChF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gCAAY;AAE3B,QAAM,cAAc,MAAM,UAAU,OAAO,kBAAkB;AAC7D,QAAM,aAAa,MAAM,UAAU,QAAQ,UAAU,UAAU;AAK/D,QAAM,eAAW,sBAAQ,MAAM;AAC7B,QAAI,EAAE,sBAAsB,8BAAgB,sBAAsB,uBAAU,QAAO;AACnF,UAAM,CAAC,OAAO,GAAG,IAAI,WAAW,MAAM,OAAO;AAC7C,UAAM,gBAAgB,KAAK,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,OAAO,GAAG,CAAC,GAAG,KAAK,IAAI,OAAO,GAAG,CAAC;AACtF,UAAM,WAAW,WAAW,IAAI,aAAa;AAC7C,WAAO,OAAO,SAAS,QAAQ,IAAI,WAAW;AAAA,EAChD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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -45,6 +45,7 @@ const Bars = ({ serie }) => {
|
|
|
45
45
|
getYScaleValue,
|
|
46
46
|
getY2ScaleValue,
|
|
47
47
|
subGroupScale,
|
|
48
|
+
getBandwidth,
|
|
48
49
|
colorScale,
|
|
49
50
|
getXValue,
|
|
50
51
|
getYValue,
|
|
@@ -66,7 +67,8 @@ const Bars = ({ serie }) => {
|
|
|
66
67
|
const yScaled = finalYScale(bar) ?? 0;
|
|
67
68
|
const width = subGroupScale?.bandwidth() ?? 0;
|
|
68
69
|
const height = y > 0 ? positiveSize - yScaled : yScaled - finalYScale(0);
|
|
69
|
-
const
|
|
70
|
+
const slotStart = xScale?.type !== "BAND" ? xScaled - getBandwidth() / 2 : xScaled;
|
|
71
|
+
const transformX = slotStart + ((subGroupScale && subGroupScale(serie.name)) ?? 0);
|
|
70
72
|
const transformY = y > 0 ? finalYScale(0) - height : finalYScale(0);
|
|
71
73
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { id: `${chartId}-${serie.name}-rects-${bar.key}`, transform: `translate(${transformX},0)`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
72
74
|
import_Rect.Rect,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/series/Bars.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\nimport React, { useContext } from 'react';\nimport { Rect } from './Rect.js';\nimport { ChartContext } from '../ChartContext.js';\nimport { A11yRegion } from '../parts/A11yRegion.js';\nimport type { DSChartT } from '
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\nimport React, { useContext } from 'react';\nimport { Rect } from './Rect.js';\nimport { ChartContext } from '../ChartContext.js';\nimport { A11yRegion } from '../parts/A11yRegion.js';\nimport type { DSChartT } from '../../../react-desc-prop-types.js';\n\nexport const Bars: React.ComponentType<DSChartT.SerieComponentT> = ({ serie }) => {\n const {\n innerHeight,\n xScale,\n getXScaleValue,\n getYScaleValue,\n getY2ScaleValue,\n subGroupScale,\n getBandwidth,\n colorScale,\n getXValue,\n getYValue,\n chartId,\n } = useContext(ChartContext);\n const finalYScale = serie.scale === 'y2' ? getY2ScaleValue : getYScaleValue;\n\n const negativeSize = innerHeight - finalYScale(0);\n const positiveSize = innerHeight - negativeSize;\n\n return (\n <A11yRegion\n serieName={serie.name}\n clipPath={`url(#rect-focus-ring-${chartId})`}\n fill={colorScale(serie.name) as string}\n >\n {serie.data.map((bar) => {\n const x = getXValue(bar) as number;\n const y = getYValue(bar) as number;\n const xScaled = getXScaleValue(bar) ?? 0;\n const yScaled = finalYScale(bar) ?? 0;\n const width = subGroupScale?.bandwidth() ?? 0;\n const height = y > 0 ? positiveSize - yScaled : yScaled - finalYScale(0);\n // On a band axis the slot of a category starts at its position; on a linear or a time axis it is centered on the\n // value. Each series takes its place in the slot, so the bars of several series on one date sit side by side\n // instead of on top of each other (a single series stays centered on its value)\n const slotStart = xScale?.type !== 'BAND' ? xScaled - getBandwidth() / 2 : xScaled;\n const transformX = slotStart + ((subGroupScale && subGroupScale(serie.name)) ?? 0);\n\n const transformY = y > 0 ? finalYScale(0) - height : finalYScale(0);\n\n return (\n <g id={`${chartId}-${serie.name}-rects-${bar.key}`} key={bar.key} transform={`translate(${transformX},0)`}>\n <Rect\n name={serie.name}\n xValue={x}\n yValue={y}\n width={width}\n height={height}\n id={bar.key}\n y={transformY}\n isNegative={y < 0}\n datum={bar}\n />\n </g>\n );\n })}\n </A11yRegion>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;A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AAG;AAAA,YACH,YAAY,IAAI;AAAA,YAChB,OAAO;AAAA;AAAA,QACT,KAXuD,IAAI,GAY7D;AAAA,MAEJ,CAAC;AAAA;AAAA,EACH;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -36,6 +36,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
36
36
|
var import_react = require("react");
|
|
37
37
|
var import_Rect = require("./Rect.js");
|
|
38
38
|
var import_ChartContext = require("../ChartContext.js");
|
|
39
|
+
var import_useSerieDimming = require("../helpers/useSerieDimming.js");
|
|
39
40
|
const HorizontalBars = ({ serie }) => {
|
|
40
41
|
const {
|
|
41
42
|
innerWidth,
|
|
@@ -51,8 +52,9 @@ const HorizontalBars = ({ serie }) => {
|
|
|
51
52
|
const finalYScale = serie.scale === "y2" ? getY2ScaleValue : getYScaleValue;
|
|
52
53
|
const negativeSize = innerWidth - getXScaleValue(0);
|
|
53
54
|
const positiveSize = innerWidth - negativeSize;
|
|
55
|
+
const dimmedStyle = (0, import_useSerieDimming.useSerieDimming)(serie.name);
|
|
54
56
|
return (0, import_react.useMemo)(
|
|
55
|
-
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { fill: colorScale(serie.name), clipPath: `url(#rect-focus-ring-${chartId})`, children: serie.data.map((bar) => {
|
|
57
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { fill: colorScale(serie.name), clipPath: `url(#rect-focus-ring-${chartId})`, style: dimmedStyle, children: serie.data.map((bar) => {
|
|
56
58
|
const x = getXValue(bar);
|
|
57
59
|
const y = getYValue(bar);
|
|
58
60
|
const xScaled = getXScaleValue(bar) ?? 0;
|
|
@@ -77,6 +79,7 @@ const HorizontalBars = ({ serie }) => {
|
|
|
77
79
|
[
|
|
78
80
|
chartId,
|
|
79
81
|
colorScale,
|
|
82
|
+
dimmedStyle,
|
|
80
83
|
finalYScale,
|
|
81
84
|
getXScaleValue,
|
|
82
85
|
getXValue,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/series/HorizontalBars.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\nimport React, { useContext, useMemo } from 'react';\nimport { Rect } from './Rect.js';\nimport { ChartContext } from '../ChartContext.js';\nimport type { DSChartT } from '
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\nimport React, { useContext, useMemo } from 'react';\nimport { Rect } from './Rect.js';\nimport { ChartContext } from '../ChartContext.js';\nimport { useSerieDimming } from '../helpers/useSerieDimming.js';\nimport type { DSChartT } from '../../../react-desc-prop-types.js';\n\nexport const HorizontalBars = ({ serie }: DSChartT.SerieComponentT) => {\n const {\n innerWidth,\n subGroupScale,\n getYScaleValue,\n getY2ScaleValue,\n getXScaleValue,\n colorScale,\n getXValue,\n getYValue,\n chartId,\n } = useContext(ChartContext);\n const finalYScale = serie.scale === 'y2' ? getY2ScaleValue : getYScaleValue;\n const negativeSize = innerWidth - getXScaleValue(0);\n const positiveSize = innerWidth - negativeSize;\n\n const dimmedStyle = useSerieDimming(serie.name);\n return useMemo(\n () => (\n <g fill={colorScale(serie.name) as string} clipPath={`url(#rect-focus-ring-${chartId})`} style={dimmedStyle}>\n {serie.data.map((bar) => {\n const x = getXValue(bar) as number;\n const y = getYValue(bar) as number;\n const xScaled = getXScaleValue(bar) ?? 0;\n const width = x < 0 ? positiveSize - xScaled : xScaled - getXScaleValue(0);\n const height = subGroupScale?.bandwidth() ?? 0;\n const transformX = x < 0 ? getXScaleValue(0) - width : getXScaleValue(0);\n const transformY = ((subGroupScale && subGroupScale(serie.name)) ?? 0) + finalYScale(y);\n\n return (\n <g key={bar.key} transform={`translate(${transformX},${transformY})`}>\n <Rect\n datum={bar}\n name={serie.name}\n width={width}\n height={height}\n id={bar.key}\n x={0}\n xValue={x}\n yValue={y}\n />\n </g>\n );\n })}\n </g>\n ),\n [\n chartId,\n colorScale,\n dimmedStyle,\n finalYScale,\n getXScaleValue,\n getXValue,\n getYValue,\n positiveSize,\n serie.data,\n serie.name,\n subGroupScale,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADsCT;AArCd,mBAA2C;AAC3C,kBAAqB;AACrB,0BAA6B;AAC7B,6BAAgC;AAGzB,MAAM,iBAAiB,CAAC,EAAE,MAAM,MAAgC;AACrE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gCAAY;AAC3B,QAAM,cAAc,MAAM,UAAU,OAAO,kBAAkB;AAC7D,QAAM,eAAe,aAAa,eAAe,CAAC;AAClD,QAAM,eAAe,aAAa;AAElC,QAAM,kBAAc,wCAAgB,MAAM,IAAI;AAC9C,aAAO;AAAA,IACL,MACE,4CAAC,OAAE,MAAM,WAAW,MAAM,IAAI,GAAa,UAAU,wBAAwB,OAAO,KAAK,OAAO,aAC7F,gBAAM,KAAK,IAAI,CAAC,QAAQ;AACvB,YAAM,IAAI,UAAU,GAAG;AACvB,YAAM,IAAI,UAAU,GAAG;AACvB,YAAM,UAAU,eAAe,GAAG,KAAK;AACvC,YAAM,QAAQ,IAAI,IAAI,eAAe,UAAU,UAAU,eAAe,CAAC;AACzE,YAAM,SAAS,eAAe,UAAU,KAAK;AAC7C,YAAM,aAAa,IAAI,IAAI,eAAe,CAAC,IAAI,QAAQ,eAAe,CAAC;AACvE,YAAM,eAAe,iBAAiB,cAAc,MAAM,IAAI,MAAM,KAAK,YAAY,CAAC;AAEtF,aACE,4CAAC,OAAgB,WAAW,aAAa,UAAU,IAAI,UAAU,KAC/D;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,UACP,MAAM,MAAM;AAAA,UACZ;AAAA,UACA;AAAA,UACA,IAAI,IAAI;AAAA,UACR,GAAG;AAAA,UACH,QAAQ;AAAA,UACR,QAAQ;AAAA;AAAA,MACV,KAVM,IAAI,GAWZ;AAAA,IAEJ,CAAC,GACH;AAAA,IAEF;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM;AAAA,MACN,MAAM;AAAA,MACN;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -36,7 +36,9 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
36
36
|
var import_react = require("react");
|
|
37
37
|
var import_Rect = require("./Rect.js");
|
|
38
38
|
var import_ChartContext = require("../ChartContext.js");
|
|
39
|
+
var import_useSerieDimming = require("../helpers/useSerieDimming.js");
|
|
39
40
|
var import_helpers = require("../helpers/index.js");
|
|
41
|
+
var import_constants = require("../../constants.js");
|
|
40
42
|
const HorizontalStackedBars = ({ serie }) => {
|
|
41
43
|
const {
|
|
42
44
|
props: { groups },
|
|
@@ -50,17 +52,20 @@ const HorizontalStackedBars = ({ serie }) => {
|
|
|
50
52
|
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
51
53
|
const serieWithStackedValues = (0, import_helpers.getStackedData)(stackedData, serie);
|
|
52
54
|
const stackIndex = (0, import_helpers.getStackedIndex)(groups, serie.name);
|
|
55
|
+
const dimmedStyle = (0, import_useSerieDimming.useSerieDimming)(serie.name);
|
|
53
56
|
return (0, import_react.useMemo)(
|
|
54
|
-
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { children: serie.data.map((bar, i) => {
|
|
57
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { style: dimmedStyle, children: serie.data.map((bar, i) => {
|
|
55
58
|
const sequence = serieWithStackedValues ? serieWithStackedValues[bar.position] : [0, 0];
|
|
56
59
|
const sequence0 = getXScaleValue(sequence[0]);
|
|
57
60
|
const sequence1 = getXScaleValue(sequence[1]);
|
|
58
|
-
const
|
|
61
|
+
const isNegativeSegment = sequence[0] < 0;
|
|
62
|
+
const gapLeft = !isNegativeSegment && sequence[0] > 0 ? import_constants.MARKS.STACK_GAP : 0;
|
|
63
|
+
const gapRight = isNegativeSegment && sequence[1] < 0 ? import_constants.MARKS.STACK_GAP : 0;
|
|
59
64
|
const xValue = sequence[1] - sequence[0];
|
|
60
65
|
const yValue = getYValue(serie.data[i]);
|
|
61
|
-
const width = sequence1 - sequence0 -
|
|
66
|
+
const width = sequence1 - sequence0 - gapLeft - gapRight;
|
|
62
67
|
const height = subGroupScale?.bandwidth() ?? 0;
|
|
63
|
-
const transformX = sequence0 +
|
|
68
|
+
const transformX = sequence0 + gapLeft;
|
|
64
69
|
const transformY = (subGroupScale ? subGroupScale(`stacked-data-${stackIndex}`) ?? 0 : 0) + (yScale?.get(yValue) ?? 0);
|
|
65
70
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { clipPath: `url(#rect-focus-ring-${chartId})`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { fill: colorScale(serie.name), transform: `translate(0, ${transformY})`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
71
|
import_Rect.Rect,
|
|
@@ -72,18 +77,20 @@ const HorizontalStackedBars = ({ serie }) => {
|
|
|
72
77
|
yValue,
|
|
73
78
|
id: serie.data[i]?.key,
|
|
74
79
|
name: serie.name,
|
|
75
|
-
datum: serie.data[i]
|
|
80
|
+
datum: serie.data[i],
|
|
81
|
+
isStackEdge: (0, import_helpers.isStackedSegmentEdge)(stackedData, serie, serie.data[i]?.position)
|
|
76
82
|
}
|
|
77
83
|
) }) }, serie.data[i]?.key);
|
|
78
84
|
}) }),
|
|
79
85
|
[
|
|
80
86
|
chartId,
|
|
81
87
|
colorScale,
|
|
88
|
+
dimmedStyle,
|
|
82
89
|
getXScaleValue,
|
|
83
90
|
getYValue,
|
|
84
|
-
serie.data,
|
|
85
|
-
serie.name,
|
|
86
91
|
serieWithStackedValues,
|
|
92
|
+
stackedData,
|
|
93
|
+
serie,
|
|
87
94
|
stackIndex,
|
|
88
95
|
subGroupScale,
|
|
89
96
|
yScale
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/series/HorizontalStackedBars.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\n/* prettier-ignore */\nimport React, { useContext, useMemo } from 'react';\nimport { Rect } from './Rect.js';\nimport { ChartContext } from '../ChartContext.js';\nimport { getStackedData, getStackedIndex } from '../helpers/index.js';\nimport type { DSChartT } from '
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* prettier-ignore */\nimport React, { useContext, useMemo } from 'react';\nimport { Rect } from './Rect.js';\nimport { ChartContext } from '../ChartContext.js';\nimport { useSerieDimming } from '../helpers/useSerieDimming.js';\nimport { getStackedData, getStackedIndex, isStackedSegmentEdge } from '../helpers/index.js';\nimport { MARKS } from '../../constants.js';\nimport type { DSChartT } from '../../../react-desc-prop-types.js';\n\nexport const HorizontalStackedBars = ({ serie }: DSChartT.SerieComponentT) => {\n const {\n props: { groups },\n yScale,\n stackedData,\n subGroupScale,\n colorScale,\n chartId,\n getXScaleValue,\n getYValue,\n } = useContext(ChartContext);\n const serieWithStackedValues = getStackedData(stackedData, serie);\n const stackIndex = getStackedIndex(groups, serie.name);\n\n const dimmedStyle = useSerieDimming(serie.name);\n return useMemo(\n () => (\n <g style={dimmedStyle}>\n {serie.data.map((bar, i) => {\n const sequence = serieWithStackedValues ? serieWithStackedValues[bar.position] : [0, 0];\n const sequence0 = getXScaleValue(sequence[0]);\n const sequence1 = getXScaleValue(sequence[1]);\n // the surface gap sits on the side of the previous segment: left of a positive one, right of a negative one\n const isNegativeSegment = sequence[0] < 0;\n const gapLeft = !isNegativeSegment && sequence[0] > 0 ? MARKS.STACK_GAP : 0;\n const gapRight = isNegativeSegment && sequence[1] < 0 ? MARKS.STACK_GAP : 0;\n const xValue = sequence[1] - sequence[0];\n const yValue = getYValue(serie.data[i]) as number;\n\n const width = sequence1 - sequence0 - gapLeft - gapRight;\n\n const height = subGroupScale?.bandwidth() ?? 0;\n const transformX = sequence0 + gapLeft;\n const transformY =\n (subGroupScale ? (subGroupScale(`stacked-data-${stackIndex}`) ?? 0) : 0) +\n (yScale?.get(yValue as never) ?? 0);\n return (\n <g key={serie.data[i]?.key} clipPath={`url(#rect-focus-ring-${chartId})`}>\n <g fill={colorScale(serie.name) as string} transform={`translate(0, ${transformY})`}>\n <Rect\n width={width}\n height={height}\n x={transformX}\n xValue={xValue}\n yValue={yValue}\n id={serie.data[i]?.key}\n name={serie.name}\n datum={serie.data[i]}\n isStackEdge={isStackedSegmentEdge(stackedData, serie, serie.data[i]?.position)}\n />\n </g>\n </g>\n );\n })}\n </g>\n ),\n [\n chartId,\n colorScale,\n dimmedStyle,\n getXScaleValue,\n getYValue,\n serieWithStackedValues,\n stackedData,\n serie,\n stackIndex,\n subGroupScale,\n yScale,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADiDP;AA/ChB,mBAA2C;AAC3C,kBAAqB;AACrB,0BAA6B;AAC7B,6BAAgC;AAChC,qBAAsE;AACtE,uBAAsB;AAGf,MAAM,wBAAwB,CAAC,EAAE,MAA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AAK,CAAC,GAAG;AAAA,UACnB,MAAM,MAAM;AAAA,UACZ,OAAO,MAAM,KAAK,CAAC;AAAA,UACnB,iBAAa,qCAAqB,aAAa,OAAO,MAAM,KAAK,CAAC,GAAG,QAAQ;AAAA;AAAA,MAC/E,GACF,KAbM,MAAM,KAAK,CAAC,GAAG,GAcvB;AAAA,IAEJ,CAAC,GACH;AAAA,IAEF;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -38,31 +38,33 @@ var import_d3 = require("d3");
|
|
|
38
38
|
var import_Points = require("./Points.js");
|
|
39
39
|
var import_ChartContext = require("../ChartContext.js");
|
|
40
40
|
var import_constants = require("../../constants.js");
|
|
41
|
-
var import_DataTestIds = require("../DataTestIds.js");
|
|
42
41
|
var import_A11yRegion = require("../parts/A11yRegion.js");
|
|
42
|
+
var import_TrendHighlight = require("../parts/TrendHighlight.js");
|
|
43
|
+
var import_styles = require("../styles.js");
|
|
43
44
|
const Line = ({ serie }) => {
|
|
44
|
-
const { xScale, colorScale, getYScaleValue, getY2ScaleValue, getXScaleValue, getXValue, getYValue } = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
45
|
+
const { xScale, colorScale, getYScaleValue, getY2ScaleValue, getXScaleValue, getXValue, getYValue, getOwnerProps } = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
45
46
|
const ref = (0, import_react.useRef)(null);
|
|
46
47
|
const curveStyle = (0, import_react.useMemo)(() => import_constants.curveStyleMap[serie.curveStyle ?? import_constants.LINE.CURVE_STYLE.LINEAR], [serie.curveStyle]);
|
|
47
48
|
const currentYScale = (0, import_react.useMemo)(
|
|
48
49
|
() => serie.scale === "y2" ? getY2ScaleValue : getYScaleValue,
|
|
49
50
|
[getY2ScaleValue, getYScaleValue, serie.scale]
|
|
50
51
|
);
|
|
51
|
-
const
|
|
52
|
-
() => (0, import_d3.line)().x((_, i) => getXScaleValue(serie.data[i])).y((_, i) => currentYScale(serie.data[i])).curve(curveStyle),
|
|
52
|
+
const linePath = (0, import_react.useMemo)(
|
|
53
|
+
() => (0, import_d3.line)().x((_, i) => getXScaleValue(serie.data[i])).y((_, i) => currentYScale(serie.data[i])).curve(curveStyle)(serie.data),
|
|
53
54
|
[curveStyle, getXScaleValue, currentYScale, serie.data]
|
|
54
55
|
);
|
|
55
56
|
(0, import_react.useEffect)(() => {
|
|
56
57
|
if (!ref.current) return;
|
|
57
58
|
const groupContent = (0, import_d3.select)(ref?.current);
|
|
58
59
|
groupContent.selectAll("*").remove();
|
|
59
|
-
const path = groupContent.append("path").
|
|
60
|
+
const path = groupContent.append("path").attr("fill", "none").attr("stroke", colorScale(serie.name)).attr("stroke-linejoin", "round").attr("stroke-linecap", "round").attr("stroke-width", 2).attr("vector-effect", "non-scaling-stroke").attr("d", linePath ?? "");
|
|
60
61
|
if (serie.dashStyle)
|
|
61
62
|
path.attr("stroke-dasharray", import_constants.LINE.DASH_STYLE_VALUES[serie.dashStyle]);
|
|
62
|
-
}, [colorScale, getXValue, getYValue,
|
|
63
|
+
}, [colorScale, getXValue, getYValue, linePath, serie, xScale]);
|
|
63
64
|
const xTranslate = (0, import_react.useMemo)(() => (xScale?.getBandwidth?.() ?? 0) / 2, [xScale]);
|
|
64
65
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_A11yRegion.A11yRegion, { serieName: serie.name, transform: `translate(${xTranslate}, 0)`, children: [
|
|
65
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledLineGroup, { innerRef: ref, getOwnerProps, getOwnerPropsArguments: () => ({ serie }) }),
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TrendHighlight.TrendHighlight, { serie, linePath }),
|
|
66
68
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Points.Points, { serie })
|
|
67
69
|
] });
|
|
68
70
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/series/Line.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext, useEffect, useMemo, useRef } from 'react';\nimport { line, select } from 'd3';\nimport { Points } from './Points.js';\nimport { ChartContext } from '../ChartContext.js';\nimport { LINE, curveStyleMap } from '../../constants.js';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useEffect, useMemo, useRef } from 'react';\nimport { line, select } from 'd3';\nimport { Points } from './Points.js';\nimport { ChartContext } from '../ChartContext.js';\nimport { LINE, curveStyleMap } from '../../constants.js';\nimport { A11yRegion } from '../parts/A11yRegion.js';\nimport { TrendHighlight } from '../parts/TrendHighlight.js';\nimport { StyledLineGroup } from '../styles.js';\nimport type { DSChartT } from '../../../react-desc-prop-types.js';\n\ninterface LineSerieT {\n serie: DSChartT.InternalSerie;\n}\nexport const Line: React.ComponentType<LineSerieT> = ({ serie }) => {\n const { xScale, colorScale, getYScaleValue, getY2ScaleValue, getXScaleValue, getXValue, getYValue, getOwnerProps } =\n useContext(ChartContext);\n\n const ref = useRef<SVGGElement>(null);\n\n const curveStyle = useMemo(() => curveStyleMap[serie.curveStyle ?? LINE.CURVE_STYLE.LINEAR], [serie.curveStyle]);\n\n const currentYScale = useMemo(\n () => (serie.scale === 'y2' ? getY2ScaleValue : getYScaleValue),\n [getY2ScaleValue, getYScaleValue, serie.scale],\n );\n const linePath = useMemo(\n () =>\n line()\n .x((_, i) => getXScaleValue(serie.data[i]))\n .y((_, i) => currentYScale(serie.data[i]))\n .curve(curveStyle)(serie.data as unknown as [number, number][]),\n [curveStyle, getXScaleValue, currentYScale, serie.data],\n );\n\n useEffect(() => {\n if (!ref.current) return;\n\n const groupContent = select(ref?.current);\n\n groupContent.selectAll('*').remove();\n const path = groupContent\n .append('path')\n .attr('fill', 'none')\n .attr('stroke', colorScale(serie.name) as string)\n .attr('stroke-linejoin', 'round')\n .attr('stroke-linecap', 'round')\n .attr('stroke-width', 2)\n // the width stays the same while a transform scales the line (see useValueAxisTransition)\n .attr('vector-effect', 'non-scaling-stroke')\n .attr('d', linePath ?? '');\n\n if (serie.dashStyle)\n path.attr('stroke-dasharray', LINE.DASH_STYLE_VALUES[serie.dashStyle as keyof typeof LINE.DASH_STYLE_VALUES]);\n }, [colorScale, getXValue, getYValue, linePath, serie, xScale]);\n\n // we need to center the points and lines when\n // using them in a band axis context\n const xTranslate = useMemo(() => (xScale?.getBandwidth?.() ?? 0) / 2, [xScale]);\n\n return (\n <A11yRegion serieName={serie.name} transform={`translate(${xTranslate}, 0)`}>\n <StyledLineGroup innerRef={ref} getOwnerProps={getOwnerProps} getOwnerPropsArguments={() => ({ serie })} />\n <TrendHighlight serie={serie} linePath={linePath} />\n <Points serie={serie} />\n </A11yRegion>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD4DnB;AA5DJ,mBAA8D;AAC9D,gBAA6B;AAC7B,oBAAuB;AACvB,0BAA6B;AAC7B,uBAAoC;AACpC,wBAA2B;AAC3B,4BAA+B;AAC/B,oBAAgC;AAMzB,MAAM,OAAwC,CAAC,EAAE,MAAM,MAAM;AAClE,QAAM,EAAE,QAAQ,YAAY,gBAAgB,iBAAiB,gBAAgB,WAAW,WAAW,cAAc,QAC/G,yBAAW,gCAAY;AAEzB,QAAM,UAAM,qBAAoB,IAAI;AAEpC,QAAM,iBAAa,s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