@elliemae/ds-dataviz 3.80.0-next.67 → 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/parts/Scroller/ScrollableContainerX.tsx", "../../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useCallback, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext.js';\nimport { AxisBottom } from '../Axis/AxisBottom.js';\nimport { SeriesFactory } from '../SeriesFactory.js';\nimport { ScrollBarX } from './ScrollBarX.js';\nimport { Scrapper } from '../Scrapper/Scrapper.js';\nimport { VerticalScrapper } from '../Scrapper/VerticalScrapper.js';\nexport const ScrollableContainerX = () => {\n const {\n props: { scrapper },\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useCallback, useMemo } from 'react';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { ChartContext } from '../../ChartContext.js';\nimport { useChartInteraction } from '../../config/chartInteractionStore.js';\nimport { AxisBottom } from '../Axis/AxisBottom.js';\nimport { SeriesFactory } from '../SeriesFactory.js';\nimport { ScrollBarX } from './ScrollBarX.js';\nimport { Scrapper } from '../Scrapper/Scrapper.js';\nimport { VerticalScrapper } from '../Scrapper/VerticalScrapper.js';\n\n// The range being dragged to zoom into, in the brand color. It is the only part of the chart that follows the pointer\n// during the drag: it subscribes to the selection, which moves on every pointer move.\nconst ZoomSelection = () => {\n const { innerHeight } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n const isZooming = useChartInteraction((state) => state.isZooming);\n const start = useChartInteraction((state) => state.zoomStartingPosition);\n const end = useChartInteraction((state) => state.movingPosition);\n if (!isZooming || end === 0) return null;\n return (\n <rect\n x={Math.min(start, end)}\n width={Math.abs(end - start)}\n height={innerHeight}\n fill={theme?.colors?.brand?.['500'] ?? '#1394E5'}\n style={{ opacity: 0.15 }}\n />\n );\n};\n\nexport const ScrollableContainerX = () => {\n const {\n props: { scrapper },\n xScale,\n containerRatio,\n innerWidth,\n isGrabbed,\n containerRef,\n setXScrollbarPosition,\n setContainerRatio,\n lastScrollbarPosition,\n internalMargin,\n chartId,\n interactionStore,\n } = useContext(ChartContext);\n const xScrollbarPosition = useChartInteraction((state) => state.xScrollbarPosition);\n\n const getRealClientX = useCallback(\n (clientX: number) => clientX - internalMargin.left - (containerRef?.getBoundingClientRect().left || 0),\n [containerRef, internalMargin.left],\n );\n\n const Scrappers = useMemo(() => {\n if (scrapper && scrapper?.type === 'horizontal') return <Scrapper />;\n if (scrapper && scrapper?.type === 'vertical') return <VerticalScrapper />;\n return null;\n }, [scrapper]);\n\n // built once per change of its inputs, not on every scroll step: a scroll step only moves it (the series, the\n // scrapper and the axis subscribe to what they need themselves)\n const content = useMemo(\n () => (\n <>\n <AxisBottom />\n <SeriesFactory />\n {Scrappers}\n </>\n ),\n [Scrappers],\n );\n\n // the selection is read from the store when the pointer moves, not subscribed to: this group holds the whole plot\n const handleOnMouseDown: React.MouseEventHandler = useCallback(\n ({ clientX }) => {\n if (!isGrabbed && xScale?.type !== 'BAND') {\n interactionStore.setIsZooming(true);\n interactionStore.setZoomStartingPosition(getRealClientX(clientX));\n interactionStore.setMovingPosition(0);\n }\n },\n [getRealClientX, interactionStore, isGrabbed, xScale?.type],\n );\n\n const handleOnMouseMove: React.MouseEventHandler = useCallback(\n ({ clientX }) => {\n if (interactionStore.getState().isZooming) interactionStore.setMovingPosition(getRealClientX(clientX));\n },\n [getRealClientX, interactionStore],\n );\n const handleOnMouseUp: React.MouseEventHandler = useCallback(\n (e) => {\n const { isZooming, zoomStartingPosition } = interactionStore.getState();\n if (!isZooming) return;\n interactionStore.setIsZooming(false);\n interactionStore.setMovingPosition(0);\n const endingPosition = getRealClientX(e.clientX);\n\n const diff = Math.abs(zoomStartingPosition - endingPosition);\n if (diff <= 0) return;\n const newRatio =\n innerWidth / ((innerWidth * containerRatio) / diff) < 40\n ? innerWidth / 40\n : (innerWidth * containerRatio) / diff;\n const newPosition =\n lastScrollbarPosition.current +\n (zoomStartingPosition > endingPosition ? endingPosition : zoomStartingPosition) / containerRatio;\n\n // if (newPosition < 0) setXScrollbarPosition(0);\n // if is bigger thant innerwidth possible we force the end\n if (newPosition > innerWidth - innerWidth / newRatio) setXScrollbarPosition(innerWidth - innerWidth / newRatio);\n else setXScrollbarPosition(newPosition);\n\n setContainerRatio(newRatio);\n lastScrollbarPosition.current = newPosition;\n e.stopPropagation();\n },\n [\n interactionStore,\n getRealClientX,\n innerWidth,\n containerRatio,\n lastScrollbarPosition,\n setXScrollbarPosition,\n setContainerRatio,\n ],\n );\n return (\n <g\n className=\"scrollable-container-x\"\n onMouseDown={handleOnMouseDown}\n onMouseMove={handleOnMouseMove}\n onMouseUp={handleOnMouseUp}\n >\n <g mask={`url(#mask-${chartId})`}>\n <g transform={`translate(${-xScrollbarPosition * containerRatio},0)`}>{content}</g>\n <ZoomSelection />\n </g>\n <ScrollBarX />\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADsBnB;AApBJ,mBAAwD;AACxD,uBAA6B;AAC7B,0BAA6B;AAC7B,mCAAoC;AACpC,wBAA2B;AAC3B,2BAA8B;AAC9B,wBAA2B;AAC3B,sBAAyB;AACzB,8BAAiC;AAIjC,MAAM,gBAAgB,MAAM;AAC1B,QAAM,EAAE,YAAY,QAAI,yBAAW,gCAAY;AAC/C,QAAM,YAAQ,yBAAW,6BAAY;AACrC,QAAM,gBAAY,kDAAoB,CAAC,UAAU,MAAM,SAAS;AAChE,QAAM,YAAQ,kDAAoB,CAAC,UAAU,MAAM,oBAAoB;AACvE,QAAM,UAAM,kDAAoB,CAAC,UAAU,MAAM,cAAc;AAC/D,MAAI,CAAC,aAAa,QAAQ,EAAG,QAAO;AACpC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,GAAG,KAAK,IAAI,OAAO,GAAG;AAAA,MACtB,OAAO,KAAK,IAAI,MAAM,KAAK;AAAA,MAC3B,QAAQ;AAAA,MACR,MAAM,OAAO,QAAQ,QAAQ,KAAK,KAAK;AAAA,MACvC,OAAO,EAAE,SAAS,KAAK;AAAA;AAAA,EACzB;AAEJ;AAEO,MAAM,uBAAuB,MAAM;AACxC,QAAM;AAAA,IACJ,OAAO,EAAE,SAAS;AAAA,IAClB;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;AAC3B,QAAM,yBAAqB,kDAAoB,CAAC,UAAU,MAAM,kBAAkB;AAElF,QAAM,qBAAiB;AAAA,IACrB,CAAC,YAAoB,UAAU,eAAe,QAAQ,cAAc,sBAAsB,EAAE,QAAQ;AAAA,IACpG,CAAC,cAAc,eAAe,IAAI;AAAA,EACpC;AAEA,QAAM,gBAAY,sBAAQ,MAAM;AAC9B,QAAI,YAAY,UAAU,SAAS,aAAc,QAAO,4CAAC,4BAAS;AAClE,QAAI,YAAY,UAAU,SAAS,WAAY,QAAO,4CAAC,4CAAiB;AACxE,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,CAAC;AAIb,QAAM,cAAU;AAAA,IACd,MACE,4EACE;AAAA,kDAAC,gCAAW;AAAA,MACZ,4CAAC,sCAAc;AAAA,MACd;AAAA,OACH;AAAA,IAEF,CAAC,SAAS;AAAA,EACZ;AAGA,QAAM,wBAA6C;AAAA,IACjD,CAAC,EAAE,QAAQ,MAAM;AACf,UAAI,CAAC,aAAa,QAAQ,SAAS,QAAQ;AACzC,yBAAiB,aAAa,IAAI;AAClC,yBAAiB,wBAAwB,eAAe,OAAO,CAAC;AAChE,yBAAiB,kBAAkB,CAAC;AAAA,MACtC;AAAA,IACF;AAAA,IACA,CAAC,gBAAgB,kBAAkB,WAAW,QAAQ,IAAI;AAAA,EAC5D;AAEA,QAAM,wBAA6C;AAAA,IACjD,CAAC,EAAE,QAAQ,MAAM;AACf,UAAI,iBAAiB,SAAS,EAAE,UAAW,kBAAiB,kBAAkB,eAAe,OAAO,CAAC;AAAA,IACvG;AAAA,IACA,CAAC,gBAAgB,gBAAgB;AAAA,EACnC;AACA,QAAM,sBAA2C;AAAA,IAC/C,CAAC,MAAM;AACL,YAAM,EAAE,WAAW,qBAAqB,IAAI,iBAAiB,SAAS;AACtE,UAAI,CAAC,UAAW;AAChB,uBAAiB,aAAa,KAAK;AACnC,uBAAiB,kBAAkB,CAAC;AACpC,YAAM,iBAAiB,eAAe,EAAE,OAAO;AAE/C,YAAM,OAAO,KAAK,IAAI,uBAAuB,cAAc;AAC3D,UAAI,QAAQ,EAAG;AACf,YAAM,WACJ,cAAe,aAAa,iBAAkB,QAAQ,KAClD,aAAa,KACZ,aAAa,iBAAkB;AACtC,YAAM,cACJ,sBAAsB,WACrB,uBAAuB,iBAAiB,iBAAiB,wBAAwB;AAIpF,UAAI,cAAc,aAAa,aAAa,SAAU,uBAAsB,aAAa,aAAa,QAAQ;AAAA,UACzG,uBAAsB,WAAW;AAEtC,wBAAkB,QAAQ;AAC1B,4BAAsB,UAAU;AAChC,QAAE,gBAAgB;AAAA,IACpB;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,aAAa;AAAA,MACb,aAAa;AAAA,MACb,WAAW;AAAA,MAEX;AAAA,qDAAC,OAAE,MAAM,aAAa,OAAO,KAC3B;AAAA,sDAAC,OAAE,WAAW,aAAa,CAAC,qBAAqB,cAAc,OAAQ,mBAAQ;AAAA,UAC/E,4CAAC,iBAAc;AAAA,WACjB;AAAA,QACA,4CAAC,gCAAW;AAAA;AAAA;AAAA,EACd;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -35,6 +35,7 @@ var React = __toESM(require("react"));
|
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_react = require("react");
|
|
37
37
|
var import_ChartContext = require("../../ChartContext.js");
|
|
38
|
+
var import_chartInteractionStore = require("../../config/chartInteractionStore.js");
|
|
38
39
|
var import_SeriesFactory = require("../SeriesFactory.js");
|
|
39
40
|
var import_ScrollBarY = require("./ScrollBarY.js");
|
|
40
41
|
var import_Scrapper = require("../Scrapper/Scrapper.js");
|
|
@@ -43,21 +44,25 @@ var import_AxisLeft = require("../Axis/AxisLeft.js");
|
|
|
43
44
|
const ScrollableContainerY = () => {
|
|
44
45
|
const {
|
|
45
46
|
props: { scrapper },
|
|
46
|
-
xScrollbarPosition,
|
|
47
47
|
containerRatio,
|
|
48
48
|
chartId
|
|
49
49
|
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
50
|
+
const xScrollbarPosition = (0, import_chartInteractionStore.useChartInteraction)((state) => state.xScrollbarPosition);
|
|
50
51
|
const Scrappers = (0, import_react.useMemo)(() => {
|
|
51
52
|
if (scrapper?.type === "horizontal") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Scrapper.Scrapper, {});
|
|
52
53
|
if (scrapper?.type === "vertical") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_VerticalScrapper.VerticalScrapper, {});
|
|
53
54
|
return null;
|
|
54
55
|
}, [scrapper?.type]);
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
const content = (0, import_react.useMemo)(
|
|
57
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
57
58
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SeriesFactory.SeriesFactory, {}),
|
|
58
59
|
Scrappers,
|
|
59
60
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AxisLeft.AxisLeft, {})
|
|
60
|
-
] })
|
|
61
|
+
] }),
|
|
62
|
+
[Scrappers]
|
|
63
|
+
);
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { className: "scrollable-container-y", children: [
|
|
65
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { mask: `url(#mask-y-${chartId})`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { transform: `translate(0,${-xScrollbarPosition * containerRatio})`, children: content }) }),
|
|
61
66
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ScrollBarY.ScrollBarY, {})
|
|
62
67
|
] });
|
|
63
68
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/graphs/Chart/parts/Scroller/ScrollableContainerY.tsx", "../../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext.js';\nimport { SeriesFactory } from '../SeriesFactory.js';\nimport { ScrollBarY } from './ScrollBarY.js';\nimport { Scrapper } from '../Scrapper/Scrapper.js';\nimport { VerticalScrapper } from '../Scrapper/VerticalScrapper.js';\nimport { AxisLeft } from '../Axis/AxisLeft.js';\nexport const ScrollableContainerY = () => {\n const {\n props: { scrapper },\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext.js';\nimport { useChartInteraction } from '../../config/chartInteractionStore.js';\nimport { SeriesFactory } from '../SeriesFactory.js';\nimport { ScrollBarY } from './ScrollBarY.js';\nimport { Scrapper } from '../Scrapper/Scrapper.js';\nimport { VerticalScrapper } from '../Scrapper/VerticalScrapper.js';\nimport { AxisLeft } from '../Axis/AxisLeft.js';\nexport const ScrollableContainerY = () => {\n const {\n props: { scrapper },\n containerRatio,\n chartId,\n } = useContext(ChartContext);\n const xScrollbarPosition = useChartInteraction((state) => state.xScrollbarPosition);\n\n const Scrappers = useMemo(() => {\n if (scrapper?.type === 'horizontal') return <Scrapper />;\n if (scrapper?.type === 'vertical') return <VerticalScrapper />;\n return null;\n }, [scrapper?.type]);\n\n // built once per change of its inputs, not on every scroll step: a scroll step only moves it (the series, the\n // scrapper and the axis subscribe to what they need themselves)\n const content = useMemo(\n () => (\n <>\n <SeriesFactory />\n {Scrappers}\n <AxisLeft />\n </>\n ),\n [Scrappers],\n );\n\n return (\n <g className=\"scrollable-container-y\">\n <g mask={`url(#mask-y-${chartId})`}>\n <g transform={`translate(0,${-xScrollbarPosition * containerRatio})`}>{content}</g>\n </g>\n <ScrollBarY />\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmByB;AAjBhD,mBAA2C;AAC3C,0BAA6B;AAC7B,mCAAoC;AACpC,2BAA8B;AAC9B,wBAA2B;AAC3B,sBAAyB;AACzB,8BAAiC;AACjC,sBAAyB;AAClB,MAAM,uBAAuB,MAAM;AACxC,QAAM;AAAA,IACJ,OAAO,EAAE,SAAS;AAAA,IAClB;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gCAAY;AAC3B,QAAM,yBAAqB,kDAAoB,CAAC,UAAU,MAAM,kBAAkB;AAElF,QAAM,gBAAY,sBAAQ,MAAM;AAC9B,QAAI,UAAU,SAAS,aAAc,QAAO,4CAAC,4BAAS;AACtD,QAAI,UAAU,SAAS,WAAY,QAAO,4CAAC,4CAAiB;AAC5D,WAAO;AAAA,EACT,GAAG,CAAC,UAAU,IAAI,CAAC;AAInB,QAAM,cAAU;AAAA,IACd,MACE,4EACE;AAAA,kDAAC,sCAAc;AAAA,MACd;AAAA,MACD,4CAAC,4BAAS;AAAA,OACZ;AAAA,IAEF,CAAC,SAAS;AAAA,EACZ;AAEA,SACE,6CAAC,OAAE,WAAU,0BACX;AAAA,gDAAC,OAAE,MAAM,eAAe,OAAO,KAC7B,sDAAC,OAAE,WAAW,eAAe,CAAC,qBAAqB,cAAc,KAAM,mBAAQ,GACjF;AAAA,IACA,4CAAC,gCAAW;AAAA,KACd;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -38,42 +38,51 @@ var import_ChartContext = require("../ChartContext.js");
|
|
|
38
38
|
var import_series = require("../series/index.js");
|
|
39
39
|
var import_helpers = require("../helpers/index.js");
|
|
40
40
|
var import_useVirtualizedSeries = require("../helpers/useVirtualizedSeries.js");
|
|
41
|
+
var import_HoverBand = require("./HoverBand.js");
|
|
42
|
+
var import_ZeroLine = require("./ZeroLine.js");
|
|
43
|
+
var import_useEntranceAnimation = require("../config/useEntranceAnimation.js");
|
|
44
|
+
var import_useValueAxisTransition = require("../config/useValueAxisTransition.js");
|
|
45
|
+
const getSerieComponent = (serie, { groups, types, isHorizontal }) => {
|
|
46
|
+
const isStacked = Boolean(groups) && (0, import_helpers.getStackedIndex)(groups, serie.name) > -1;
|
|
47
|
+
if (serie.type === "bar" && isStacked) return isHorizontal ? import_series.HorizontalStackedBars : import_series.StackedBar;
|
|
48
|
+
if (serie.type === "bar") return isHorizontal ? import_series.HorizontalBars : import_series.Bars;
|
|
49
|
+
if (types === "scatter" && !serie.type || serie.type === "point") return import_series.Points;
|
|
50
|
+
if (serie.type === "line") return import_series.Line;
|
|
51
|
+
if (serie.type === "area") return import_series.Area;
|
|
52
|
+
return null;
|
|
53
|
+
};
|
|
41
54
|
const SeriesFactory = () => {
|
|
42
55
|
const {
|
|
43
|
-
props: { groups, types },
|
|
56
|
+
props: { groups, types, y2Axis },
|
|
44
57
|
isHorizontal
|
|
45
58
|
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
46
59
|
const virtualizedSeries = (0, import_useVirtualizedSeries.useVirtualizedSeries)();
|
|
60
|
+
const { setSeriesGroup, seriesGroup, withAnimation, transformOrigin } = (0, import_useEntranceAnimation.useEntranceAnimation)();
|
|
61
|
+
(0, import_useValueAxisTransition.useValueAxisTransition)(seriesGroup);
|
|
62
|
+
const eases = !isHorizontal;
|
|
47
63
|
return (0, import_react.useMemo)(
|
|
48
|
-
() => /* @__PURE__ */ (0, import_jsx_runtime.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
if (serie.type === "area") {
|
|
72
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_series.Area, { ...serieProps });
|
|
73
|
-
}
|
|
74
|
-
return null;
|
|
75
|
-
}) }),
|
|
76
|
-
[groups, isHorizontal, types, virtualizedSeries]
|
|
64
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { className: "content", ref: setSeriesGroup, children: [
|
|
65
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_HoverBand.HoverBand, {}),
|
|
66
|
+
eases ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { ...{ [import_useValueAxisTransition.VALUE_AXIS_TRANSITION.ATTRIBUTE]: "y" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ZeroLine.ZeroLine, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ZeroLine.ZeroLine, {}),
|
|
67
|
+
virtualizedSeries.map((serie) => {
|
|
68
|
+
const Serie = getSerieComponent(serie, { groups, types, isHorizontal });
|
|
69
|
+
if (!Serie) return null;
|
|
70
|
+
const valueAxis = serie.scale === "y2" && y2Axis ? "y2" : "y";
|
|
71
|
+
const drawn = (key) => eases ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { ...{ [import_useValueAxisTransition.VALUE_AXIS_TRANSITION.ATTRIBUTE]: valueAxis }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Serie, { serie }) }, key) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Serie, { serie }, key);
|
|
72
|
+
if (!withAnimation) return drawn(serie.key);
|
|
73
|
+
const entrance = (0, import_useEntranceAnimation.getSerieEntrance)(serie);
|
|
74
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
75
|
+
"g",
|
|
76
|
+
{
|
|
77
|
+
...{ [import_useEntranceAnimation.ENTRANCE_ATTRIBUTE]: entrance },
|
|
78
|
+
style: entrance === "grow" ? { transformOrigin } : void 0,
|
|
79
|
+
children: drawn()
|
|
80
|
+
},
|
|
81
|
+
serie.key
|
|
82
|
+
);
|
|
83
|
+
})
|
|
84
|
+
] }),
|
|
85
|
+
[eases, groups, isHorizontal, setSeriesGroup, transformOrigin, types, virtualizedSeries, withAnimation, y2Axis]
|
|
77
86
|
);
|
|
78
87
|
};
|
|
79
88
|
//# sourceMappingURL=SeriesFactory.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/parts/SeriesFactory.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../ChartContext.js';\nimport { Line, Points, Bars, StackedBar, Area, HorizontalBars, HorizontalStackedBars } from '../series/index.js';\nimport { getStackedIndex } from '../helpers/index.js';\nimport { useVirtualizedSeries } from '../helpers/useVirtualizedSeries.js';\n\nexport const SeriesFactory = () => {\n const {\n props: { groups, types },\n isHorizontal,\n } = useContext(ChartContext);\n\n const virtualizedSeries = useVirtualizedSeries();\n\n return useMemo(\n () => (\n <g className=\"content\">\n {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../ChartContext.js';\nimport { Line, Points, Bars, StackedBar, Area, HorizontalBars, HorizontalStackedBars } from '../series/index.js';\nimport { getStackedIndex } from '../helpers/index.js';\nimport { useVirtualizedSeries } from '../helpers/useVirtualizedSeries.js';\nimport { HoverBand } from './HoverBand.js';\nimport { ZeroLine } from './ZeroLine.js';\nimport { ENTRANCE_ATTRIBUTE, getSerieEntrance, useEntranceAnimation } from '../config/useEntranceAnimation.js';\nimport { VALUE_AXIS_TRANSITION, useValueAxisTransition } from '../config/useValueAxisTransition.js';\nimport type { DSChartT } from '../../../react-desc-prop-types.js';\n\ntype SerieComponentT = React.ComponentType<{ serie: DSChartT.InternalSerie }>;\n\nconst getSerieComponent = (\n serie: DSChartT.InternalSerie,\n { groups, types, isHorizontal }: { groups?: string[][]; types?: string; isHorizontal: boolean },\n): SerieComponentT | null => {\n const isStacked = Boolean(groups) && getStackedIndex(groups as string[][], serie.name) > -1;\n if (serie.type === 'bar' && isStacked) return isHorizontal ? HorizontalStackedBars : StackedBar;\n if (serie.type === 'bar') return isHorizontal ? HorizontalBars : Bars;\n if ((types === 'scatter' && !serie.type) || serie.type === 'point') return Points;\n if (serie.type === 'line') return Line;\n if (serie.type === 'area') return Area;\n return null;\n};\n\nexport const SeriesFactory = () => {\n const {\n props: { groups, types, y2Axis },\n isHorizontal,\n } = useContext(ChartContext);\n\n const virtualizedSeries = useVirtualizedSeries();\n const { setSeriesGroup, seriesGroup, withAnimation, transformOrigin } = useEntranceAnimation();\n useValueAxisTransition(seriesGroup);\n // on a vertical chart, the series of each vertical axis, and the zero line, have a group that eases them to a new\n // domain of the axis (see useValueAxisTransition)\n const eases = !isHorizontal;\n\n return useMemo(\n () => (\n <g className=\"content\" ref={setSeriesGroup}>\n <HoverBand />\n {eases ? (\n <g {...{ [VALUE_AXIS_TRANSITION.ATTRIBUTE]: 'y' }}>\n <ZeroLine />\n </g>\n ) : (\n <ZeroLine />\n )}\n {virtualizedSeries.map((serie) => {\n const Serie = getSerieComponent(serie, { groups, types, isHorizontal });\n if (!Serie) return null;\n const valueAxis = serie.scale === 'y2' && y2Axis ? 'y2' : 'y';\n const drawn = (key?: string) =>\n eases ? (\n <g key={key} {...{ [VALUE_AXIS_TRANSITION.ATTRIBUTE]: valueAxis }}>\n <Serie serie={serie} />\n </g>\n ) : (\n <Serie key={key} serie={serie} />\n );\n if (!withAnimation) return drawn(serie.key);\n // with withAnimation, each series has a group that tells how it enters (see useEntranceAnimation)\n const entrance = getSerieEntrance(serie);\n return (\n <g\n key={serie.key}\n {...{ [ENTRANCE_ATTRIBUTE]: entrance }}\n style={entrance === 'grow' ? { transformOrigin } : undefined}\n >\n {drawn()}\n </g>\n );\n })}\n </g>\n ),\n [eases, groups, isHorizontal, setSeriesGroup, transformOrigin, types, virtualizedSeries, withAnimation, y2Axis],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD4CjB;AAzCN,mBAA2C;AAC3C,0BAA6B;AAC7B,oBAA4F;AAC5F,qBAAgC;AAChC,kCAAqC;AACrC,uBAA0B;AAC1B,sBAAyB;AACzB,kCAA2E;AAC3E,oCAA8D;AAK9D,MAAM,oBAAoB,CACxB,OACA,EAAE,QAAQ,OAAO,aAAa,MACH;AAC3B,QAAM,YAAY,QAAQ,MAAM,SAAK,gCAAgB,QAAsB,MAAM,IAAI,IAAI;AACzF,MAAI,MAAM,SAAS,SAAS,UAAW,QAAO,eAAe,sCAAwB;AACrF,MAAI,MAAM,SAAS,MAAO,QAAO,eAAe,+BAAiB;AACjE,MAAK,UAAU,aAAa,CAAC,MAAM,QAAS,MAAM,SAAS,QAAS,QAAO;AAC3E,MAAI,MAAM,SAAS,OAAQ,QAAO;AAClC,MAAI,MAAM,SAAS,OAAQ,QAAO;AAClC,SAAO;AACT;AAEO,MAAM,gBAAgB,MAAM;AACjC,QAAM;AAAA,IACJ,OAAO,EAAE,QAAQ,OAAO,OAAO;AAAA,IAC/B;AAAA,EACF,QAAI,yBAAW,gCAAY;AAE3B,QAAM,wBAAoB,kDAAqB;AAC/C,QAAM,EAAE,gBAAgB,aAAa,eAAe,gBAAgB,QAAI,kDAAqB;AAC7F,4DAAuB,WAAW;AAGlC,QAAM,QAAQ,CAAC;AAEf,aAAO;AAAA,IACL,MACE,6CAAC,OAAE,WAAU,WAAU,KAAK,gBAC1B;AAAA,kDAAC,8BAAU;AAAA,MACV,QACC,4CAAC,OAAG,GAAG,EAAE,CAAC,oDAAsB,SAAS,GAAG,IAAI,GAC9C,sDAAC,4BAAS,GACZ,IAEA,4CAAC,4BAAS;AAAA,MAEX,kBAAkB,IAAI,CAAC,UAAU;AAChC,cAAM,QAAQ,kBAAkB,OAAO,EAAE,QAAQ,OAAO,aAAa,CAAC;AACtE,YAAI,CAAC,MAAO,QAAO;AACnB,cAAM,YAAY,MAAM,UAAU,QAAQ,SAAS,OAAO;AAC1D,cAAM,QAAQ,CAAC,QACb,QACE,4CAAC,OAAa,GAAG,EAAE,CAAC,oDAAsB,SAAS,GAAG,UAAU,GAC9D,sDAAC,SAAM,OAAc,KADf,GAER,IAEA,4CAAC,SAAgB,SAAL,GAAmB;AAEnC,YAAI,CAAC,cAAe,QAAO,MAAM,MAAM,GAAG;AAE1C,cAAM,eAAW,8CAAiB,KAAK;AACvC,eACE;AAAA,UAAC;AAAA;AAAA,YAEE,GAAG,EAAE,CAAC,8CAAkB,GAAG,SAAS;AAAA,YACrC,OAAO,aAAa,SAAS,EAAE,gBAAgB,IAAI;AAAA,YAElD,gBAAM;AAAA;AAAA,UAJF,MAAM;AAAA,QAKb;AAAA,MAEJ,CAAC;AAAA,OACH;AAAA,IAEF,CAAC,OAAO,QAAQ,cAAc,gBAAgB,iBAAiB,OAAO,mBAAmB,eAAe,MAAM;AAAA,EAChH;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,26 +34,64 @@ module.exports = __toCommonJS(TrendHighlight_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_react = require("react");
|
|
37
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
37
38
|
var import_ChartContext = require("../ChartContext.js");
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
y2: yCurrentPosition
|
|
39
|
+
var import_chartInteractionStore = require("../config/chartInteractionStore.js");
|
|
40
|
+
var import_trend = require("../helpers/trend.js");
|
|
41
|
+
var import_constants = require("../../constants.js");
|
|
42
|
+
const TREND_STROKE_WIDTH = 3;
|
|
43
|
+
const TrendHighlight = ({ serie, linePath }) => {
|
|
44
|
+
const {
|
|
45
|
+
props: { withTrendHighlight, scrapper },
|
|
46
|
+
getXScaleValue,
|
|
47
|
+
getYValue,
|
|
48
|
+
innerHeight,
|
|
49
|
+
chartId
|
|
50
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
51
|
+
const theme = (0, import_react.useContext)(import_ds_system.ThemeContext);
|
|
52
|
+
const focusedIndex = (0, import_chartInteractionStore.useChartInteraction)((state) => {
|
|
53
|
+
if (!withTrendHighlight) return -1;
|
|
54
|
+
if (state.activePoint?.serie === serie.name) {
|
|
55
|
+
return serie.data.findIndex((datum) => datum.key === state.activePoint?.key);
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
if (scrapper?.type !== import_constants.SCRAPPER.TYPE_VERTICAL) return -1;
|
|
58
|
+
const scrapperX = state.activePoint ? getXScaleValue(state.activePoint) : (0, import_chartInteractionStore.getPointerScrapperPosX)(state);
|
|
59
|
+
return serie.data.findIndex((datum) => getXScaleValue(datum) === scrapperX);
|
|
60
|
+
});
|
|
61
|
+
if (focusedIndex < 1 || !linePath) return null;
|
|
62
|
+
const previous = serie.data[focusedIndex - 1];
|
|
63
|
+
const current = serie.data[focusedIndex];
|
|
64
|
+
const trend = (0, import_trend.getTrend)(getYValue(previous), getYValue(current), serie.higherIsBetter);
|
|
65
|
+
const colors = {
|
|
66
|
+
good: theme?.colors?.success?.["900"] ?? "#207E56",
|
|
67
|
+
bad: theme?.colors?.danger?.["900"] ?? "#C64252",
|
|
68
|
+
flat: theme?.colors?.neutral?.["500"] ?? "#697489"
|
|
69
|
+
};
|
|
70
|
+
const previousX = getXScaleValue(previous) ?? 0;
|
|
71
|
+
const currentX = getXScaleValue(current) ?? 0;
|
|
72
|
+
const clipId = `trend-highlight-${chartId}-${serie.key.replace(/[^\w-]/g, "_")}`;
|
|
73
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { className: "trend-highlight", "data-trend": trend, children: [
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("clipPath", { id: clipId, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
75
|
+
"rect",
|
|
76
|
+
{
|
|
77
|
+
x: Math.min(previousX, currentX) - TREND_STROKE_WIDTH / 2,
|
|
78
|
+
y: -TREND_STROKE_WIDTH,
|
|
79
|
+
width: Math.abs(currentX - previousX) + TREND_STROKE_WIDTH,
|
|
80
|
+
height: innerHeight + TREND_STROKE_WIDTH * 2
|
|
81
|
+
}
|
|
82
|
+
) }) }),
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
|
+
"path",
|
|
85
|
+
{
|
|
86
|
+
d: linePath,
|
|
87
|
+
clipPath: `url(#${clipId})`,
|
|
88
|
+
fill: "none",
|
|
89
|
+
stroke: colors[trend],
|
|
90
|
+
strokeWidth: TREND_STROKE_WIDTH,
|
|
91
|
+
strokeLinecap: "round",
|
|
92
|
+
strokeLinejoin: "round"
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
] });
|
|
58
96
|
};
|
|
59
97
|
//# sourceMappingURL=TrendHighlight.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/parts/TrendHighlight.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext } from 'react';\nimport { ChartContext } from '../ChartContext.js';\nimport { type DSChartT } from '
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { ChartContext } from '../ChartContext.js';\nimport { getPointerScrapperPosX, useChartInteraction } from '../config/chartInteractionStore.js';\nimport { getTrend, type TrendT } from '../helpers/trend.js';\nimport { SCRAPPER } from '../../constants.js';\nimport { type DSChartT } from '../../../react-desc-prop-types.js';\n\ninterface TrendHighlightProps {\n serie: DSChartT.InternalSerie;\n // the path of the line of the series, which the highlight follows\n linePath: string | null;\n}\n\nconst TREND_STROKE_WIDTH = 3;\n\n// With withTrendHighlight, the stretch of a line (or of the top of an area) that leads to its focused point, from the\n// previous point the line joins, is drawn over in the color of its trend: success when it goes the good way, danger\n// when it goes the bad way, neutral when the value does not change. The focused point is the active point of the\n// keyboard or of the pointer, or the point under the vertical scrapper. The stretch is the line itself, clipped between\n// the two points, so it follows a spline as well, and it is drawn under the markers.\nexport const TrendHighlight: React.ComponentType<TrendHighlightProps> = ({ serie, linePath }) => {\n const {\n props: { withTrendHighlight, scrapper },\n getXScaleValue,\n getYValue,\n innerHeight,\n chartId,\n } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n\n // the index of the focused point in the series, -1 when it has none\n const focusedIndex = useChartInteraction((state) => {\n if (!withTrendHighlight) return -1;\n if (state.activePoint?.serie === serie.name) {\n return serie.data.findIndex((datum) => datum.key === state.activePoint?.key);\n }\n if (scrapper?.type !== SCRAPPER.TYPE_VERTICAL) return -1;\n const scrapperX = state.activePoint ? getXScaleValue(state.activePoint) : getPointerScrapperPosX(state);\n return serie.data.findIndex((datum) => getXScaleValue(datum) === scrapperX);\n });\n\n // the first point has no stretch before it; the data has no gaps, as the line joins the points around a missing value\n if (focusedIndex < 1 || !linePath) return null;\n const previous = serie.data[focusedIndex - 1];\n const current = serie.data[focusedIndex];\n const trend = getTrend(getYValue(previous) as number, getYValue(current) as number, serie.higherIsBetter);\n const colors: Record<TrendT, string> = {\n good: theme?.colors?.success?.['900'] ?? '#207E56',\n bad: theme?.colors?.danger?.['900'] ?? '#C64252',\n flat: theme?.colors?.neutral?.['500'] ?? '#697489',\n };\n\n const previousX = getXScaleValue(previous) ?? 0;\n const currentX = getXScaleValue(current) ?? 0;\n const clipId = `trend-highlight-${chartId}-${serie.key.replace(/[^\\w-]/g, '_')}`;\n return (\n <g className=\"trend-highlight\" data-trend={trend}>\n <defs>\n <clipPath id={clipId}>\n {/* the round caps of the stroke reach a bit past each point */}\n <rect\n x={Math.min(previousX, currentX) - TREND_STROKE_WIDTH / 2}\n y={-TREND_STROKE_WIDTH}\n width={Math.abs(currentX - previousX) + TREND_STROKE_WIDTH}\n height={innerHeight + TREND_STROKE_WIDTH * 2}\n />\n </clipPath>\n </defs>\n <path\n d={linePath}\n clipPath={`url(#${clipId})`}\n fill=\"none\"\n stroke={colors[trend]}\n strokeWidth={TREND_STROKE_WIDTH}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADyDnB;AAzDJ,mBAAkC;AAClC,uBAA6B;AAC7B,0BAA6B;AAC7B,mCAA4D;AAC5D,mBAAsC;AACtC,uBAAyB;AASzB,MAAM,qBAAqB;AAOpB,MAAM,iBAA2D,CAAC,EAAE,OAAO,SAAS,MAAM;AAC/F,QAAM;AAAA,IACJ,OAAO,EAAE,oBAAoB,SAAS;AAAA,IACtC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,gCAAY;AAC3B,QAAM,YAAQ,yBAAW,6BAAY;AAGrC,QAAM,mBAAe,kDAAoB,CAAC,UAAU;AAClD,QAAI,CAAC,mBAAoB,QAAO;AAChC,QAAI,MAAM,aAAa,UAAU,MAAM,MAAM;AAC3C,aAAO,MAAM,KAAK,UAAU,CAAC,UAAU,MAAM,QAAQ,MAAM,aAAa,GAAG;AAAA,IAC7E;AACA,QAAI,UAAU,SAAS,0BAAS,cAAe,QAAO;AACtD,UAAM,YAAY,MAAM,cAAc,eAAe,MAAM,WAAW,QAAI,qDAAuB,KAAK;AACtG,WAAO,MAAM,KAAK,UAAU,CAAC,UAAU,eAAe,KAAK,MAAM,SAAS;AAAA,EAC5E,CAAC;AAGD,MAAI,eAAe,KAAK,CAAC,SAAU,QAAO;AAC1C,QAAM,WAAW,MAAM,KAAK,eAAe,CAAC;AAC5C,QAAM,UAAU,MAAM,KAAK,YAAY;AACvC,QAAM,YAAQ,uBAAS,UAAU,QAAQ,GAAa,UAAU,OAAO,GAAa,MAAM,cAAc;AACxG,QAAM,SAAiC;AAAA,IACrC,MAAM,OAAO,QAAQ,UAAU,KAAK,KAAK;AAAA,IACzC,KAAK,OAAO,QAAQ,SAAS,KAAK,KAAK;AAAA,IACvC,MAAM,OAAO,QAAQ,UAAU,KAAK,KAAK;AAAA,EAC3C;AAEA,QAAM,YAAY,eAAe,QAAQ,KAAK;AAC9C,QAAM,WAAW,eAAe,OAAO,KAAK;AAC5C,QAAM,SAAS,mBAAmB,OAAO,IAAI,MAAM,IAAI,QAAQ,WAAW,GAAG,CAAC;AAC9E,SACE,6CAAC,OAAE,WAAU,mBAAkB,cAAY,OACzC;AAAA,gDAAC,UACC,sDAAC,cAAS,IAAI,QAEZ;AAAA,MAAC;AAAA;AAAA,QACC,GAAG,KAAK,IAAI,WAAW,QAAQ,IAAI,qBAAqB;AAAA,QACxD,GAAG,CAAC;AAAA,QACJ,OAAO,KAAK,IAAI,WAAW,SAAS,IAAI;AAAA,QACxC,QAAQ,cAAc,qBAAqB;AAAA;AAAA,IAC7C,GACF,GACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,GAAG;AAAA,QACH,UAAU,QAAQ,MAAM;AAAA,QACxB,MAAK;AAAA,QACL,QAAQ,OAAO,KAAK;AAAA,QACpB,aAAa;AAAA,QACb,eAAc;AAAA,QACd,gBAAe;AAAA;AAAA,IACjB;AAAA,KACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var ZeroLine_exports = {};
|
|
30
|
+
__export(ZeroLine_exports, {
|
|
31
|
+
ZeroLine: () => ZeroLine
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(ZeroLine_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
38
|
+
var import_ChartContext = require("../ChartContext.js");
|
|
39
|
+
var import_zeroLine = require("../helpers/zeroLine.js");
|
|
40
|
+
const ZeroLine = () => {
|
|
41
|
+
const {
|
|
42
|
+
xScale,
|
|
43
|
+
yScale,
|
|
44
|
+
innerWidth,
|
|
45
|
+
innerHeight,
|
|
46
|
+
containerRatio,
|
|
47
|
+
props: { xScroll, yScroll }
|
|
48
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
49
|
+
const theme = (0, import_react.useContext)(import_ds_system.ThemeContext);
|
|
50
|
+
const yZero = (0, import_zeroLine.getZeroLinePosition)(yScale);
|
|
51
|
+
const xZero = (0, import_zeroLine.getZeroLinePosition)(xScale);
|
|
52
|
+
if (yZero === null && xZero === null) return null;
|
|
53
|
+
const width = innerWidth * (xScroll ? containerRatio : 1);
|
|
54
|
+
const height = innerHeight * (yScroll ? containerRatio : 1);
|
|
55
|
+
const lineProps = {
|
|
56
|
+
stroke: theme?.colors?.neutral?.["500"] ?? "#697489",
|
|
57
|
+
strokeWidth: 1,
|
|
58
|
+
shapeRendering: "crispEdges",
|
|
59
|
+
pointerEvents: "none"
|
|
60
|
+
};
|
|
61
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { className: "zero-line", children: [
|
|
62
|
+
yZero !== null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: 0, x2: width, y1: yZero, y2: yZero, ...lineProps }) : null,
|
|
63
|
+
xZero !== null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: xZero, x2: xZero, y1: 0, y2: height, ...lineProps }) : null
|
|
64
|
+
] });
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=ZeroLine.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/graphs/Chart/parts/ZeroLine.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { ChartContext } from '../ChartContext.js';\nimport { getZeroLinePosition } from '../helpers/zeroLine.js';\n\n// The zero of the axes that go below it (see getZeroLinePosition): a hairline across the plot, stronger than the grid\n// and than the domain line of the axis, drawn under the series. A horizontal line for the vertical axis, a vertical one\n// for the horizontal axis, so a scatter plot with negative values on both axes shows its four quadrants. It spans the\n// whole content of a scrollable chart, as it scrolls with the series.\nexport const ZeroLine = () => {\n const {\n xScale,\n yScale,\n innerWidth,\n innerHeight,\n containerRatio,\n props: { xScroll, yScroll },\n } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n\n const yZero = getZeroLinePosition(yScale);\n const xZero = getZeroLinePosition(xScale);\n if (yZero === null && xZero === null) return null;\n\n const width = innerWidth * (xScroll ? containerRatio : 1);\n const height = innerHeight * (yScroll ? containerRatio : 1);\n const lineProps = {\n stroke: theme?.colors?.neutral?.['500'] ?? '#697489',\n strokeWidth: 1,\n shapeRendering: 'crispEdges',\n pointerEvents: 'none',\n } as const;\n\n return (\n <g className=\"zero-line\">\n {yZero !== null ? <line x1={0} x2={width} y1={yZero} y2={yZero} {...lineProps} /> : null}\n {xZero !== null ? <line x1={xZero} x2={xZero} y1={0} y2={height} {...lineProps} /> : null}\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkCnB;AAlCJ,mBAAkC;AAClC,uBAA6B;AAC7B,0BAA6B;AAC7B,sBAAoC;AAM7B,MAAM,WAAW,MAAM;AAC5B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,SAAS,QAAQ;AAAA,EAC5B,QAAI,yBAAW,gCAAY;AAC3B,QAAM,YAAQ,yBAAW,6BAAY;AAErC,QAAM,YAAQ,qCAAoB,MAAM;AACxC,QAAM,YAAQ,qCAAoB,MAAM;AACxC,MAAI,UAAU,QAAQ,UAAU,KAAM,QAAO;AAE7C,QAAM,QAAQ,cAAc,UAAU,iBAAiB;AACvD,QAAM,SAAS,eAAe,UAAU,iBAAiB;AACzD,QAAM,YAAY;AAAA,IAChB,QAAQ,OAAO,QAAQ,UAAU,KAAK,KAAK;AAAA,IAC3C,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,eAAe;AAAA,EACjB;AAEA,SACE,6CAAC,OAAE,WAAU,aACV;AAAA,cAAU,OAAO,4CAAC,UAAK,IAAI,GAAG,IAAI,OAAO,IAAI,OAAO,IAAI,OAAQ,GAAG,WAAW,IAAK;AAAA,IACnF,UAAU,OAAO,4CAAC,UAAK,IAAI,OAAO,IAAI,OAAO,IAAI,GAAG,IAAI,QAAS,GAAG,WAAW,IAAK;AAAA,KACvF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -38,26 +38,15 @@ __export(scales_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(scales_exports);
|
|
39
39
|
var React = __toESM(require("react"));
|
|
40
40
|
var import_d3 = require("d3");
|
|
41
|
+
var import_constants = require("../../constants.js");
|
|
42
|
+
var import_timeTicks = require("../helpers/timeTicks.js");
|
|
41
43
|
const AXIS_TYPE = {
|
|
42
44
|
BAND: "BAND",
|
|
43
45
|
LINEAR: "LINEAR",
|
|
44
46
|
DATETIME: "DATETIME",
|
|
45
47
|
LOG: "LOG"
|
|
46
48
|
};
|
|
47
|
-
const getInterval = (interval) =>
|
|
48
|
-
switch (interval) {
|
|
49
|
-
case "DAY":
|
|
50
|
-
return import_d3.utcDay;
|
|
51
|
-
case "MONTH":
|
|
52
|
-
return import_d3.utcMonth;
|
|
53
|
-
case "WEEK":
|
|
54
|
-
return import_d3.utcWeek;
|
|
55
|
-
case "YEAR":
|
|
56
|
-
return import_d3.utcYear;
|
|
57
|
-
default:
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
};
|
|
49
|
+
const getInterval = (interval) => interval && interval in import_constants.TIME_INTERVALS ? import_constants.TIME_INTERVALS[interval] : null;
|
|
61
50
|
class Scale {
|
|
62
51
|
scale;
|
|
63
52
|
type;
|
|
@@ -99,16 +88,23 @@ class BandScale extends Scale {
|
|
|
99
88
|
getBandwidth() {
|
|
100
89
|
return this.scale.bandwidth();
|
|
101
90
|
}
|
|
91
|
+
// the distance from the start of a band to the start of the next one: the band and the padding after it
|
|
92
|
+
getStep() {
|
|
93
|
+
return this.scale.step();
|
|
94
|
+
}
|
|
102
95
|
}
|
|
103
96
|
class LinearScale extends Scale {
|
|
104
97
|
type;
|
|
105
98
|
scale;
|
|
106
99
|
axisProps;
|
|
107
|
-
|
|
100
|
+
// the ticks of an axis aligned with another one (see getAlignedTicks), instead of the ones of its own count
|
|
101
|
+
alignedTicks;
|
|
102
|
+
constructor(scale, axisProps, alignedTicks = null) {
|
|
108
103
|
super(scale);
|
|
109
104
|
this.scale = scale;
|
|
110
105
|
this.type = "LINEAR";
|
|
111
106
|
this.axisProps = axisProps;
|
|
107
|
+
this.alignedTicks = alignedTicks;
|
|
112
108
|
}
|
|
113
109
|
get(value) {
|
|
114
110
|
if (typeof value !== "number") return 0;
|
|
@@ -124,8 +120,15 @@ class LinearScale extends Scale {
|
|
|
124
120
|
}
|
|
125
121
|
return t.toString();
|
|
126
122
|
}
|
|
123
|
+
getTickCount(dimension) {
|
|
124
|
+
return this.axisProps?.tick?.tickCount ?? Math.ceil(dimension / 80);
|
|
125
|
+
}
|
|
127
126
|
getTicks(dimension) {
|
|
128
|
-
|
|
127
|
+
if (this.alignedTicks) return this.withTickValues([...this.alignedTicks]);
|
|
128
|
+
return this.withTickValues(this.scale.ticks?.(this.getTickCount(dimension)));
|
|
129
|
+
}
|
|
130
|
+
// the ticks given through tick.tickValues: instead of the computed ones with overwriteTicks, added to them otherwise
|
|
131
|
+
withTickValues(ticks) {
|
|
129
132
|
if (this.axisProps?.tick?.tickValues) {
|
|
130
133
|
if (this.axisProps?.tick?.overwriteTicks) return this.axisProps?.tick?.tickValues;
|
|
131
134
|
this.axisProps?.tick?.tickValues.forEach((t) => {
|
|
@@ -142,6 +145,7 @@ class LinearScale extends Scale {
|
|
|
142
145
|
return ticks.map((t) => typeof t === "number" ? this.get(t) : 0);
|
|
143
146
|
}
|
|
144
147
|
}
|
|
148
|
+
const LOG_TICK_DIGITS = [[1], [1, 2, 5], [1, 2, 3, 4, 5, 6, 7, 8, 9]];
|
|
145
149
|
class LogScale extends LinearScale {
|
|
146
150
|
type;
|
|
147
151
|
scale;
|
|
@@ -152,6 +156,18 @@ class LogScale extends LinearScale {
|
|
|
152
156
|
this.type = "LOG";
|
|
153
157
|
this.axisProps = axisProps;
|
|
154
158
|
}
|
|
159
|
+
// 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
|
|
160
|
+
// labels overlap. Of those ticks, the axis keeps the densest set that fits its tick count: the powers of ten, then 1,
|
|
161
|
+
// 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.
|
|
162
|
+
getTicks(dimension) {
|
|
163
|
+
const count = Math.max(1, this.getTickCount(dimension));
|
|
164
|
+
const candidates = this.scale.ticks();
|
|
165
|
+
const leadingDigit = (tick) => Math.round(Math.abs(tick) / 10 ** Math.floor(Math.log10(Math.abs(tick))));
|
|
166
|
+
const tickSets = LOG_TICK_DIGITS.map((digits) => candidates.filter((tick) => digits.includes(leadingDigit(tick))));
|
|
167
|
+
const fitting = tickSets.filter((ticks2) => ticks2.length > 0 && ticks2.length <= count);
|
|
168
|
+
const ticks = fitting[fitting.length - 1] ?? tickSets.find((set) => set.length > 0) ?? candidates;
|
|
169
|
+
return this.withTickValues([...ticks]);
|
|
170
|
+
}
|
|
155
171
|
getTickFormatted(t) {
|
|
156
172
|
if (typeof t !== "number") return t.toString();
|
|
157
173
|
if (typeof this.axisProps?.tick?.tickFormat === "function") {
|
|
@@ -167,11 +183,14 @@ class TimeLinearScale extends Scale {
|
|
|
167
183
|
type;
|
|
168
184
|
scale;
|
|
169
185
|
axisProps;
|
|
170
|
-
|
|
186
|
+
// the smallest step between the dates of the axis, in milliseconds (see getMinTimeStep), 0 when unknown
|
|
187
|
+
minTimeStep;
|
|
188
|
+
constructor(scale, axisProps, minTimeStep = 0) {
|
|
171
189
|
super(scale);
|
|
172
190
|
this.scale = scale;
|
|
173
191
|
this.type = "DATETIME";
|
|
174
192
|
this.axisProps = axisProps;
|
|
193
|
+
this.minTimeStep = minTimeStep;
|
|
175
194
|
}
|
|
176
195
|
get(value) {
|
|
177
196
|
if (typeof value !== "object") return 0;
|
|
@@ -183,13 +202,24 @@ class TimeLinearScale extends Scale {
|
|
|
183
202
|
return this.axisProps?.tick?.tickFormat(t);
|
|
184
203
|
}
|
|
185
204
|
if (typeof this.axisProps?.tick?.tickFormat === "string") {
|
|
186
|
-
return (0, import_d3.
|
|
205
|
+
return (0, import_d3.utcFormat)(this.axisProps?.tick?.tickFormat)(t);
|
|
187
206
|
}
|
|
188
|
-
return
|
|
207
|
+
return (0, import_timeTicks.formatTimeTick)(t);
|
|
208
|
+
}
|
|
209
|
+
// Without intervalType, a tick about every 80px of the plot: the plot grows with the zoom, so zooming in turns the
|
|
210
|
+
// ticks from months to weeks, days and hours. They are never closer than the dates of the data, so a daily series
|
|
211
|
+
// gets no ticks on the hours between its days; a tickCount the consumer sets is kept as it is.
|
|
212
|
+
getTickCount(dimension) {
|
|
213
|
+
const { tickCount } = this.axisProps?.tick ?? {};
|
|
214
|
+
if (tickCount !== void 0) return tickCount;
|
|
215
|
+
const count = Math.ceil(dimension / 80);
|
|
216
|
+
const [start, end] = this.scale.domain();
|
|
217
|
+
if (!this.minTimeStep || !start || !end) return count;
|
|
218
|
+
return Math.max(1, Math.min(count, Math.floor((+end - +start) / this.minTimeStep)));
|
|
189
219
|
}
|
|
190
220
|
getTicks(dimension, intervalType) {
|
|
191
221
|
const interval = getInterval(intervalType);
|
|
192
|
-
const finalTickConfig = interval ||
|
|
222
|
+
const finalTickConfig = interval || this.getTickCount(dimension);
|
|
193
223
|
const ticks = this.scale.ticks?.(finalTickConfig);
|
|
194
224
|
const ticksValues = this.axisProps?.tick?.tickValues;
|
|
195
225
|
if (ticksValues) {
|