react-native-chart-kit 7.0.0-next.1 → 7.0.0-next.3
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/README.md +89 -521
- package/dist/charts/line/LineChart.d.ts +3 -3
- package/dist/charts/line/LineChart.js +1 -1
- package/dist/v2/core/data/index.d.ts +3 -0
- package/dist/v2/core/data/index.d.ts.map +1 -0
- package/dist/v2/core/data/index.js +1 -0
- package/dist/v2/core/data/normalize.d.ts +8 -0
- package/dist/v2/core/data/normalize.d.ts.map +1 -0
- package/dist/v2/core/data/normalize.js +229 -0
- package/dist/v2/core/data/normalizeValues.d.ts +16 -0
- package/dist/v2/core/data/normalizeValues.d.ts.map +1 -0
- package/dist/v2/core/data/normalizeValues.js +96 -0
- package/dist/v2/core/data/types.d.ts +161 -0
- package/dist/v2/core/data/types.d.ts.map +1 -0
- package/dist/v2/core/data/types.js +1 -0
- package/dist/v2/core/geometry/areaPath.d.ts +3 -0
- package/dist/v2/core/geometry/areaPath.d.ts.map +1 -0
- package/dist/v2/core/geometry/areaPath.js +36 -0
- package/dist/v2/core/geometry/barRects.d.ts +44 -0
- package/dist/v2/core/geometry/barRects.d.ts.map +1 -0
- package/dist/v2/core/geometry/barRects.js +201 -0
- package/dist/v2/core/geometry/contributionHeatmap.d.ts +49 -0
- package/dist/v2/core/geometry/contributionHeatmap.d.ts.map +1 -0
- package/dist/v2/core/geometry/contributionHeatmap.js +107 -0
- package/dist/v2/core/geometry/horizontalBarRects.d.ts +27 -0
- package/dist/v2/core/geometry/horizontalBarRects.d.ts.map +1 -0
- package/dist/v2/core/geometry/horizontalBarRects.js +202 -0
- package/dist/v2/core/geometry/index.d.ts +12 -0
- package/dist/v2/core/geometry/index.d.ts.map +1 -0
- package/dist/v2/core/geometry/index.js +11 -0
- package/dist/v2/core/geometry/lineDecimation.d.ts +8 -0
- package/dist/v2/core/geometry/lineDecimation.d.ts.map +1 -0
- package/dist/v2/core/geometry/lineDecimation.js +110 -0
- package/dist/v2/core/geometry/linePath.d.ts +5 -0
- package/dist/v2/core/geometry/linePath.d.ts.map +1 -0
- package/dist/v2/core/geometry/linePath.js +98 -0
- package/dist/v2/core/geometry/lineSeries.d.ts +29 -0
- package/dist/v2/core/geometry/lineSeries.d.ts.map +1 -0
- package/dist/v2/core/geometry/lineSeries.js +51 -0
- package/dist/v2/core/geometry/path.d.ts +6 -0
- package/dist/v2/core/geometry/path.d.ts.map +1 -0
- package/dist/v2/core/geometry/path.js +24 -0
- package/dist/v2/core/geometry/pieArcs.d.ts +29 -0
- package/dist/v2/core/geometry/pieArcs.d.ts.map +1 -0
- package/dist/v2/core/geometry/pieArcs.js +142 -0
- package/dist/v2/core/geometry/progressRings.d.ts +30 -0
- package/dist/v2/core/geometry/progressRings.d.ts.map +1 -0
- package/dist/v2/core/geometry/progressRings.js +104 -0
- package/dist/v2/core/geometry/types.d.ts +32 -0
- package/dist/v2/core/geometry/types.d.ts.map +1 -0
- package/dist/v2/core/geometry/types.js +1 -0
- package/dist/v2/core/index.d.ts +6 -0
- package/dist/v2/core/index.d.ts.map +1 -0
- package/dist/v2/core/index.js +6 -0
- package/dist/v2/core/interaction/index.d.ts +5 -0
- package/dist/v2/core/interaction/index.d.ts.map +1 -0
- package/dist/v2/core/interaction/index.js +2 -0
- package/dist/v2/core/interaction/viewport.d.ts +71 -0
- package/dist/v2/core/interaction/viewport.d.ts.map +1 -0
- package/dist/v2/core/interaction/viewport.js +216 -0
- package/dist/v2/core/interaction/viewportTransform.d.ts +17 -0
- package/dist/v2/core/interaction/viewportTransform.d.ts.map +1 -0
- package/dist/v2/core/interaction/viewportTransform.js +70 -0
- package/dist/v2/core/layout/autoPadding.d.ts +3 -0
- package/dist/v2/core/layout/autoPadding.d.ts.map +1 -0
- package/dist/v2/core/layout/autoPadding.js +33 -0
- package/dist/v2/core/layout/chartBox.d.ts +5 -0
- package/dist/v2/core/layout/chartBox.d.ts.map +1 -0
- package/dist/v2/core/layout/chartBox.js +22 -0
- package/dist/v2/core/layout/debugLayout.d.ts +3 -0
- package/dist/v2/core/layout/debugLayout.d.ts.map +1 -0
- package/dist/v2/core/layout/debugLayout.js +20 -0
- package/dist/v2/core/layout/index.d.ts +8 -0
- package/dist/v2/core/layout/index.d.ts.map +1 -0
- package/dist/v2/core/layout/index.js +6 -0
- package/dist/v2/core/layout/labelCollision.d.ts +3 -0
- package/dist/v2/core/layout/labelCollision.d.ts.map +1 -0
- package/dist/v2/core/layout/labelCollision.js +90 -0
- package/dist/v2/core/layout/legendLayout.d.ts +3 -0
- package/dist/v2/core/layout/legendLayout.d.ts.map +1 -0
- package/dist/v2/core/layout/legendLayout.js +39 -0
- package/dist/v2/core/layout/tooltipPlacement.d.ts +3 -0
- package/dist/v2/core/layout/tooltipPlacement.d.ts.map +1 -0
- package/dist/v2/core/layout/tooltipPlacement.js +76 -0
- package/dist/v2/core/layout/types.d.ts +114 -0
- package/dist/v2/core/layout/types.d.ts.map +1 -0
- package/dist/v2/core/layout/types.js +1 -0
- package/dist/v2/core/scales/band.d.ts +15 -0
- package/dist/v2/core/scales/band.d.ts.map +1 -0
- package/dist/v2/core/scales/band.js +34 -0
- package/dist/v2/core/scales/domain.d.ts +6 -0
- package/dist/v2/core/scales/domain.d.ts.map +1 -0
- package/dist/v2/core/scales/domain.js +109 -0
- package/dist/v2/core/scales/index.d.ts +7 -0
- package/dist/v2/core/scales/index.d.ts.map +1 -0
- package/dist/v2/core/scales/index.js +5 -0
- package/dist/v2/core/scales/linear.d.ts +8 -0
- package/dist/v2/core/scales/linear.d.ts.map +1 -0
- package/dist/v2/core/scales/linear.js +22 -0
- package/dist/v2/core/scales/ticks.d.ts +4 -0
- package/dist/v2/core/scales/ticks.d.ts.map +1 -0
- package/dist/v2/core/scales/ticks.js +111 -0
- package/dist/v2/core/scales/time.d.ts +8 -0
- package/dist/v2/core/scales/time.d.ts.map +1 -0
- package/dist/v2/core/scales/time.js +23 -0
- package/dist/v2/core/scales/types.d.ts +46 -0
- package/dist/v2/core/scales/types.d.ts.map +1 -0
- package/dist/v2/core/scales/types.js +1 -0
- package/dist/v2/index.d.ts +1 -0
- package/dist/v2/index.js +1 -0
- package/dist/v2/react-native/charts/bar/BarChart.d.ts +6 -0
- package/dist/v2/react-native/charts/bar/BarChart.d.ts.map +1 -0
- package/dist/v2/react-native/charts/bar/BarChart.js +199 -0
- package/dist/v2/react-native/charts/bar/BarChartSurface.d.ts +36 -0
- package/dist/v2/react-native/charts/bar/BarChartSurface.d.ts.map +1 -0
- package/dist/v2/react-native/charts/bar/BarChartSurface.js +134 -0
- package/dist/v2/react-native/charts/bar/StackedBarChart.d.ts +4 -0
- package/dist/v2/react-native/charts/bar/StackedBarChart.d.ts.map +1 -0
- package/dist/v2/react-native/charts/bar/StackedBarChart.js +9 -0
- package/dist/v2/react-native/charts/bar/accessibility.d.ts +31 -0
- package/dist/v2/react-native/charts/bar/accessibility.d.ts.map +1 -0
- package/dist/v2/react-native/charts/bar/accessibility.js +87 -0
- package/dist/v2/react-native/charts/bar/interaction.d.ts +18 -0
- package/dist/v2/react-native/charts/bar/interaction.d.ts.map +1 -0
- package/dist/v2/react-native/charts/bar/interaction.js +62 -0
- package/dist/v2/react-native/charts/bar/model.d.ts +3 -0
- package/dist/v2/react-native/charts/bar/model.d.ts.map +1 -0
- package/dist/v2/react-native/charts/bar/model.js +326 -0
- package/dist/v2/react-native/charts/bar/modelUtils.d.ts +27 -0
- package/dist/v2/react-native/charts/bar/modelUtils.d.ts.map +1 -0
- package/dist/v2/react-native/charts/bar/modelUtils.js +58 -0
- package/dist/v2/react-native/charts/bar/options.d.ts +7 -0
- package/dist/v2/react-native/charts/bar/options.d.ts.map +1 -0
- package/dist/v2/react-native/charts/bar/options.js +49 -0
- package/dist/v2/react-native/charts/bar/rendererSafety.d.ts +12 -0
- package/dist/v2/react-native/charts/bar/rendererSafety.d.ts.map +1 -0
- package/dist/v2/react-native/charts/bar/rendererSafety.js +31 -0
- package/dist/v2/react-native/charts/bar/selectionAnimation.d.ts +42 -0
- package/dist/v2/react-native/charts/bar/selectionAnimation.d.ts.map +1 -0
- package/dist/v2/react-native/charts/bar/selectionAnimation.js +158 -0
- package/dist/v2/react-native/charts/bar/stackedCompat.d.ts +55 -0
- package/dist/v2/react-native/charts/bar/stackedCompat.d.ts.map +1 -0
- package/dist/v2/react-native/charts/bar/stackedCompat.js +105 -0
- package/dist/v2/react-native/charts/bar/tooltip.d.ts +11 -0
- package/dist/v2/react-native/charts/bar/tooltip.d.ts.map +1 -0
- package/dist/v2/react-native/charts/bar/tooltip.js +18 -0
- package/dist/v2/react-native/charts/bar/tooltipModel.d.ts +33 -0
- package/dist/v2/react-native/charts/bar/tooltipModel.d.ts.map +1 -0
- package/dist/v2/react-native/charts/bar/tooltipModel.js +46 -0
- package/dist/v2/react-native/charts/bar/tooltipPlacement.d.ts +9 -0
- package/dist/v2/react-native/charts/bar/tooltipPlacement.d.ts.map +1 -0
- package/dist/v2/react-native/charts/bar/tooltipPlacement.js +9 -0
- package/dist/v2/react-native/charts/bar/types.d.ts +211 -0
- package/dist/v2/react-native/charts/bar/types.d.ts.map +1 -0
- package/dist/v2/react-native/charts/bar/types.js +1 -0
- package/dist/v2/react-native/charts/bar/useAnimatedTooltipModel.d.ts +10 -0
- package/dist/v2/react-native/charts/bar/useAnimatedTooltipModel.d.ts.map +1 -0
- package/dist/v2/react-native/charts/bar/useAnimatedTooltipModel.js +87 -0
- package/dist/v2/react-native/charts/bar/viewport.d.ts +20 -0
- package/dist/v2/react-native/charts/bar/viewport.d.ts.map +1 -0
- package/dist/v2/react-native/charts/bar/viewport.js +47 -0
- package/dist/v2/react-native/charts/contribution/ContributionGraph.d.ts +13 -0
- package/dist/v2/react-native/charts/contribution/ContributionGraph.d.ts.map +1 -0
- package/dist/v2/react-native/charts/contribution/ContributionGraph.js +159 -0
- package/dist/v2/react-native/charts/contribution/accessibility.d.ts +25 -0
- package/dist/v2/react-native/charts/contribution/accessibility.d.ts.map +1 -0
- package/dist/v2/react-native/charts/contribution/accessibility.js +50 -0
- package/dist/v2/react-native/charts/contribution/interaction.d.ts +23 -0
- package/dist/v2/react-native/charts/contribution/interaction.d.ts.map +1 -0
- package/dist/v2/react-native/charts/contribution/interaction.js +75 -0
- package/dist/v2/react-native/charts/contribution/model.d.ts +17 -0
- package/dist/v2/react-native/charts/contribution/model.d.ts.map +1 -0
- package/dist/v2/react-native/charts/contribution/model.js +102 -0
- package/dist/v2/react-native/charts/contribution/types.d.ts +71 -0
- package/dist/v2/react-native/charts/contribution/types.d.ts.map +1 -0
- package/dist/v2/react-native/charts/contribution/types.js +1 -0
- package/dist/v2/react-native/charts/line/AreaChart.d.ts +3 -0
- package/dist/v2/react-native/charts/line/AreaChart.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/AreaChart.js +3 -0
- package/dist/v2/react-native/charts/line/ChartSurface.d.ts +16 -0
- package/dist/v2/react-native/charts/line/ChartSurface.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/ChartSurface.js +151 -0
- package/dist/v2/react-native/charts/line/LineChart.d.ts +6 -0
- package/dist/v2/react-native/charts/line/LineChart.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/LineChart.js +294 -0
- package/dist/v2/react-native/charts/line/StickyYAxis.d.ts +15 -0
- package/dist/v2/react-native/charts/line/StickyYAxis.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/StickyYAxis.js +26 -0
- package/dist/v2/react-native/charts/line/accessibility.d.ts +34 -0
- package/dist/v2/react-native/charts/line/accessibility.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/accessibility.js +103 -0
- package/dist/v2/react-native/charts/line/axisLabels.d.ts +37 -0
- package/dist/v2/react-native/charts/line/axisLabels.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/axisLabels.js +55 -0
- package/dist/v2/react-native/charts/line/debugLayout.d.ts +26 -0
- package/dist/v2/react-native/charts/line/debugLayout.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/debugLayout.js +77 -0
- package/dist/v2/react-native/charts/line/debugOverlay.d.ts +9 -0
- package/dist/v2/react-native/charts/line/debugOverlay.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/debugOverlay.js +30 -0
- package/dist/v2/react-native/charts/line/defaultTooltip.d.ts +3 -0
- package/dist/v2/react-native/charts/line/defaultTooltip.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/defaultTooltip.js +17 -0
- package/dist/v2/react-native/charts/line/interaction.d.ts +82 -0
- package/dist/v2/react-native/charts/line/interaction.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/interaction.js +94 -0
- package/dist/v2/react-native/charts/line/legend.d.ts +35 -0
- package/dist/v2/react-native/charts/line/legend.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/legend.js +95 -0
- package/dist/v2/react-native/charts/line/markers.d.ts +11 -0
- package/dist/v2/react-native/charts/line/markers.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/markers.js +52 -0
- package/dist/v2/react-native/charts/line/options.d.ts +172 -0
- package/dist/v2/react-native/charts/line/options.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/options.js +168 -0
- package/dist/v2/react-native/charts/line/outsidePressSurfaces.d.ts +15 -0
- package/dist/v2/react-native/charts/line/outsidePressSurfaces.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/outsidePressSurfaces.js +37 -0
- package/dist/v2/react-native/charts/line/overviewProps.d.ts +45 -0
- package/dist/v2/react-native/charts/line/overviewProps.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/overviewProps.js +4 -0
- package/dist/v2/react-native/charts/line/rangeSelector.d.ts +19 -0
- package/dist/v2/react-native/charts/line/rangeSelector.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/rangeSelector.js +185 -0
- package/dist/v2/react-native/charts/line/rangeSelectorConfig.d.ts +38 -0
- package/dist/v2/react-native/charts/line/rangeSelectorConfig.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/rangeSelectorConfig.js +41 -0
- package/dist/v2/react-native/charts/line/referenceLabelPlacement.d.ts +21 -0
- package/dist/v2/react-native/charts/line/referenceLabelPlacement.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/referenceLabelPlacement.js +113 -0
- package/dist/v2/react-native/charts/line/references.d.ts +62 -0
- package/dist/v2/react-native/charts/line/references.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/references.js +156 -0
- package/dist/v2/react-native/charts/line/renderer.d.ts +4 -0
- package/dist/v2/react-native/charts/line/renderer.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/renderer.js +23 -0
- package/dist/v2/react-native/charts/line/responders.d.ts +13 -0
- package/dist/v2/react-native/charts/line/responders.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/responders.js +62 -0
- package/dist/v2/react-native/charts/line/selection.d.ts +31 -0
- package/dist/v2/react-native/charts/line/selection.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/selection.js +26 -0
- package/dist/v2/react-native/charts/line/seriesInput.d.ts +4 -0
- package/dist/v2/react-native/charts/line/seriesInput.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/seriesInput.js +13 -0
- package/dist/v2/react-native/charts/line/seriesStyles.d.ts +20 -0
- package/dist/v2/react-native/charts/line/seriesStyles.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/seriesStyles.js +33 -0
- package/dist/v2/react-native/charts/line/stickyYAxisLayout.d.ts +6 -0
- package/dist/v2/react-native/charts/line/stickyYAxisLayout.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/stickyYAxisLayout.js +2 -0
- package/dist/v2/react-native/charts/line/text.d.ts +7 -0
- package/dist/v2/react-native/charts/line/text.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/text.js +7 -0
- package/dist/v2/react-native/charts/line/thresholdRendering.d.ts +28 -0
- package/dist/v2/react-native/charts/line/thresholdRendering.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/thresholdRendering.js +145 -0
- package/dist/v2/react-native/charts/line/tooltip.d.ts +70 -0
- package/dist/v2/react-native/charts/line/tooltip.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/tooltip.js +87 -0
- package/dist/v2/react-native/charts/line/types.d.ts +371 -0
- package/dist/v2/react-native/charts/line/types.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/types.js +1 -0
- package/dist/v2/react-native/charts/line/useAnimatedTooltipModel.d.ts +13 -0
- package/dist/v2/react-native/charts/line/useAnimatedTooltipModel.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/useAnimatedTooltipModel.js +84 -0
- package/dist/v2/react-native/charts/line/useAnimatedYAxisLabels.d.ts +5 -0
- package/dist/v2/react-native/charts/line/useAnimatedYAxisLabels.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/useAnimatedYAxisLabels.js +141 -0
- package/dist/v2/react-native/charts/line/useChartModel.d.ts +103 -0
- package/dist/v2/react-native/charts/line/useChartModel.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/useChartModel.js +367 -0
- package/dist/v2/react-native/charts/line/useDebugLayout.d.ts +16 -0
- package/dist/v2/react-native/charts/line/useDebugLayout.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/useDebugLayout.js +35 -0
- package/dist/v2/react-native/charts/line/utils.d.ts +10 -0
- package/dist/v2/react-native/charts/line/utils.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/utils.js +40 -0
- package/dist/v2/react-native/charts/line/viewportInteraction.d.ts +3 -0
- package/dist/v2/react-native/charts/line/viewportInteraction.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/viewportInteraction.js +1 -0
- package/dist/v2/react-native/charts/line/viewportPinchZoom.d.ts +2 -0
- package/dist/v2/react-native/charts/line/viewportPinchZoom.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/viewportPinchZoom.js +1 -0
- package/dist/v2/react-native/charts/line/xLabelCandidates.d.ts +13 -0
- package/dist/v2/react-native/charts/line/xLabelCandidates.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/xLabelCandidates.js +23 -0
- package/dist/v2/react-native/charts/line/xLabels.d.ts +39 -0
- package/dist/v2/react-native/charts/line/xLabels.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/xLabels.js +289 -0
- package/dist/v2/react-native/charts/line/xScale.d.ts +6 -0
- package/dist/v2/react-native/charts/line/xScale.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/xScale.js +25 -0
- package/dist/v2/react-native/charts/line/yAxisModel.d.ts +29 -0
- package/dist/v2/react-native/charts/line/yAxisModel.d.ts.map +1 -0
- package/dist/v2/react-native/charts/line/yAxisModel.js +39 -0
- package/dist/v2/react-native/charts/pie/PieChart.d.ts +7 -0
- package/dist/v2/react-native/charts/pie/PieChart.d.ts.map +1 -0
- package/dist/v2/react-native/charts/pie/PieChart.js +253 -0
- package/dist/v2/react-native/charts/pie/accessibility.d.ts +28 -0
- package/dist/v2/react-native/charts/pie/accessibility.d.ts.map +1 -0
- package/dist/v2/react-native/charts/pie/accessibility.js +49 -0
- package/dist/v2/react-native/charts/pie/activeSlice.d.ts +15 -0
- package/dist/v2/react-native/charts/pie/activeSlice.d.ts.map +1 -0
- package/dist/v2/react-native/charts/pie/activeSlice.js +26 -0
- package/dist/v2/react-native/charts/pie/arcLabels.d.ts +32 -0
- package/dist/v2/react-native/charts/pie/arcLabels.d.ts.map +1 -0
- package/dist/v2/react-native/charts/pie/arcLabels.js +191 -0
- package/dist/v2/react-native/charts/pie/interaction.d.ts +26 -0
- package/dist/v2/react-native/charts/pie/interaction.d.ts.map +1 -0
- package/dist/v2/react-native/charts/pie/interaction.js +66 -0
- package/dist/v2/react-native/charts/pie/model.d.ts +15 -0
- package/dist/v2/react-native/charts/pie/model.d.ts.map +1 -0
- package/dist/v2/react-native/charts/pie/model.js +157 -0
- package/dist/v2/react-native/charts/pie/selectionAnimation.d.ts +33 -0
- package/dist/v2/react-native/charts/pie/selectionAnimation.d.ts.map +1 -0
- package/dist/v2/react-native/charts/pie/selectionAnimation.js +121 -0
- package/dist/v2/react-native/charts/pie/sliceSeparator.d.ts +7 -0
- package/dist/v2/react-native/charts/pie/sliceSeparator.d.ts.map +1 -0
- package/dist/v2/react-native/charts/pie/sliceSeparator.js +26 -0
- package/dist/v2/react-native/charts/pie/slices.d.ts +20 -0
- package/dist/v2/react-native/charts/pie/slices.d.ts.map +1 -0
- package/dist/v2/react-native/charts/pie/slices.js +54 -0
- package/dist/v2/react-native/charts/pie/types.d.ts +165 -0
- package/dist/v2/react-native/charts/pie/types.d.ts.map +1 -0
- package/dist/v2/react-native/charts/pie/types.js +1 -0
- package/dist/v2/react-native/charts/progress/ProgressChart.d.ts +7 -0
- package/dist/v2/react-native/charts/progress/ProgressChart.d.ts.map +1 -0
- package/dist/v2/react-native/charts/progress/ProgressChart.js +111 -0
- package/dist/v2/react-native/charts/progress/accessibility.d.ts +26 -0
- package/dist/v2/react-native/charts/progress/accessibility.d.ts.map +1 -0
- package/dist/v2/react-native/charts/progress/accessibility.js +71 -0
- package/dist/v2/react-native/charts/progress/animation.d.ts +36 -0
- package/dist/v2/react-native/charts/progress/animation.d.ts.map +1 -0
- package/dist/v2/react-native/charts/progress/animation.js +103 -0
- package/dist/v2/react-native/charts/progress/model.d.ts +14 -0
- package/dist/v2/react-native/charts/progress/model.d.ts.map +1 -0
- package/dist/v2/react-native/charts/progress/model.js +133 -0
- package/dist/v2/react-native/charts/progress/types.d.ts +72 -0
- package/dist/v2/react-native/charts/progress/types.d.ts.map +1 -0
- package/dist/v2/react-native/charts/progress/types.js +1 -0
- package/dist/v2/react-native/index.d.ts +24 -0
- package/dist/v2/react-native/index.d.ts.map +1 -0
- package/dist/v2/react-native/index.js +14 -0
- package/dist/v2/react-native/selection/ChartSelectionProvider.d.ts +27 -0
- package/dist/v2/react-native/selection/ChartSelectionProvider.d.ts.map +1 -0
- package/dist/v2/react-native/selection/ChartSelectionProvider.js +92 -0
- package/dist/v2/react-native/selection/index.d.ts +2 -0
- package/dist/v2/react-native/selection/index.d.ts.map +1 -0
- package/dist/v2/react-native/selection/index.js +1 -0
- package/dist/v2/react-native/selection/scope.d.ts +16 -0
- package/dist/v2/react-native/selection/scope.d.ts.map +1 -0
- package/dist/v2/react-native/selection/scope.js +18 -0
- package/dist/v2/react-native/theme/index.d.ts +4 -0
- package/dist/v2/react-native/theme/index.d.ts.map +1 -0
- package/dist/v2/react-native/theme/index.js +2 -0
- package/dist/v2/react-native/theme/presets.d.ts +84 -0
- package/dist/v2/react-native/theme/presets.d.ts.map +1 -0
- package/dist/v2/react-native/theme/presets.js +298 -0
- package/dist/v2/react-native/theme/provider.d.ts +20 -0
- package/dist/v2/react-native/theme/provider.d.ts.map +1 -0
- package/dist/v2/react-native/theme/provider.js +27 -0
- package/dist/v2/react-native/viewport/bounds.d.ts +7 -0
- package/dist/v2/react-native/viewport/bounds.d.ts.map +1 -0
- package/dist/v2/react-native/viewport/bounds.js +7 -0
- package/dist/v2/react-native/viewport/config.d.ts +13 -0
- package/dist/v2/react-native/viewport/config.d.ts.map +1 -0
- package/dist/v2/react-native/viewport/config.js +64 -0
- package/dist/v2/react-native/viewport/pan.d.ts +23 -0
- package/dist/v2/react-native/viewport/pan.d.ts.map +1 -0
- package/dist/v2/react-native/viewport/pan.js +110 -0
- package/dist/v2/react-native/viewport/pinchZoom.d.ts +17 -0
- package/dist/v2/react-native/viewport/pinchZoom.d.ts.map +1 -0
- package/dist/v2/react-native/viewport/pinchZoom.js +131 -0
- package/dist/v2/react-native/viewport/types.d.ts +55 -0
- package/dist/v2/react-native/viewport/types.d.ts.map +1 -0
- package/dist/v2/react-native/viewport/types.js +1 -0
- package/dist/v2/svg-renderer/capabilities.d.ts +3 -0
- package/dist/v2/svg-renderer/capabilities.d.ts.map +1 -0
- package/dist/v2/svg-renderer/capabilities.js +12 -0
- package/dist/v2/svg-renderer/clipPath.d.ts +4 -0
- package/dist/v2/svg-renderer/clipPath.d.ts.map +1 -0
- package/dist/v2/svg-renderer/clipPath.js +35 -0
- package/dist/v2/svg-renderer/defs.d.ts +6 -0
- package/dist/v2/svg-renderer/defs.d.ts.map +1 -0
- package/dist/v2/svg-renderer/defs.js +18 -0
- package/dist/v2/svg-renderer/ensureConsole.d.ts +4 -0
- package/dist/v2/svg-renderer/ensureConsole.d.ts.map +1 -0
- package/dist/v2/svg-renderer/ensureConsole.js +54 -0
- package/dist/v2/svg-renderer/hitRegions.d.ts +3 -0
- package/dist/v2/svg-renderer/hitRegions.d.ts.map +1 -0
- package/dist/v2/svg-renderer/hitRegions.js +6 -0
- package/dist/v2/svg-renderer/index.d.ts +14 -0
- package/dist/v2/svg-renderer/index.d.ts.map +1 -0
- package/dist/v2/svg-renderer/index.js +13 -0
- package/dist/v2/svg-renderer/layerOrder.d.ts +19 -0
- package/dist/v2/svg-renderer/layerOrder.d.ts.map +1 -0
- package/dist/v2/svg-renderer/layerOrder.js +18 -0
- package/dist/v2/svg-renderer/layers.d.ts +3 -0
- package/dist/v2/svg-renderer/layers.d.ts.map +1 -0
- package/dist/v2/svg-renderer/layers.js +4 -0
- package/dist/v2/svg-renderer/primitives.d.ts +12 -0
- package/dist/v2/svg-renderer/primitives.d.ts.map +1 -0
- package/dist/v2/svg-renderer/primitives.js +13 -0
- package/dist/v2/svg-renderer/renderer.d.ts +4 -0
- package/dist/v2/svg-renderer/renderer.d.ts.map +1 -0
- package/dist/v2/svg-renderer/renderer.js +24 -0
- package/dist/v2/svg-renderer/symbolGeometry.d.ts +6 -0
- package/dist/v2/svg-renderer/symbolGeometry.d.ts.map +1 -0
- package/dist/v2/svg-renderer/symbolGeometry.js +10 -0
- package/dist/v2/svg-renderer/symbols.d.ts +3 -0
- package/dist/v2/svg-renderer/symbols.d.ts.map +1 -0
- package/dist/v2/svg-renderer/symbols.js +23 -0
- package/dist/v2/svg-renderer/testIds.d.ts +2 -0
- package/dist/v2/svg-renderer/testIds.d.ts.map +1 -0
- package/dist/v2/svg-renderer/testIds.js +10 -0
- package/dist/v2/svg-renderer/textMeasurement.d.ts +4 -0
- package/dist/v2/svg-renderer/textMeasurement.d.ts.map +1 -0
- package/dist/v2/svg-renderer/textMeasurement.js +37 -0
- package/dist/v2/svg-renderer/types.d.ts +134 -0
- package/dist/v2/svg-renderer/types.d.ts.map +1 -0
- package/dist/v2/svg-renderer/types.js +1 -0
- package/package.json +56 -50
- package/v2/index.d.ts +1 -0
- package/v2/index.js +1 -0
- package/v2/package.json +6 -0
- package/scripts/chartkit-codemod.mjs +0 -256
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { ScrollView, StyleSheet, View } from "react-native";
|
|
4
|
+
import { resolveChartViewport, resolveChartViewportInitialOffset, resolveChartViewportWindow, sliceChartViewportData } from "../../../core/index";
|
|
5
|
+
import { useChartKitTheme } from "../../theme";
|
|
6
|
+
import { useLineChartAccessibilityLabel } from "./accessibility";
|
|
7
|
+
import { LineChartSurface } from "./ChartSurface";
|
|
8
|
+
import { StickyYAxis } from "./StickyYAxis";
|
|
9
|
+
import { buildLineChartSelectEvent, getLineChartInteractionConfig, getLineChartVisibleInteractionBounds, getNearestLineChartInteractionIndex, isLineChartInteractionEnabled, isLineChartInteractionInBounds, normalizeLineChartSelectedIndex } from "./interaction";
|
|
10
|
+
import { getSelectedLineSeries } from "./selection";
|
|
11
|
+
import { getLineChartOutsidePressSurfaces } from "./outsidePressSurfaces";
|
|
12
|
+
import { getLineChartOverviewProps } from "./overviewProps";
|
|
13
|
+
import { useLineChartResponderProps } from "./responders";
|
|
14
|
+
import { getStickyYAxisFadeOpacity } from "./stickyYAxisLayout";
|
|
15
|
+
import { LineChartRangeSelector } from "./rangeSelector";
|
|
16
|
+
import { getRangeSelectorConfig } from "./rangeSelectorConfig";
|
|
17
|
+
import { useAnimatedTooltipModel } from "./useAnimatedTooltipModel";
|
|
18
|
+
import { useLineChartYAxisLabels } from "./useAnimatedYAxisLabels";
|
|
19
|
+
import { useChartModel } from "./useChartModel";
|
|
20
|
+
import { useLineChartViewportPan } from "./viewportInteraction";
|
|
21
|
+
import { LineChartViewportGesture, useLineChartViewportPinchZoom } from "./viewportPinchZoom";
|
|
22
|
+
import { clampLineChartTooltipToViewport } from "./tooltip";
|
|
23
|
+
import { useScopedChartSelection } from "../../selection/ChartSelectionProvider";
|
|
24
|
+
export { getLineChartAccessibilitySummary, getLineChartDataTable } from "./accessibility";
|
|
25
|
+
export const LineChart = (props) => {
|
|
26
|
+
const chartId = useId().replace(/:/g, "");
|
|
27
|
+
const scopedChartId = props.id ?? chartId;
|
|
28
|
+
const chartKitTheme = useChartKitTheme();
|
|
29
|
+
const renderer = props.renderer ?? chartKitTheme.renderer;
|
|
30
|
+
const dataLength = props.data.length;
|
|
31
|
+
const accessibilityLabel = useLineChartAccessibilityLabel(props);
|
|
32
|
+
const scrollViewRef = useRef(null);
|
|
33
|
+
const interactionConfig = useMemo(() => getLineChartInteractionConfig(props.interaction), [props.interaction]);
|
|
34
|
+
const [gestureSelectedIndex, setGestureSelectedIndex] = useState(() => normalizeLineChartSelectedIndex(props.defaultSelectedIndex));
|
|
35
|
+
const [gestureSelectionPointer, setGestureSelectionPointer] = useState();
|
|
36
|
+
const effectiveSelectedIndex = props.selectedIndex ?? gestureSelectedIndex;
|
|
37
|
+
const rangeSelectorConfig = useMemo(() => getRangeSelectorConfig(props.rangeSelector), [props.rangeSelector]);
|
|
38
|
+
const viewportWindow = useMemo(() => resolveChartViewportWindow({
|
|
39
|
+
itemCount: props.data.length,
|
|
40
|
+
startIndex: props.viewport?.startIndex,
|
|
41
|
+
endIndex: props.viewport?.endIndex,
|
|
42
|
+
visiblePoints: props.viewport?.visiblePoints,
|
|
43
|
+
initialIndex: props.viewport?.initialIndex
|
|
44
|
+
}), [
|
|
45
|
+
props.data.length,
|
|
46
|
+
props.viewport?.endIndex,
|
|
47
|
+
props.viewport?.initialIndex,
|
|
48
|
+
props.viewport?.startIndex,
|
|
49
|
+
props.viewport?.visiblePoints
|
|
50
|
+
]);
|
|
51
|
+
const mainData = useMemo(() => sliceChartViewportData(props.data, viewportWindow), [props.data, viewportWindow]);
|
|
52
|
+
const isRangeSelectorVisible = rangeSelectorConfig.visible && props.data.length > 1;
|
|
53
|
+
const mainHeight = isRangeSelectorVisible
|
|
54
|
+
? Math.max(120, props.height - rangeSelectorConfig.height - rangeSelectorConfig.gap)
|
|
55
|
+
: props.height;
|
|
56
|
+
const viewport = useMemo(() => resolveChartViewport({
|
|
57
|
+
itemCount: mainData.length,
|
|
58
|
+
scrollable: props.scrollable,
|
|
59
|
+
viewportWidth: props.width,
|
|
60
|
+
visiblePoints: props.visiblePoints
|
|
61
|
+
}), [mainData.length, props.scrollable, props.visiblePoints, props.width]);
|
|
62
|
+
const initialScrollOffset = useMemo(() => resolveChartViewportInitialOffset({
|
|
63
|
+
initialIndex: props.initialIndex,
|
|
64
|
+
viewport
|
|
65
|
+
}), [props.initialIndex, viewport]);
|
|
66
|
+
const [scrollOffset, setScrollOffset] = useState(initialScrollOffset);
|
|
67
|
+
const chartProps = {
|
|
68
|
+
...props,
|
|
69
|
+
data: mainData,
|
|
70
|
+
height: mainHeight,
|
|
71
|
+
width: viewport.contentWidth,
|
|
72
|
+
...(effectiveSelectedIndex !== undefined
|
|
73
|
+
? { selectedIndex: effectiveSelectedIndex }
|
|
74
|
+
: {})
|
|
75
|
+
};
|
|
76
|
+
const model = useChartModel({
|
|
77
|
+
...chartProps,
|
|
78
|
+
chartKitTheme,
|
|
79
|
+
dataIndexOffset: viewportWindow.startIndex,
|
|
80
|
+
selectionPointer: gestureSelectionPointer?.index === effectiveSelectedIndex
|
|
81
|
+
? gestureSelectionPointer
|
|
82
|
+
: undefined,
|
|
83
|
+
stableYAxisData: props.data
|
|
84
|
+
});
|
|
85
|
+
const { boxes, geometries, interactionPoints, selectionModel, formatYLabel } = model;
|
|
86
|
+
const overviewBaseProps = getLineChartOverviewProps(props);
|
|
87
|
+
const overviewModel = useChartModel({
|
|
88
|
+
...overviewBaseProps,
|
|
89
|
+
activeDot: false,
|
|
90
|
+
chartKitTheme,
|
|
91
|
+
crosshair: false,
|
|
92
|
+
height: rangeSelectorConfig.height,
|
|
93
|
+
labelStrategy: "hide",
|
|
94
|
+
legend: false,
|
|
95
|
+
showDots: false,
|
|
96
|
+
tooltip: false,
|
|
97
|
+
width: props.width
|
|
98
|
+
});
|
|
99
|
+
const isInteractionEnabled = isLineChartInteractionEnabled(interactionConfig);
|
|
100
|
+
const animatedYAxisLabels = useLineChartYAxisLabels(model, props.axisLabelAnimation);
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
if (!viewport.scrollable) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const frame = requestAnimationFrame(() => {
|
|
106
|
+
setScrollOffset(initialScrollOffset);
|
|
107
|
+
scrollViewRef.current?.scrollTo({
|
|
108
|
+
animated: false,
|
|
109
|
+
x: initialScrollOffset
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
return () => {
|
|
113
|
+
cancelAnimationFrame(frame);
|
|
114
|
+
};
|
|
115
|
+
}, [initialScrollOffset, viewport.scrollable]);
|
|
116
|
+
const handleScroll = useCallback((event) => {
|
|
117
|
+
setScrollOffset(event.nativeEvent.contentOffset.x);
|
|
118
|
+
}, []);
|
|
119
|
+
const preventBrowserSelection = useCallback((event) => {
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
}, []);
|
|
122
|
+
const viewportPan = useLineChartViewportPan({
|
|
123
|
+
dataLength,
|
|
124
|
+
enabled: !viewport.scrollable,
|
|
125
|
+
onViewportChange: props.onViewportChange,
|
|
126
|
+
plotBounds: boxes.plot,
|
|
127
|
+
preventBrowserSelection,
|
|
128
|
+
viewportInteraction: props.viewportInteraction,
|
|
129
|
+
viewportWindow
|
|
130
|
+
});
|
|
131
|
+
const viewportPinchZoom = useLineChartViewportPinchZoom({
|
|
132
|
+
dataLength,
|
|
133
|
+
enabled: !viewport.scrollable,
|
|
134
|
+
onViewportChange: props.onViewportChange,
|
|
135
|
+
plotBounds: boxes.plot,
|
|
136
|
+
viewportInteraction: props.viewportInteraction,
|
|
137
|
+
viewportWindow
|
|
138
|
+
});
|
|
139
|
+
const isResponderEventInPlot = useCallback((event) => {
|
|
140
|
+
const { locationX, locationY } = event.nativeEvent;
|
|
141
|
+
return isLineChartInteractionInBounds({
|
|
142
|
+
bounds: boxes.plot,
|
|
143
|
+
locationX,
|
|
144
|
+
locationY
|
|
145
|
+
});
|
|
146
|
+
}, [boxes.plot]);
|
|
147
|
+
const visibleInteractionBounds = useMemo(() => getLineChartVisibleInteractionBounds({
|
|
148
|
+
bounds: boxes.plot,
|
|
149
|
+
scrollable: viewport.scrollable,
|
|
150
|
+
viewportWidth: props.width
|
|
151
|
+
}), [boxes.plot, props.width, viewport.scrollable]);
|
|
152
|
+
const clearGestureSelection = useCallback((event) => {
|
|
153
|
+
setGestureSelectionPointer(undefined);
|
|
154
|
+
if (props.selectedIndex === undefined) {
|
|
155
|
+
setGestureSelectedIndex(undefined);
|
|
156
|
+
}
|
|
157
|
+
interactionConfig.onDeselect?.(event);
|
|
158
|
+
}, [interactionConfig, props.selectedIndex]);
|
|
159
|
+
const clearSelectionFromScope = useCallback((reason) => {
|
|
160
|
+
if (reason === "scopeChange") {
|
|
161
|
+
if (props.selectedIndex === undefined) {
|
|
162
|
+
setGestureSelectedIndex(undefined);
|
|
163
|
+
}
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
clearGestureSelection({ reason });
|
|
167
|
+
}, [clearGestureSelection, props.selectedIndex]);
|
|
168
|
+
const scopedSelection = useScopedChartSelection({
|
|
169
|
+
chartId: scopedChartId,
|
|
170
|
+
controlled: props.selectedIndex !== undefined,
|
|
171
|
+
hasSelection: effectiveSelectedIndex !== undefined,
|
|
172
|
+
onClear: clearSelectionFromScope
|
|
173
|
+
});
|
|
174
|
+
const clearScopedGestureSelection = useCallback((event) => {
|
|
175
|
+
clearGestureSelection(event);
|
|
176
|
+
if (event.reason === "outsidePress") {
|
|
177
|
+
scopedSelection.dismissSelection?.("outsidePress");
|
|
178
|
+
}
|
|
179
|
+
else if (event.reason === "gestureEnd") {
|
|
180
|
+
scopedSelection.dismissSelection?.("programmatic");
|
|
181
|
+
}
|
|
182
|
+
}, [clearGestureSelection, scopedSelection]);
|
|
183
|
+
const handleInteractionEvent = useCallback((event) => {
|
|
184
|
+
preventBrowserSelection(event);
|
|
185
|
+
const { locationX, locationY } = event.nativeEvent;
|
|
186
|
+
const selectedDataIndex = getNearestLineChartInteractionIndex({
|
|
187
|
+
locationX,
|
|
188
|
+
points: interactionPoints
|
|
189
|
+
});
|
|
190
|
+
if (selectedDataIndex === undefined) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const selectedSeries = getSelectedLineSeries({
|
|
194
|
+
activeDot: props.activeDot,
|
|
195
|
+
formatYLabel,
|
|
196
|
+
geometries,
|
|
197
|
+
selectedDataIndex
|
|
198
|
+
});
|
|
199
|
+
const selectEvent = buildLineChartSelectEvent({
|
|
200
|
+
interactionPoints,
|
|
201
|
+
selectedDataIndex,
|
|
202
|
+
selectedSeries
|
|
203
|
+
});
|
|
204
|
+
if (!selectEvent) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
setGestureSelectionPointer({
|
|
208
|
+
index: selectedDataIndex,
|
|
209
|
+
x: locationX,
|
|
210
|
+
y: locationY
|
|
211
|
+
});
|
|
212
|
+
if (props.selectedIndex === undefined &&
|
|
213
|
+
interactionConfig.selectionPersistence !== "none") {
|
|
214
|
+
setGestureSelectedIndex(selectedDataIndex);
|
|
215
|
+
}
|
|
216
|
+
scopedSelection.selectChart();
|
|
217
|
+
interactionConfig.onSelect?.(selectEvent);
|
|
218
|
+
}, [
|
|
219
|
+
formatYLabel,
|
|
220
|
+
geometries,
|
|
221
|
+
interactionConfig,
|
|
222
|
+
interactionPoints,
|
|
223
|
+
props.activeDot,
|
|
224
|
+
props.selectedIndex,
|
|
225
|
+
preventBrowserSelection,
|
|
226
|
+
scopedSelection
|
|
227
|
+
]);
|
|
228
|
+
const responderProps = useLineChartResponderProps({
|
|
229
|
+
clearGestureSelection: clearScopedGestureSelection,
|
|
230
|
+
handleInteractionEvent,
|
|
231
|
+
interactionConfig,
|
|
232
|
+
isInteractionEnabled,
|
|
233
|
+
isResponderEventInPlot,
|
|
234
|
+
preventBrowserSelection,
|
|
235
|
+
viewportPan
|
|
236
|
+
});
|
|
237
|
+
const outsidePressSurfaceResponderProps = isInteractionEnabled && interactionConfig.deselectOnOutsidePress
|
|
238
|
+
? {
|
|
239
|
+
onStartShouldSetResponder: () => true,
|
|
240
|
+
onResponderGrant: (event) => {
|
|
241
|
+
preventBrowserSelection(event);
|
|
242
|
+
clearScopedGestureSelection({ reason: "outsidePress" });
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
: {};
|
|
246
|
+
const outsidePressSurfaces = getLineChartOutsidePressSurfaces({
|
|
247
|
+
enabled: isInteractionEnabled && interactionConfig.deselectOnOutsidePress,
|
|
248
|
+
mainHeight,
|
|
249
|
+
visibleInteractionBounds,
|
|
250
|
+
width: props.width
|
|
251
|
+
});
|
|
252
|
+
const animatedTooltip = useAnimatedTooltipModel(selectionModel?.tooltip);
|
|
253
|
+
const displayTooltip = animatedTooltip && viewport.scrollable
|
|
254
|
+
? clampLineChartTooltipToViewport(animatedTooltip, {
|
|
255
|
+
leftInset: boxes.plot.x + 4,
|
|
256
|
+
scrollOffset,
|
|
257
|
+
viewportWidth: props.width
|
|
258
|
+
})
|
|
259
|
+
: animatedTooltip;
|
|
260
|
+
const chartWidth = viewport.contentWidth;
|
|
261
|
+
const xAxisLabelFadeY = boxes.plot.y + boxes.plot.height;
|
|
262
|
+
const scrollStartFadeId = `${chartId}-scroll-start-fade`;
|
|
263
|
+
const mainSurface = (_jsx(LineChartSurface, { animatedTooltip: displayTooltip, chartId: chartId, chartWidth: chartWidth, isScrollable: viewport.scrollable, mainHeight: mainHeight, model: model, props: props, renderer: renderer, responderProps: responderProps, yAxisLabels: animatedYAxisLabels }));
|
|
264
|
+
return (_jsxs(View, { accessible: true, accessibilityLabel: accessibilityLabel, accessibilityRole: "image", testID: props.testID, style: [styles.container, { width: props.width, height: props.height }], children: [_jsxs(View, { style: { width: props.width, height: mainHeight }, children: [viewport.scrollable ? (_jsx(ScrollView, { ref: scrollViewRef, horizontal: true, bounces: false, showsHorizontalScrollIndicator: true, style: [
|
|
265
|
+
styles.scroller,
|
|
266
|
+
{ width: props.width, height: mainHeight }
|
|
267
|
+
], contentContainerStyle: [
|
|
268
|
+
styles.scrollerContent,
|
|
269
|
+
{ width: chartWidth, height: mainHeight }
|
|
270
|
+
], onScroll: handleScroll, scrollEventThrottle: 16, children: mainSurface })) : (_jsx(LineChartViewportGesture, { gesture: viewportPinchZoom, children: mainSurface })), viewport.scrollable ? (_jsx(StickyYAxis, { fadeHeight: Math.max(0, mainHeight - xAxisLabelFadeY), fadeOpacity: getStickyYAxisFadeOpacity(scrollOffset), fadeWidth: Math.min(12, Math.max(0, props.width - boxes.plot.x)), fadeY: xAxisLabelFadeY, gradientId: scrollStartFadeId, mainHeight: mainHeight, model: model, renderer: renderer, width: props.width, yAxisLabels: animatedYAxisLabels })) : null, outsidePressSurfaces.map((surface) => (_jsx(View, { style: [
|
|
271
|
+
styles.outsidePressSurface,
|
|
272
|
+
{
|
|
273
|
+
height: surface.height,
|
|
274
|
+
left: surface.left,
|
|
275
|
+
top: surface.top,
|
|
276
|
+
width: surface.width
|
|
277
|
+
}
|
|
278
|
+
], ...outsidePressSurfaceResponderProps }, `outside-press-${surface.key}`)))] }), _jsx(LineChartRangeSelector, { config: rangeSelectorConfig, dataLength: dataLength, isVisible: isRangeSelectorVisible, model: overviewModel, onViewportChange: props.onViewportChange, preventBrowserSelection: preventBrowserSelection, renderer: renderer, testID: props.testID, viewportWindow: viewportWindow, width: props.width })] }));
|
|
279
|
+
};
|
|
280
|
+
const styles = StyleSheet.create({
|
|
281
|
+
container: {
|
|
282
|
+
overflow: "hidden",
|
|
283
|
+
userSelect: "none"
|
|
284
|
+
},
|
|
285
|
+
scroller: {
|
|
286
|
+
overflow: "hidden"
|
|
287
|
+
},
|
|
288
|
+
scrollerContent: {
|
|
289
|
+
flexGrow: 0
|
|
290
|
+
},
|
|
291
|
+
outsidePressSurface: {
|
|
292
|
+
position: "absolute"
|
|
293
|
+
}
|
|
294
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LineChartModel } from "./useChartModel";
|
|
2
|
+
import type { LineChartRenderer, LineChartYAxisLabelModel } from "./types";
|
|
3
|
+
export declare const StickyYAxis: <TData extends Record<string, unknown>>({ fadeHeight, fadeOpacity, fadeWidth, fadeY, gradientId, mainHeight, model, renderer: rendererProp, width, yAxisLabels }: {
|
|
4
|
+
fadeHeight: number;
|
|
5
|
+
fadeOpacity: number;
|
|
6
|
+
fadeWidth: number;
|
|
7
|
+
fadeY: number;
|
|
8
|
+
gradientId: string;
|
|
9
|
+
mainHeight: number;
|
|
10
|
+
model: LineChartModel<TData>;
|
|
11
|
+
renderer?: LineChartRenderer | undefined;
|
|
12
|
+
width: number;
|
|
13
|
+
yAxisLabels: LineChartYAxisLabelModel[];
|
|
14
|
+
}) => import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=StickyYAxis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StickyYAxis.d.ts","sourceRoot":"","sources":["../../../src/charts/line/StickyYAxis.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAE3E,eAAO,MAAM,WAAW,GAAI,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,0HAWhE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,wBAAwB,EAAE,CAAC;CACzC,gCA6EA,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { getLineChartRenderer } from "./renderer";
|
|
4
|
+
import { getStickyYAxisBackgroundHeight } from "./stickyYAxisLayout";
|
|
5
|
+
import { getFontFamilyProps } from "./text";
|
|
6
|
+
export const StickyYAxis = ({ fadeHeight, fadeOpacity, fadeWidth, fadeY, gradientId, mainHeight, model, renderer: rendererProp, width, yAxisLabels }) => {
|
|
7
|
+
const { boxes, resolvedTheme } = model;
|
|
8
|
+
const renderer = getLineChartRenderer(rendererProp);
|
|
9
|
+
const { Defs, Group, Rect, Surface, Text } = renderer;
|
|
10
|
+
const Layer = renderer.Layer ?? Group;
|
|
11
|
+
const LinearGradient = renderer.LinearGradient;
|
|
12
|
+
const canRenderText = renderer.capabilities?.text !== false;
|
|
13
|
+
const supportsGradients = renderer.capabilities?.gradients !== false && Boolean(LinearGradient);
|
|
14
|
+
return (_jsx(View, { pointerEvents: "none", style: {
|
|
15
|
+
left: 0,
|
|
16
|
+
position: "absolute",
|
|
17
|
+
top: 0,
|
|
18
|
+
width,
|
|
19
|
+
height: mainHeight
|
|
20
|
+
}, children: _jsxs(Surface, { width: width, height: mainHeight, children: [_jsx(Defs, { children: supportsGradients && LinearGradient ? (_jsx(LinearGradient, { id: gradientId, x1: "0%", x2: "100%", y1: "0%", y2: "0%", stops: [
|
|
21
|
+
{ offset: "0%", color: resolvedTheme.background, opacity: 1 },
|
|
22
|
+
{ offset: "100%", color: resolvedTheme.background, opacity: 0 }
|
|
23
|
+
] })) : null }), _jsxs(Layer, { name: "background", children: [_jsx(Rect, { x: 0, y: 0, width: boxes.plot.x, height: getStickyYAxisBackgroundHeight({ fadeY, mainHeight }), fill: resolvedTheme.background }), supportsGradients && fadeWidth > 0 ? (_jsx(Rect, { x: boxes.plot.x, y: fadeY, width: fadeWidth, height: fadeHeight, fill: `url(#${gradientId})`, opacity: fadeOpacity })) : null] }), _jsx(Layer, { name: "axes", children: canRenderText
|
|
24
|
+
? yAxisLabels.map((label) => (_jsx(Text, { x: boxes.plot.x - 8, y: label.y, fill: resolvedTheme.mutedText, fontSize: resolvedTheme.typography.axisLabelSize, opacity: label.opacity, textAnchor: "end", ...getFontFamilyProps(resolvedTheme.typography.fontFamily), children: label.text }, `sticky-label-y-${label.key}`)))
|
|
25
|
+
: null })] }) }));
|
|
26
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { LineChartProps } from "./types";
|
|
2
|
+
type ChartXValue = string | number | Date;
|
|
3
|
+
export type LineChartDataTableColumn = {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
export type LineChartDataTableRow<TData = unknown> = {
|
|
8
|
+
index: number;
|
|
9
|
+
x: ChartXValue;
|
|
10
|
+
xLabel: string;
|
|
11
|
+
values: Record<string, number | null>;
|
|
12
|
+
formattedValues: Record<string, string>;
|
|
13
|
+
raw: TData;
|
|
14
|
+
};
|
|
15
|
+
export type LineChartDataTable<TData = unknown> = {
|
|
16
|
+
columns: LineChartDataTableColumn[];
|
|
17
|
+
rows: Array<LineChartDataTableRow<TData>>;
|
|
18
|
+
};
|
|
19
|
+
type LineChartAccessibilityInput<TData extends Record<string, unknown>> = {
|
|
20
|
+
data: LineChartProps<TData>["data"];
|
|
21
|
+
formatXLabel?: LineChartProps<TData>["formatXLabel"] | undefined;
|
|
22
|
+
formatYLabel?: LineChartProps<TData>["formatYLabel"] | undefined;
|
|
23
|
+
series?: LineChartProps<TData>["series"] | undefined;
|
|
24
|
+
xKey: LineChartProps<TData>["xKey"];
|
|
25
|
+
yKey?: LineChartProps<TData>["yKey"] | undefined;
|
|
26
|
+
yKeys?: LineChartProps<TData>["yKeys"] | undefined;
|
|
27
|
+
};
|
|
28
|
+
export declare const getLineChartDataTable: <TData extends Record<string, unknown>>({ data, formatXLabel, formatYLabel, series, xKey, yKey, yKeys }: LineChartAccessibilityInput<TData>) => LineChartDataTable<TData>;
|
|
29
|
+
export declare const getLineChartAccessibilitySummary: <TData extends Record<string, unknown>>(input: LineChartAccessibilityInput<TData>) => string;
|
|
30
|
+
export declare const useLineChartAccessibilityLabel: <TData extends Record<string, unknown>>({ accessibilityLabel, data, formatXLabel, formatYLabel, series, xKey, yKey, yKeys }: LineChartAccessibilityInput<TData> & {
|
|
31
|
+
accessibilityLabel?: string | undefined;
|
|
32
|
+
}) => string;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=accessibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accessibility.d.ts","sourceRoot":"","sources":["../../../src/charts/line/accessibility.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAmB,MAAM,SAAS,CAAC;AAG/D,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAE1C,MAAM,MAAM,wBAAwB,GAAG;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,KAAK,GAAG,OAAO,IAAI;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,WAAW,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;IACtC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,GAAG,EAAE,KAAK,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAAC,KAAK,GAAG,OAAO,IAAI;IAChD,OAAO,EAAE,wBAAwB,EAAE,CAAC;IACpC,IAAI,EAAE,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC;CAC3C,CAAC;AAEF,KAAK,2BAA2B,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACxE,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;IACpC,YAAY,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,GAAG,SAAS,CAAC;IACjE,YAAY,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,GAAG,SAAS,CAAC;IACjE,MAAM,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IACrD,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IACjD,KAAK,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;CACpD,CAAC;AAuDF,eAAO,MAAM,qBAAqB,GAAI,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,iEAQ1E,2BAA2B,CAAC,KAAK,CAAC,KAAG,kBAAkB,CAAC,KAAK,CAiC/D,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAC3C,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAErC,OAAO,2BAA2B,CAAC,KAAK,CAAC,WA4C1C,CAAC;AAEF,eAAO,MAAM,8BAA8B,GACzC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,qFASC,2BAA2B,CAAC,KAAK,CAAC,GAAG;IACtC,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC,WAuBE,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { resolveLineChartSeriesInput } from "./seriesInput";
|
|
3
|
+
import { defaultFormatXLabel, defaultFormatYLabel } from "./utils";
|
|
4
|
+
const pluralize = (count, singular, plural = `${singular}s`) => `${count} ${count === 1 ? singular : plural}`;
|
|
5
|
+
const normalizeXValue = (value, fallback) => {
|
|
6
|
+
return typeof value === "string" ||
|
|
7
|
+
(typeof value === "number" && Number.isFinite(value)) ||
|
|
8
|
+
value instanceof Date
|
|
9
|
+
? value
|
|
10
|
+
: fallback;
|
|
11
|
+
};
|
|
12
|
+
const normalizeYValue = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
13
|
+
const getDefinedSeriesPoints = (series, rows) => rows.flatMap((row) => {
|
|
14
|
+
const columnKey = String(series.key ?? series.yKey);
|
|
15
|
+
const value = row.values[columnKey];
|
|
16
|
+
return typeof value === "number"
|
|
17
|
+
? [
|
|
18
|
+
{
|
|
19
|
+
formattedValue: row.formattedValues[columnKey] ?? String(value),
|
|
20
|
+
raw: row.raw,
|
|
21
|
+
value,
|
|
22
|
+
xLabel: row.xLabel
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
: [];
|
|
26
|
+
});
|
|
27
|
+
const getMinPoint = (points) => points.reduce((min, point) => (!min || point.value < min.value ? point : min), undefined);
|
|
28
|
+
const getMaxPoint = (points) => points.reduce((max, point) => (!max || point.value > max.value ? point : max), undefined);
|
|
29
|
+
export const getLineChartDataTable = ({ data, formatXLabel = defaultFormatXLabel, formatYLabel = defaultFormatYLabel, series, xKey, yKey, yKeys }) => {
|
|
30
|
+
const seriesInputs = resolveLineChartSeriesInput(yKey, yKeys, series);
|
|
31
|
+
const columns = seriesInputs.map((item, index) => ({
|
|
32
|
+
key: String(item.key ?? item.yKey ?? `series-${index}`),
|
|
33
|
+
label: String(item.label ?? item.key ?? item.yKey ?? `Series ${index + 1}`)
|
|
34
|
+
}));
|
|
35
|
+
return {
|
|
36
|
+
columns,
|
|
37
|
+
rows: data.map((row, index) => {
|
|
38
|
+
const x = normalizeXValue(row[xKey], index);
|
|
39
|
+
const values = {};
|
|
40
|
+
const formattedValues = {};
|
|
41
|
+
seriesInputs.forEach((item, seriesIndex) => {
|
|
42
|
+
const key = String(item.key ?? item.yKey ?? `series-${seriesIndex}`);
|
|
43
|
+
const value = normalizeYValue(row[item.yKey]);
|
|
44
|
+
values[key] = value;
|
|
45
|
+
formattedValues[key] =
|
|
46
|
+
value === null ? "No value" : formatYLabel(value);
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
index,
|
|
50
|
+
x,
|
|
51
|
+
xLabel: formatXLabel(x, index),
|
|
52
|
+
values,
|
|
53
|
+
formattedValues,
|
|
54
|
+
raw: row
|
|
55
|
+
};
|
|
56
|
+
})
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export const getLineChartAccessibilitySummary = (input) => {
|
|
60
|
+
const table = getLineChartDataTable(input);
|
|
61
|
+
if (table.columns.length === 0 || table.rows.length === 0) {
|
|
62
|
+
return "Line chart with no data.";
|
|
63
|
+
}
|
|
64
|
+
const seriesInputs = resolveLineChartSeriesInput(input.yKey, input.yKeys, input.series);
|
|
65
|
+
const intro = table.columns.length === 1
|
|
66
|
+
? `${table.columns[0].label} line chart with ${pluralize(table.rows.length, "point")}.`
|
|
67
|
+
: `Line chart with ${pluralize(table.columns.length, "series", "series")} and ${pluralize(table.rows.length, "point")}.`;
|
|
68
|
+
const seriesSummaries = seriesInputs.flatMap((series) => {
|
|
69
|
+
const columnKey = String(series.key ?? series.yKey);
|
|
70
|
+
const label = table.columns.find((column) => column.key === columnKey)?.label ??
|
|
71
|
+
columnKey;
|
|
72
|
+
const points = getDefinedSeriesPoints(series, table.rows);
|
|
73
|
+
const minPoint = getMinPoint(points);
|
|
74
|
+
const maxPoint = getMaxPoint(points);
|
|
75
|
+
const currentPoint = points[points.length - 1];
|
|
76
|
+
if (!minPoint || !maxPoint || !currentPoint) {
|
|
77
|
+
return [`${label} has no defined values.`];
|
|
78
|
+
}
|
|
79
|
+
return [
|
|
80
|
+
`${label} ranges from ${minPoint.formattedValue} in ${minPoint.xLabel} to ${maxPoint.formattedValue} in ${maxPoint.xLabel}. Current value is ${currentPoint.formattedValue}.`
|
|
81
|
+
];
|
|
82
|
+
});
|
|
83
|
+
return [intro, ...seriesSummaries].join(" ");
|
|
84
|
+
};
|
|
85
|
+
export const useLineChartAccessibilityLabel = ({ accessibilityLabel, data, formatXLabel, formatYLabel, series, xKey, yKey, yKeys }) => useMemo(() => accessibilityLabel ??
|
|
86
|
+
getLineChartAccessibilitySummary({
|
|
87
|
+
data,
|
|
88
|
+
formatXLabel,
|
|
89
|
+
formatYLabel,
|
|
90
|
+
series,
|
|
91
|
+
xKey,
|
|
92
|
+
yKey,
|
|
93
|
+
yKeys
|
|
94
|
+
}), [
|
|
95
|
+
accessibilityLabel,
|
|
96
|
+
data,
|
|
97
|
+
formatXLabel,
|
|
98
|
+
formatYLabel,
|
|
99
|
+
series,
|
|
100
|
+
xKey,
|
|
101
|
+
yKey,
|
|
102
|
+
yKeys
|
|
103
|
+
]);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { LinearScale } from "../../../core/index";
|
|
2
|
+
type AxisLabelSize = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
|
6
|
+
export type LineChartAxisLabelAnimationStrategy = "crossfade";
|
|
7
|
+
export type LineChartYAxisLabelWidth = number | "auto" | "stable";
|
|
8
|
+
export type LineChartAxisLabelAnimationConfig = {
|
|
9
|
+
duration?: number;
|
|
10
|
+
strategy?: LineChartAxisLabelAnimationStrategy;
|
|
11
|
+
};
|
|
12
|
+
export type ResolvedLineChartAxisLabelAnimationConfig = {
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
duration: number;
|
|
15
|
+
strategy: LineChartAxisLabelAnimationStrategy;
|
|
16
|
+
};
|
|
17
|
+
export type LineChartYAxisLabelModel = {
|
|
18
|
+
key: string;
|
|
19
|
+
text: string;
|
|
20
|
+
y: number;
|
|
21
|
+
opacity: number;
|
|
22
|
+
};
|
|
23
|
+
export declare const defaultLineChartAxisLabelAnimationDuration = 160;
|
|
24
|
+
export declare const resolveLineChartYAxisLabelSizes: ({ sizes, stableSizes, width }: {
|
|
25
|
+
sizes: AxisLabelSize[];
|
|
26
|
+
stableSizes?: AxisLabelSize[] | undefined;
|
|
27
|
+
width?: LineChartYAxisLabelWidth | undefined;
|
|
28
|
+
}) => AxisLabelSize[];
|
|
29
|
+
export declare const resolveLineChartAxisLabelAnimationConfig: (animation?: boolean | LineChartAxisLabelAnimationConfig) => ResolvedLineChartAxisLabelAnimationConfig;
|
|
30
|
+
export declare const buildLineChartYAxisLabels: ({ formatYLabel, labelOffset, ticks, yScale }: {
|
|
31
|
+
formatYLabel: (value: number) => string;
|
|
32
|
+
labelOffset: number;
|
|
33
|
+
ticks: readonly number[];
|
|
34
|
+
yScale: LinearScale;
|
|
35
|
+
}) => LineChartYAxisLabelModel[];
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=axisLabels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axisLabels.d.ts","sourceRoot":"","sources":["../../../src/charts/line/axisLabels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG,WAAW,CAAC;AAC9D,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAElE,MAAM,MAAM,iCAAiC,GAAG;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,mCAAmC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,yCAAyC,GAAG;IACtD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,mCAAmC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,0CAA0C,MAAM,CAAC;AAK9D,eAAO,MAAM,+BAA+B,GAAI,+BAI7C;IACD,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;IAC1C,KAAK,CAAC,EAAE,wBAAwB,GAAG,SAAS,CAAC;CAC9C,oBAgBA,CAAC;AAEF,eAAO,MAAM,wCAAwC,GACnD,YAAY,OAAO,GAAG,iCAAiC,KACtD,yCA0BF,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,8CAKvC;IACD,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,WAAW,CAAC;CACrB,KAAG,wBAAwB,EAiB3B,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export const defaultLineChartAxisLabelAnimationDuration = 160;
|
|
2
|
+
const getMaxWidth = (sizes) => sizes.reduce((max, size) => Math.max(max, size.width), 0);
|
|
3
|
+
export const resolveLineChartYAxisLabelSizes = ({ sizes, stableSizes, width }) => {
|
|
4
|
+
const fixedWidth = typeof width === "number" && Number.isFinite(width)
|
|
5
|
+
? Math.max(0, width)
|
|
6
|
+
: width === "stable"
|
|
7
|
+
? getMaxWidth(stableSizes ?? sizes)
|
|
8
|
+
: undefined;
|
|
9
|
+
if (fixedWidth === undefined) {
|
|
10
|
+
return sizes;
|
|
11
|
+
}
|
|
12
|
+
return sizes.map((size) => ({
|
|
13
|
+
...size,
|
|
14
|
+
width: fixedWidth
|
|
15
|
+
}));
|
|
16
|
+
};
|
|
17
|
+
export const resolveLineChartAxisLabelAnimationConfig = (animation) => {
|
|
18
|
+
if (!animation) {
|
|
19
|
+
return {
|
|
20
|
+
enabled: false,
|
|
21
|
+
duration: 0,
|
|
22
|
+
strategy: "crossfade"
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if (animation === true) {
|
|
26
|
+
return {
|
|
27
|
+
enabled: true,
|
|
28
|
+
duration: defaultLineChartAxisLabelAnimationDuration,
|
|
29
|
+
strategy: "crossfade"
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
enabled: true,
|
|
34
|
+
duration: typeof animation.duration === "number" &&
|
|
35
|
+
Number.isFinite(animation.duration)
|
|
36
|
+
? Math.max(0, animation.duration)
|
|
37
|
+
: defaultLineChartAxisLabelAnimationDuration,
|
|
38
|
+
strategy: animation.strategy ?? "crossfade"
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export const buildLineChartYAxisLabels = ({ formatYLabel, labelOffset, ticks, yScale }) => {
|
|
42
|
+
const keyCounts = new Map();
|
|
43
|
+
return ticks.map((tick) => {
|
|
44
|
+
const text = formatYLabel(tick);
|
|
45
|
+
const baseKey = `${tick}:${text}`;
|
|
46
|
+
const duplicateCount = keyCounts.get(baseKey) ?? 0;
|
|
47
|
+
keyCounts.set(baseKey, duplicateCount + 1);
|
|
48
|
+
return {
|
|
49
|
+
key: duplicateCount === 0 ? baseKey : `${baseKey}:${duplicateCount}`,
|
|
50
|
+
text,
|
|
51
|
+
y: yScale.scale(tick) + labelOffset,
|
|
52
|
+
opacity: 1
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ChartBoxes, type LayoutDebugModel } from "../../../core/index";
|
|
2
|
+
import type { LineChartYAxisLabelModel } from "./axisLabels";
|
|
3
|
+
import type { LineChartLegendRenderItem } from "./types";
|
|
4
|
+
import type { XLabelLayoutItem } from "./xLabels";
|
|
5
|
+
type TextMeasurer = (text: string) => {
|
|
6
|
+
height: number;
|
|
7
|
+
width: number;
|
|
8
|
+
};
|
|
9
|
+
type LineChartDebugTooltipRect = {
|
|
10
|
+
height: number;
|
|
11
|
+
width: number;
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
};
|
|
15
|
+
export type BuildLineChartDebugLayoutModelOptions = {
|
|
16
|
+
boxes: ChartBoxes;
|
|
17
|
+
legendItems?: LineChartLegendRenderItem[] | undefined;
|
|
18
|
+
measureYLabel?: TextMeasurer | undefined;
|
|
19
|
+
tooltip?: LineChartDebugTooltipRect | undefined;
|
|
20
|
+
xLabels: XLabelLayoutItem[];
|
|
21
|
+
yAxisLabelFontSize: number;
|
|
22
|
+
yLabels: LineChartYAxisLabelModel[];
|
|
23
|
+
};
|
|
24
|
+
export declare const buildLineChartDebugLayoutModel: ({ boxes, legendItems, measureYLabel, tooltip, xLabels, yAxisLabelFontSize, yLabels }: BuildLineChartDebugLayoutModelOptions) => LayoutDebugModel;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=debugLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugLayout.d.ts","sourceRoot":"","sources":["../../../src/charts/line/debugLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,UAAU,EAEf,KAAK,gBAAgB,EAEtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,KAAK,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AACxE,KAAK,yBAAyB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,qCAAqC,GAAG;IAClD,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,CAAC,EAAE,yBAAyB,EAAE,GAAG,SAAS,CAAC;IACtD,aAAa,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IACzC,OAAO,CAAC,EAAE,yBAAyB,GAAG,SAAS,CAAC;IAChD,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,wBAAwB,EAAE,CAAC;CACrC,CAAC;AAgFF,eAAO,MAAM,8BAA8B,GAAI,sFAQ5C,qCAAqC,KAAG,gBA4B1C,CAAC"}
|