p1-charts 0.0.0-stage → 0.1.0
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/LICENSE +202 -0
- package/README.md +320 -2
- package/dist/CategoryBarChart-CV58kvIr.js +182 -0
- package/dist/CategoryBarChart-CV58kvIr.js.map +1 -0
- package/dist/Heatmap-C1XcTUg1.js +777 -0
- package/dist/Heatmap-C1XcTUg1.js.map +1 -0
- package/dist/PieLegend-BZsv9IbF.js +729 -0
- package/dist/PieLegend-BZsv9IbF.js.map +1 -0
- package/dist/PolarChart-D_ULWctY.js +282 -0
- package/dist/PolarChart-D_ULWctY.js.map +1 -0
- package/dist/Sparkline-DtNhxGVo.js +67 -0
- package/dist/Sparkline-DtNhxGVo.js.map +1 -0
- package/dist/TimeSeriesChart-tYmzRNzV.js +1852 -0
- package/dist/TimeSeriesChart-tYmzRNzV.js.map +1 -0
- package/dist/bin.utils-Ch1y7YDn.js +40 -0
- package/dist/bin.utils-Ch1y7YDn.js.map +1 -0
- package/dist/category.d.ts +7 -0
- package/dist/category.d.ts.map +1 -0
- package/dist/category.js +4 -0
- package/dist/charts/BarChart/index.d.ts +3 -0
- package/dist/charts/BarChart/index.d.ts.map +1 -0
- package/dist/charts/CandlestickChart/index.d.ts +3 -0
- package/dist/charts/CandlestickChart/index.d.ts.map +1 -0
- package/dist/charts/CategoryBarChart/index.d.ts +3 -0
- package/dist/charts/CategoryBarChart/index.d.ts.map +1 -0
- package/dist/charts/ChartPanes/index.d.ts +3 -0
- package/dist/charts/ChartPanes/index.d.ts.map +1 -0
- package/dist/charts/Heatmap/index.d.ts +3 -0
- package/dist/charts/Heatmap/index.d.ts.map +1 -0
- package/dist/charts/HistogramChart/index.d.ts +3 -0
- package/dist/charts/HistogramChart/index.d.ts.map +1 -0
- package/dist/charts/HistogramPane/index.d.ts +3 -0
- package/dist/charts/HistogramPane/index.d.ts.map +1 -0
- package/dist/charts/LineChart/index.d.ts +3 -0
- package/dist/charts/LineChart/index.d.ts.map +1 -0
- package/dist/charts/PieChart/index.d.ts +8 -0
- package/dist/charts/PieChart/index.d.ts.map +1 -0
- package/dist/charts/PolarChart/index.d.ts +3 -0
- package/dist/charts/PolarChart/index.d.ts.map +1 -0
- package/dist/charts/ScatterChart/index.d.ts +3 -0
- package/dist/charts/ScatterChart/index.d.ts.map +1 -0
- package/dist/charts/SeriesChart/index.d.ts +7 -0
- package/dist/charts/SeriesChart/index.d.ts.map +1 -0
- package/dist/charts/Sparkline/index.d.ts +4 -0
- package/dist/charts/Sparkline/index.d.ts.map +1 -0
- package/dist/charts/TimeSeriesChart/index.d.ts +3 -0
- package/dist/charts/TimeSeriesChart/index.d.ts.map +1 -0
- package/dist/charts/TimelineChart/index.d.ts +4 -0
- package/dist/charts/TimelineChart/index.d.ts.map +1 -0
- package/dist/charts/TimelinePane/index.d.ts +3 -0
- package/dist/charts/TimelinePane/index.d.ts.map +1 -0
- package/dist/components/BandLegend/index.d.ts +3 -0
- package/dist/components/BandLegend/index.d.ts.map +1 -0
- package/dist/components/ChartThemeProvider/index.d.ts +8 -0
- package/dist/components/ChartThemeProvider/index.d.ts.map +1 -0
- package/dist/components/HeatmapAxis/index.d.ts +3 -0
- package/dist/components/HeatmapAxis/index.d.ts.map +1 -0
- package/dist/components/HeatmapCells/index.d.ts +3 -0
- package/dist/components/HeatmapCells/index.d.ts.map +1 -0
- package/dist/components/HeatmapLegend/index.d.ts +3 -0
- package/dist/components/HeatmapLegend/index.d.ts.map +1 -0
- package/dist/components/HeatmapMarks/index.d.ts +3 -0
- package/dist/components/HeatmapMarks/index.d.ts.map +1 -0
- package/dist/components/HeatmapTooltip/index.d.ts +3 -0
- package/dist/components/HeatmapTooltip/index.d.ts.map +1 -0
- package/dist/components/InteractionSlots/index.d.ts +3 -0
- package/dist/components/InteractionSlots/index.d.ts.map +1 -0
- package/dist/components/PieCenter/index.d.ts +4 -0
- package/dist/components/PieCenter/index.d.ts.map +1 -0
- package/dist/components/PieLabels/index.d.ts +4 -0
- package/dist/components/PieLabels/index.d.ts.map +1 -0
- package/dist/components/PieLegend/index.d.ts +4 -0
- package/dist/components/PieLegend/index.d.ts.map +1 -0
- package/dist/components/PieRails/index.d.ts +4 -0
- package/dist/components/PieRails/index.d.ts.map +1 -0
- package/dist/components/PieSlices/index.d.ts +4 -0
- package/dist/components/PieSlices/index.d.ts.map +1 -0
- package/dist/components/PieTooltip/index.d.ts +4 -0
- package/dist/components/PieTooltip/index.d.ts.map +1 -0
- package/dist/css-C-rsk7-l.js +475 -0
- package/dist/css-C-rsk7-l.js.map +1 -0
- package/dist/dom.utils-CKMWLto-.js +14 -0
- package/dist/dom.utils-CKMWLto-.js.map +1 -0
- package/dist/heatmap-CIBukkjS.js +17 -0
- package/dist/heatmap-CIBukkjS.js.map +1 -0
- package/dist/heatmap.d.ts +7 -0
- package/dist/heatmap.d.ts.map +1 -0
- package/dist/heatmap.js +3 -0
- package/dist/hooks/useAnchor.d.ts +6 -0
- package/dist/hooks/useAnchor.d.ts.map +1 -0
- package/dist/hooks/useAutoBucket.d.ts +6 -0
- package/dist/hooks/useAutoBucket.d.ts.map +1 -0
- package/dist/hooks/useBands.d.ts +12 -0
- package/dist/hooks/useBands.d.ts.map +1 -0
- package/dist/hooks/useChart.d.ts +5 -0
- package/dist/hooks/useChart.d.ts.map +1 -0
- package/dist/hooks/useChartEvents.d.ts +17 -0
- package/dist/hooks/useChartEvents.d.ts.map +1 -0
- package/dist/hooks/useChartTheme.d.ts +3 -0
- package/dist/hooks/useChartTheme.d.ts.map +1 -0
- package/dist/hooks/useControllable.d.ts +2 -0
- package/dist/hooks/useControllable.d.ts.map +1 -0
- package/dist/hooks/useCrosshairBand.d.ts +6 -0
- package/dist/hooks/useCrosshairBand.d.ts.map +1 -0
- package/dist/hooks/useHeatmap.d.ts +26 -0
- package/dist/hooks/useHeatmap.d.ts.map +1 -0
- package/dist/hooks/useHeatmapInteraction.d.ts +24 -0
- package/dist/hooks/useHeatmapInteraction.d.ts.map +1 -0
- package/dist/hooks/useHeatmapSelection.d.ts +16 -0
- package/dist/hooks/useHeatmapSelection.d.ts.map +1 -0
- package/dist/hooks/useHeatmapState.d.ts +18 -0
- package/dist/hooks/useHeatmapState.d.ts.map +1 -0
- package/dist/hooks/useHeatmapSteps.d.ts +7 -0
- package/dist/hooks/useHeatmapSteps.d.ts.map +1 -0
- package/dist/hooks/useInteractions.d.ts +9 -0
- package/dist/hooks/useInteractions.d.ts.map +1 -0
- package/dist/hooks/useKeyboardNav.d.ts +9 -0
- package/dist/hooks/useKeyboardNav.d.ts.map +1 -0
- package/dist/hooks/useLiveFollow.d.ts +8 -0
- package/dist/hooks/useLiveFollow.d.ts.map +1 -0
- package/dist/hooks/useNowLine.d.ts +4 -0
- package/dist/hooks/useNowLine.d.ts.map +1 -0
- package/dist/hooks/useOverlays.d.ts +6 -0
- package/dist/hooks/useOverlays.d.ts.map +1 -0
- package/dist/hooks/usePaneRanges.d.ts +5 -0
- package/dist/hooks/usePaneRanges.d.ts.map +1 -0
- package/dist/hooks/usePaneSeries.d.ts +19 -0
- package/dist/hooks/usePaneSeries.d.ts.map +1 -0
- package/dist/hooks/usePieChart.d.ts +112 -0
- package/dist/hooks/usePieChart.d.ts.map +1 -0
- package/dist/hooks/usePieDrill.d.ts +9 -0
- package/dist/hooks/usePieDrill.d.ts.map +1 -0
- package/dist/hooks/usePieState.d.ts +91 -0
- package/dist/hooks/usePieState.d.ts.map +1 -0
- package/dist/hooks/usePieTween.d.ts +3 -0
- package/dist/hooks/usePieTween.d.ts.map +1 -0
- package/dist/hooks/usePriceFlash.d.ts +6 -0
- package/dist/hooks/usePriceFlash.d.ts.map +1 -0
- package/dist/hooks/usePriceLines.d.ts +4 -0
- package/dist/hooks/usePriceLines.d.ts.map +1 -0
- package/dist/hooks/useRangePreset.d.ts +6 -0
- package/dist/hooks/useRangePreset.d.ts.map +1 -0
- package/dist/hooks/useRangeSelect.d.ts +7 -0
- package/dist/hooks/useRangeSelect.d.ts.map +1 -0
- package/dist/hooks/useSeriesData.d.ts +6 -0
- package/dist/hooks/useSeriesData.d.ts.map +1 -0
- package/dist/hooks/useSeriesTheme.d.ts +9 -0
- package/dist/hooks/useSeriesTheme.d.ts.map +1 -0
- package/dist/hooks/useVisibleStats.d.ts +6 -0
- package/dist/hooks/useVisibleStats.d.ts.map +1 -0
- package/dist/hooks/useWheelZoom.d.ts +5 -0
- package/dist/hooks/useWheelZoom.d.ts.map +1 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +455 -0
- package/dist/index.js.map +1 -0
- package/dist/motion.utils-C1eaZJdQ.js +9 -0
- package/dist/motion.utils-C1eaZJdQ.js.map +1 -0
- package/dist/pie.d.ts +7 -0
- package/dist/pie.d.ts.map +1 -0
- package/dist/pie.js +3 -0
- package/dist/primitives/RibbonPrimitive.d.ts +28 -0
- package/dist/primitives/RibbonPrimitive.d.ts.map +1 -0
- package/dist/primitives/TimeRangePrimitive.d.ts +17 -0
- package/dist/primitives/TimeRangePrimitive.d.ts.map +1 -0
- package/dist/scatter.d.ts +7 -0
- package/dist/scatter.d.ts.map +1 -0
- package/dist/scatter.js +3 -0
- package/dist/series.d.ts +13 -0
- package/dist/series.d.ts.map +1 -0
- package/dist/series.js +4 -0
- package/dist/sparkline.d.ts +5 -0
- package/dist/sparkline.d.ts.map +1 -0
- package/dist/sparkline.js +3 -0
- package/dist/styles/heatmap.d.ts +6 -0
- package/dist/styles/heatmap.d.ts.map +1 -0
- package/dist/styles/pieChart.d.ts +15 -0
- package/dist/styles/pieChart.d.ts.map +1 -0
- package/dist/styles/seriesChart.d.ts +12 -0
- package/dist/styles/seriesChart.d.ts.map +1 -0
- package/dist/styles/shared.d.ts +4 -0
- package/dist/styles/shared.d.ts.map +1 -0
- package/dist/theme.d.ts +6 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +4 -0
- package/dist/theme.utils-CP1XtGIe.js +316 -0
- package/dist/theme.utils-CP1XtGIe.js.map +1 -0
- package/dist/themes/css.d.ts +33 -0
- package/dist/themes/css.d.ts.map +1 -0
- package/dist/themes/p1.d.ts +13 -0
- package/dist/themes/p1.d.ts.map +1 -0
- package/dist/themes/p1.tokens.d.ts +259 -0
- package/dist/themes/p1.tokens.d.ts.map +1 -0
- package/dist/tooltip.utils-D7xaBSUK.js +24 -0
- package/dist/tooltip.utils-D7xaBSUK.js.map +1 -0
- package/dist/types/bands.d.ts +43 -0
- package/dist/types/bands.d.ts.map +1 -0
- package/dist/types/candlestick.d.ts +18 -0
- package/dist/types/candlestick.d.ts.map +1 -0
- package/dist/types/category.d.ts +26 -0
- package/dist/types/category.d.ts.map +1 -0
- package/dist/types/chart.d.ts +41 -0
- package/dist/types/chart.d.ts.map +1 -0
- package/dist/types/heatmap.d.ts +136 -0
- package/dist/types/heatmap.d.ts.map +1 -0
- package/dist/types/heatmapParts.d.ts +68 -0
- package/dist/types/heatmapParts.d.ts.map +1 -0
- package/dist/types/interaction.d.ts +94 -0
- package/dist/types/interaction.d.ts.map +1 -0
- package/dist/types/layout.d.ts +40 -0
- package/dist/types/layout.d.ts.map +1 -0
- package/dist/types/panes.d.ts +46 -0
- package/dist/types/panes.d.ts.map +1 -0
- package/dist/types/pie.d.ts +120 -0
- package/dist/types/pie.d.ts.map +1 -0
- package/dist/types/pieParts.d.ts +75 -0
- package/dist/types/pieParts.d.ts.map +1 -0
- package/dist/types/polar.d.ts +43 -0
- package/dist/types/polar.d.ts.map +1 -0
- package/dist/types/scatter.d.ts +27 -0
- package/dist/types/scatter.d.ts.map +1 -0
- package/dist/types/series.d.ts +124 -0
- package/dist/types/series.d.ts.map +1 -0
- package/dist/types/sparkline.d.ts +11 -0
- package/dist/types/sparkline.d.ts.map +1 -0
- package/dist/types/theme.d.ts +125 -0
- package/dist/types/theme.d.ts.map +1 -0
- package/dist/types/timeSeries.d.ts +74 -0
- package/dist/types/timeSeries.d.ts.map +1 -0
- package/dist/types/timeline.d.ts +67 -0
- package/dist/types/timeline.d.ts.map +1 -0
- package/dist/useChartTheme-B06p_jvu.js +26 -0
- package/dist/useChartTheme-B06p_jvu.js.map +1 -0
- package/dist/utils/bands.utils.d.ts +12 -0
- package/dist/utils/bands.utils.d.ts.map +1 -0
- package/dist/utils/bin.utils.d.ts +17 -0
- package/dist/utils/bin.utils.d.ts.map +1 -0
- package/dist/utils/bucket.utils.d.ts +3 -0
- package/dist/utils/bucket.utils.d.ts.map +1 -0
- package/dist/utils/candlestick.utils.d.ts +4 -0
- package/dist/utils/candlestick.utils.d.ts.map +1 -0
- package/dist/utils/canvas.utils.d.ts +7 -0
- package/dist/utils/canvas.utils.d.ts.map +1 -0
- package/dist/utils/category.utils.d.ts +30 -0
- package/dist/utils/category.utils.d.ts.map +1 -0
- package/dist/utils/color.utils.d.ts +12 -0
- package/dist/utils/color.utils.d.ts.map +1 -0
- package/dist/utils/data.utils.d.ts +10 -0
- package/dist/utils/data.utils.d.ts.map +1 -0
- package/dist/utils/dom.utils.d.ts +3 -0
- package/dist/utils/dom.utils.d.ts.map +1 -0
- package/dist/utils/editorial.utils.d.ts +18 -0
- package/dist/utils/editorial.utils.d.ts.map +1 -0
- package/dist/utils/heatmap.utils.d.ts +25 -0
- package/dist/utils/heatmap.utils.d.ts.map +1 -0
- package/dist/utils/histogram.utils.d.ts +8 -0
- package/dist/utils/histogram.utils.d.ts.map +1 -0
- package/dist/utils/interaction.utils.d.ts +6 -0
- package/dist/utils/interaction.utils.d.ts.map +1 -0
- package/dist/utils/layout.utils.d.ts +9 -0
- package/dist/utils/layout.utils.d.ts.map +1 -0
- package/dist/utils/line.utils.d.ts +8 -0
- package/dist/utils/line.utils.d.ts.map +1 -0
- package/dist/utils/live.utils.d.ts +12 -0
- package/dist/utils/live.utils.d.ts.map +1 -0
- package/dist/utils/merge.utils.d.ts +7 -0
- package/dist/utils/merge.utils.d.ts.map +1 -0
- package/dist/utils/motion.utils.d.ts +2 -0
- package/dist/utils/motion.utils.d.ts.map +1 -0
- package/dist/utils/ordinal.utils.d.ts +7 -0
- package/dist/utils/ordinal.utils.d.ts.map +1 -0
- package/dist/utils/pie.utils.d.ts +13 -0
- package/dist/utils/pie.utils.d.ts.map +1 -0
- package/dist/utils/pieRails.utils.d.ts +7 -0
- package/dist/utils/pieRails.utils.d.ts.map +1 -0
- package/dist/utils/pieTooltip.utils.d.ts +3 -0
- package/dist/utils/pieTooltip.utils.d.ts.map +1 -0
- package/dist/utils/pieTween.utils.d.ts +7 -0
- package/dist/utils/pieTween.utils.d.ts.map +1 -0
- package/dist/utils/pieVisibility.utils.d.ts +3 -0
- package/dist/utils/pieVisibility.utils.d.ts.map +1 -0
- package/dist/utils/polar.utils.d.ts +7 -0
- package/dist/utils/polar.utils.d.ts.map +1 -0
- package/dist/utils/range.utils.d.ts +6 -0
- package/dist/utils/range.utils.d.ts.map +1 -0
- package/dist/utils/scatter.utils.d.ts +25 -0
- package/dist/utils/scatter.utils.d.ts.map +1 -0
- package/dist/utils/sparkline.utils.d.ts +8 -0
- package/dist/utils/sparkline.utils.d.ts.map +1 -0
- package/dist/utils/squarify.utils.d.ts +3 -0
- package/dist/utils/squarify.utils.d.ts.map +1 -0
- package/dist/utils/stats.utils.d.ts +12 -0
- package/dist/utils/stats.utils.d.ts.map +1 -0
- package/dist/utils/theme.utils.d.ts +18 -0
- package/dist/utils/theme.utils.d.ts.map +1 -0
- package/dist/utils/time.utils.d.ts +3 -0
- package/dist/utils/time.utils.d.ts.map +1 -0
- package/dist/utils/timeScale.utils.d.ts +4 -0
- package/dist/utils/timeScale.utils.d.ts.map +1 -0
- package/dist/utils/timeSeries.utils.d.ts +16 -0
- package/dist/utils/timeSeries.utils.d.ts.map +1 -0
- package/dist/utils/timeline.utils.d.ts +8 -0
- package/dist/utils/timeline.utils.d.ts.map +1 -0
- package/dist/utils/tooltip.utils.d.ts +3 -0
- package/dist/utils/tooltip.utils.d.ts.map +1 -0
- package/dist/utils/visibility.utils.d.ts +2 -0
- package/dist/utils/visibility.utils.d.ts.map +1 -0
- package/dist/visibility.utils-nMI5a_Et.js +85 -0
- package/dist/visibility.utils-nMI5a_Et.js.map +1 -0
- package/package.json +94 -4
- package/src/category.ts +7 -0
- package/src/charts/BarChart/index.tsx +54 -0
- package/src/charts/CandlestickChart/index.tsx +44 -0
- package/src/charts/CategoryBarChart/index.tsx +122 -0
- package/src/charts/ChartPanes/index.tsx +325 -0
- package/src/charts/Heatmap/index.tsx +167 -0
- package/src/charts/HistogramChart/index.tsx +102 -0
- package/src/charts/HistogramPane/index.tsx +5 -0
- package/src/charts/LineChart/index.tsx +103 -0
- package/src/charts/PieChart/index.tsx +146 -0
- package/src/charts/PolarChart/index.tsx +158 -0
- package/src/charts/ScatterChart/index.tsx +101 -0
- package/src/charts/SeriesChart/index.tsx +229 -0
- package/src/charts/Sparkline/index.tsx +40 -0
- package/src/charts/TimeSeriesChart/index.tsx +374 -0
- package/src/charts/TimelineChart/index.tsx +36 -0
- package/src/charts/TimelinePane/index.tsx +5 -0
- package/src/components/BandLegend/index.tsx +47 -0
- package/src/components/ChartThemeProvider/index.tsx +20 -0
- package/src/components/HeatmapAxis/index.tsx +95 -0
- package/src/components/HeatmapCells/index.tsx +138 -0
- package/src/components/HeatmapLegend/index.tsx +76 -0
- package/src/components/HeatmapMarks/index.tsx +75 -0
- package/src/components/HeatmapTooltip/index.tsx +84 -0
- package/src/components/InteractionSlots/index.tsx +35 -0
- package/src/components/PieCenter/index.tsx +80 -0
- package/src/components/PieLabels/index.tsx +83 -0
- package/src/components/PieLegend/index.tsx +56 -0
- package/src/components/PieRails/index.tsx +56 -0
- package/src/components/PieSlices/index.tsx +64 -0
- package/src/components/PieTooltip/index.tsx +81 -0
- package/src/heatmap.ts +13 -0
- package/src/hooks/useAnchor.ts +38 -0
- package/src/hooks/useAutoBucket.ts +77 -0
- package/src/hooks/useBands.ts +99 -0
- package/src/hooks/useChart.ts +121 -0
- package/src/hooks/useChartEvents.ts +108 -0
- package/src/hooks/useChartTheme.ts +13 -0
- package/src/hooks/useControllable.ts +7 -0
- package/src/hooks/useCrosshairBand.ts +53 -0
- package/src/hooks/useHeatmap.ts +109 -0
- package/src/hooks/useHeatmapInteraction.ts +51 -0
- package/src/hooks/useHeatmapSelection.ts +124 -0
- package/src/hooks/useHeatmapState.ts +99 -0
- package/src/hooks/useHeatmapSteps.ts +53 -0
- package/src/hooks/useInteractions.ts +151 -0
- package/src/hooks/useKeyboardNav.ts +121 -0
- package/src/hooks/useLiveFollow.ts +110 -0
- package/src/hooks/useNowLine.ts +36 -0
- package/src/hooks/useOverlays.ts +66 -0
- package/src/hooks/usePaneRanges.ts +62 -0
- package/src/hooks/usePaneSeries.ts +194 -0
- package/src/hooks/usePieChart.ts +138 -0
- package/src/hooks/usePieDrill.ts +33 -0
- package/src/hooks/usePieState.ts +191 -0
- package/src/hooks/usePieTween.ts +56 -0
- package/src/hooks/usePriceFlash.ts +53 -0
- package/src/hooks/usePriceLines.ts +19 -0
- package/src/hooks/useRangePreset.ts +45 -0
- package/src/hooks/useRangeSelect.ts +123 -0
- package/src/hooks/useSeriesData.ts +47 -0
- package/src/hooks/useSeriesTheme.ts +65 -0
- package/src/hooks/useVisibleStats.ts +42 -0
- package/src/hooks/useWheelZoom.ts +51 -0
- package/src/index.ts +228 -0
- package/src/pie.ts +13 -0
- package/src/primitives/RibbonPrimitive.ts +119 -0
- package/src/primitives/TimeRangePrimitive.ts +180 -0
- package/src/scatter.ts +7 -0
- package/src/series.ts +25 -0
- package/src/sparkline.ts +5 -0
- package/src/styles/heatmap.ts +16 -0
- package/src/styles/pieChart.ts +28 -0
- package/src/styles/seriesChart.ts +73 -0
- package/src/styles/shared.ts +17 -0
- package/src/theme.ts +19 -0
- package/src/themes/css.ts +60 -0
- package/src/themes/p1.tokens.ts +258 -0
- package/src/themes/p1.ts +134 -0
- package/src/types/bands.ts +50 -0
- package/src/types/candlestick.ts +20 -0
- package/src/types/category.ts +31 -0
- package/src/types/chart.ts +68 -0
- package/src/types/heatmap.ts +193 -0
- package/src/types/heatmapParts.ts +84 -0
- package/src/types/interaction.ts +104 -0
- package/src/types/layout.ts +47 -0
- package/src/types/panes.ts +66 -0
- package/src/types/pie.ts +163 -0
- package/src/types/pieParts.ts +91 -0
- package/src/types/polar.ts +40 -0
- package/src/types/scatter.ts +29 -0
- package/src/types/series.ts +205 -0
- package/src/types/sparkline.ts +11 -0
- package/src/types/theme.ts +119 -0
- package/src/types/timeSeries.ts +79 -0
- package/src/types/timeline.ts +81 -0
- package/src/utils/bands.utils.ts +85 -0
- package/src/utils/bin.utils.ts +82 -0
- package/src/utils/bucket.utils.ts +29 -0
- package/src/utils/candlestick.utils.ts +19 -0
- package/src/utils/canvas.utils.ts +39 -0
- package/src/utils/category.utils.ts +159 -0
- package/src/utils/color.utils.ts +142 -0
- package/src/utils/data.utils.ts +126 -0
- package/src/utils/dom.utils.ts +10 -0
- package/src/utils/editorial.utils.ts +85 -0
- package/src/utils/heatmap.utils.ts +168 -0
- package/src/utils/histogram.utils.ts +88 -0
- package/src/utils/interaction.utils.ts +48 -0
- package/src/utils/layout.utils.ts +147 -0
- package/src/utils/line.utils.ts +43 -0
- package/src/utils/live.utils.ts +92 -0
- package/src/utils/merge.utils.ts +87 -0
- package/src/utils/motion.utils.ts +6 -0
- package/src/utils/ordinal.utils.ts +38 -0
- package/src/utils/pie.utils.ts +193 -0
- package/src/utils/pieRails.utils.ts +15 -0
- package/src/utils/pieTooltip.utils.ts +18 -0
- package/src/utils/pieTween.utils.ts +47 -0
- package/src/utils/pieVisibility.utils.ts +18 -0
- package/src/utils/polar.utils.ts +61 -0
- package/src/utils/range.utils.ts +54 -0
- package/src/utils/scatter.utils.ts +98 -0
- package/src/utils/sparkline.utils.ts +87 -0
- package/src/utils/squarify.utils.ts +85 -0
- package/src/utils/stats.utils.ts +43 -0
- package/src/utils/theme.utils.ts +277 -0
- package/src/utils/time.utils.ts +30 -0
- package/src/utils/timeScale.utils.ts +76 -0
- package/src/utils/timeSeries.utils.ts +91 -0
- package/src/utils/timeline.utils.ts +98 -0
- package/src/utils/tooltip.utils.ts +15 -0
- package/src/utils/visibility.utils.ts +18 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 mathematiques ltd
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,321 @@
|
|
|
1
|
-
#
|
|
1
|
+
# p1-charts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Reusable chart components for React.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install p1-charts lightweight-charts
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Peer dependencies: `react` and `react-dom` (>= 18), and `lightweight-charts` (^5.2.1).
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { TimeSeriesChart } from "p1-charts";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Subpath imports keep a page from loading charts it does not draw:
|
|
20
|
+
|
|
21
|
+
| Import | What it contains |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| `p1-charts/series` | `TimeSeriesChart`, line, bar, histogram, candlestick, ribbons |
|
|
24
|
+
| `p1-charts/pie` | `PieChart` |
|
|
25
|
+
| `p1-charts/heatmap` | `Heatmap` |
|
|
26
|
+
| `p1-charts/scatter` | `ScatterChart`, `PolarChart` |
|
|
27
|
+
| `p1-charts/category` | `CategoryBarChart`, `bin` |
|
|
28
|
+
| `p1-charts/sparkline` | `Sparkline` |
|
|
29
|
+
| `p1-charts/theme` | `p1Theme`, `p1ThemeFromCss`, `createTheme` |
|
|
30
|
+
|
|
31
|
+
Peer dependencies: `react`, `react-dom` (>= 18), and `lightweight-charts` (^5.2.1). The sparkline, pie, heatmap, scatter, and category entries do not mount a Lightweight Charts instance. `lightweight-charts` stays a peer so the app and this package share one copy.
|
|
32
|
+
|
|
33
|
+
## Publishing
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm run build # also runs on prepack
|
|
37
|
+
npm publish
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The package is unscoped (`p1-charts`). `prepack` builds `dist/` before the tarball is packed. Do not commit `dist/`.
|
|
41
|
+
|
|
42
|
+
## Charts
|
|
43
|
+
|
|
44
|
+
| Job | Component |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| Several series, two scales, lines, areas, columns | `TimeSeriesChart` |
|
|
47
|
+
| Fill between two value lines (P10–P90) | `TimeSeriesChart` `ribbons` |
|
|
48
|
+
| Full-height tint over a time range (a regime) | `LineChart` `bands` |
|
|
49
|
+
| One series, terminal chrome | `LineChart`, `BarChart`, `HistogramChart`, `CandlestickChart` |
|
|
50
|
+
| Grouped, stacked, or overlaid category columns | `CategoryBarChart` |
|
|
51
|
+
| Statistical histogram | `bin()`, then `CategoryBarChart` |
|
|
52
|
+
| Columns on a time axis | `BarChart` or `HistogramChart` |
|
|
53
|
+
| Numeric x and y | `ScatterChart` |
|
|
54
|
+
| Wind rose | `PolarChart` (default `mode="bar"`) |
|
|
55
|
+
| Angle and radius points | `PolarChart` `mode="scatter"` |
|
|
56
|
+
| Two categorical axes | `Heatmap` |
|
|
57
|
+
| Shares of a whole | `PieChart` |
|
|
58
|
+
| Tile-sized trend | `Sparkline` |
|
|
59
|
+
|
|
60
|
+
Three-dimensional scatters, maps, and diagrams stay in the app. `Sparkline` is an SVG and is the chart for a stat tile.
|
|
61
|
+
|
|
62
|
+
`TimeSeriesChart` defaults to the editorial profile: normal crosshair, wheel zoom off (including ctrl-wheel), square axis and crosshair labels, transparent canvas, hairline grid, attribution off, left edge fixed. Pass `profile="terminal"` for a magnet crosshair and the shared wheel hook (scroll on wheel, zoom on ctrl-wheel). That profile does not add price flash, follow-live, range presets, or jump-to-live. Those stay on line, bar, histogram, and candlestick, which keep the terminal surface: magnet crosshair, price flash on a live tick, follow-live, ctrl-wheel zoom, range presets, auto-bucket on zoom, anchor, visible stats, opt-in legend, tooltip, pin on click, keyboard navigation, and the jump-to-live button.
|
|
63
|
+
|
|
64
|
+
### Time series
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
<TimeSeriesChart
|
|
68
|
+
ariaLabel="Daily traffic"
|
|
69
|
+
series={[
|
|
70
|
+
{ id: "visitors", name: "Visitors", kind: "histogram", priceScale: "left", data: visitors },
|
|
71
|
+
{ id: "new", name: "New", kind: "line", priceScale: "left", lineStyle: "dashed", data: newcomers },
|
|
72
|
+
{ id: "revenue", name: "Revenue", kind: "line", priceScale: "right", data: revenue },
|
|
73
|
+
]}
|
|
74
|
+
ribbons={[{ upper: p90, lower: p10, opacity: 0.16 }]}
|
|
75
|
+
markers={[{ seriesId: "median", time: "2026-02-01", shape: "circle", text: "model" }]}
|
|
76
|
+
formatValue={(id, value) => (id === "revenue" ? `€${value}` : String(value))}
|
|
77
|
+
/>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Points are `{ time, value }`. `time` is a unix timestamp in seconds, an ISO string, or a `Date`. Rows are sorted by time. A repeated time keeps the last finite value. A non-finite value is dropped.
|
|
81
|
+
|
|
82
|
+
| Field | Meaning |
|
|
83
|
+
| --- | --- |
|
|
84
|
+
| `series[].kind` | `"line"` (default), `"area"`, or `"histogram"` |
|
|
85
|
+
| `series[].priceScale` | `"right"` (default) or `"left"`. A scale is shown when a series or a ribbon uses it |
|
|
86
|
+
| `series[].lineStyle` | `"solid"` (default), `"dashed"`, or `"dotted"`. Line and area only |
|
|
87
|
+
| `series[].lineWidth` | `1` to `4`. Line defaults to `2`, area and histogram to `1` |
|
|
88
|
+
| `series[].color` | Falls back to `palette.categorical` in series order |
|
|
89
|
+
| `series[].includeInTooltip` | `false` keeps the series on the chart and out of the tooltip |
|
|
90
|
+
| `series[].lastValueVisible` | Default `false`. The price line stays off |
|
|
91
|
+
| `ribbons[]` | Fill between `upper` and `lower` where both have the same time. `opacity` defaults to `0.16`. The ribbon attaches to a series on the same scale, or to the first series |
|
|
92
|
+
| `markers[]` | `seriesId` must match a series. `shape` is `circle` (default), `square`, `arrowUp`, or `arrowDown`. `position` is `inBar` (default), `aboveBar`, or `belowBar` |
|
|
93
|
+
| `profile` | `"editorial"` (default) or `"terminal"` |
|
|
94
|
+
| `axis` | `"time"` (default) or `"ordinal"` |
|
|
95
|
+
| `height` | Default `340` |
|
|
96
|
+
| `timeVisible` | Default `false`, so the scale prints the date. `true` prints the time of day as well |
|
|
97
|
+
| `formatTime` | `(unixSeconds) => string`. The default label is `YYYY-MM-DD` |
|
|
98
|
+
| `formatValue` | `(seriesId, value) => string` |
|
|
99
|
+
| `extraTooltipRows` | `(unixSeconds) => rows` appended after the series rows |
|
|
100
|
+
| `renderTooltip` | Replaces the row list. The time heading still renders |
|
|
101
|
+
| `chartOptions` | Deep-merged on top of the profile options, after `autoSize: true` |
|
|
102
|
+
| `ariaLabel` | Default `"Time series chart"`. The canvas is `role="img"` |
|
|
103
|
+
|
|
104
|
+
The root carries `data-profile` and `data-axis`. The tooltip carries `data-part="tooltip"`, `tooltip-time`, `tooltip-row`, and `swatch` (`data-swatch` is `bar` for a histogram and `line` otherwise). `formatTime`, `formatValue`, `extraTooltipRows`, and `renderTooltip` update without rebuilding the chart.
|
|
105
|
+
|
|
106
|
+
An ordinal axis takes category labels. Point `time` is the label or a 0-based index. Each step is one unix day (`86400` seconds) so the scale can place them. Tick marks and the crosshair both print the category label.
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
<TimeSeriesChart
|
|
110
|
+
axis="ordinal"
|
|
111
|
+
categories={["Mon", "Tue"]}
|
|
112
|
+
series={[{ id: "mae", name: "MAE", data: [{ time: "Mon", value: 1 }, { time: "Tue", value: 2 }] }]}
|
|
113
|
+
/>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Square axis and crosshair labels are a `roundRect` patch scoped to the chart element, installed only for the editorial profile and only in a browser that provides `CanvasRenderingContext2D`. `editorialChartOptions` and `patchSquareCanvasLabels` are exported for a chart built outside this component. Pass `typography.axis.family` from `next/font` or from `p1ThemeFromCss`. The fallback family is `ui-sans-serif, system-ui, sans-serif`.
|
|
117
|
+
|
|
118
|
+
### Category bars
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
<CategoryBarChart
|
|
122
|
+
mode="group"
|
|
123
|
+
categories={["Temp", "Wind"]}
|
|
124
|
+
series={[
|
|
125
|
+
{ id: "mae", name: "Avg MAE", data: [1.2, 0.4] },
|
|
126
|
+
{ id: "bias", name: "Bias", data: [0.1, -0.2] },
|
|
127
|
+
]}
|
|
128
|
+
/>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
`series[].data[i]` is the value for `categories[i]`. A missing or non-finite value is left out of that column and out of the tooltip. The SVG viewBox is 640×320.
|
|
132
|
+
|
|
133
|
+
| Behaviour | Detail |
|
|
134
|
+
| --- | --- |
|
|
135
|
+
| `mode` | `"group"` (default), `"stack"`, or `"overlay"`. Overlay bars share a slot at opacity `0.72`. Stack separates positive and negative runs |
|
|
136
|
+
| Keyboard | Left and right move the active category and stop at the ends |
|
|
137
|
+
| Pointer | Entering a bar selects its category |
|
|
138
|
+
| Tooltip | Always shows the active category. `formatValue(seriesId, value)` formats each row. `renderTooltip(category, rows)` replaces the default |
|
|
139
|
+
| Parts | Root `data-mode`. Bars are `data-part="bar"` with `data-series`, `data-category`, and `data-active`. Also `axis`, `tick`, `tooltip`, `tooltip-time`, `tooltip-row` |
|
|
140
|
+
| Label | `ariaLabel` defaults to `"Bar chart"` |
|
|
141
|
+
|
|
142
|
+
`bin(samples, options?)` turns raw observations into `{ from, to, count, label }[]`. The count defaults to Sturges' rule. `bins` sets an equal-width count. `min` and `max` set the domain. `edges` are explicit boundaries: a value lands in `[edge[i], edge[i + 1])`, and the last edge is inclusive. An empty sample list returns `[]`. `HistogramChart` draws columns on a time axis.
|
|
143
|
+
|
|
144
|
+
```tsx
|
|
145
|
+
const counts = bin(samples, { bins: 12 });
|
|
146
|
+
|
|
147
|
+
<CategoryBarChart
|
|
148
|
+
categories={counts.map((item) => item.label)}
|
|
149
|
+
series={[{ id: "n", name: "Count", data: counts.map((item) => item.count) }]}
|
|
150
|
+
/>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Scatter, polar, sparkline
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
<ScatterChart
|
|
157
|
+
ariaLabel="Wind components"
|
|
158
|
+
xLabel="U"
|
|
159
|
+
yLabel="V"
|
|
160
|
+
series={[{ id: "obs", name: "Observed", data: [{ x: 1, y: 2 }] }]}
|
|
161
|
+
/>
|
|
162
|
+
<PolarChart
|
|
163
|
+
ariaLabel="Wind rose"
|
|
164
|
+
categories={["N", "NE", "E", "SE", "S", "SW", "W", "NW"]}
|
|
165
|
+
direction="clockwise"
|
|
166
|
+
unit="%"
|
|
167
|
+
series={[{ id: "obs", name: "Observed", data: frequencies }]}
|
|
168
|
+
/>
|
|
169
|
+
<Sparkline data={[1, 2, null, 4]} area />
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
`ScatterChart` plots numeric `{ x, y }` points. The viewBox is 640×360. Arrow keys walk the points in series order and stop at the ends. The active point is the larger mark. `renderTooltip({ series, point, index })` replaces the default `"name x, y"` line. Parts: `grid`, `tick`, `axis-label`, `point` (`data-series`, `data-active`), `tooltip`. `ariaLabel` defaults to `"Scatter chart"`.
|
|
173
|
+
|
|
174
|
+
`PolarChart` defaults to a wind rose. Angle `0` is north. `direction` defaults to `"clockwise"` (`"counterclockwise"` turns the other way). In bar mode each category is one wedge and each series paints that wedge; a value that is not greater than zero is omitted. Sector opacity is `0.72`. `mode="scatter"` plots `{ angle, radius }` with `angle` in degrees. Arrow keys wrap. Parts: root `data-mode` (`bar` or `scatter`), `ring`, `tick`, `unit`, `sector` or `point`, `tooltip`. `renderTooltip({ series, label, value })` replaces the default text. `ariaLabel` defaults to `"Polar chart"`.
|
|
175
|
+
|
|
176
|
+
`Sparkline` is one SVG, 80×22 by default, stroke `currentColor`, width `1.5`. It does not import `lightweight-charts`. `data` accepts `number`, `null`, `undefined`, or `{ value }`. A null, a missing value, or a non-finite number breaks the line into separate `data-part="line"` paths. `area` adds a `data-part="area"` fill at opacity `0.12`. `ariaLabel` defaults to `"Sparkline"`.
|
|
177
|
+
|
|
178
|
+
### Theme
|
|
179
|
+
|
|
180
|
+
`defaultTheme` stays the neutral Lightweight Charts palette. Pass `theme` on a chart, or wrap a tree in `ChartThemeProvider`. `unstyled` skips the theme fills on the SVG charts.
|
|
181
|
+
|
|
182
|
+
```tsx
|
|
183
|
+
p1Theme("light");
|
|
184
|
+
p1Theme("dark", { colourBlind: true });
|
|
185
|
+
p1ThemeFromCss();
|
|
186
|
+
p1ThemeFromCss(document.documentElement);
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
`p1Theme` is the static brand palette. `colourBlind` swaps the up and down colours for the blue and amber pair. `p1ThemeFromCss(element?)` reads computed custom properties (`document.documentElement` when the element is omitted). Outside a browser it resolves to `defaultTheme`. A missing variable keeps the `defaultTheme` value. `var()` chains are followed. `hex`, `rgb()`, `rgba()`, and `oklch()` are resolved to sRGB before they reach a canvas. A `#rrggbb` value stays hex. `withAlpha` and `toSrgb` are exported for the same parsing.
|
|
190
|
+
|
|
191
|
+
| Theme field | Custom property |
|
|
192
|
+
| --- | --- |
|
|
193
|
+
| `palette.background` | `--p1-surface` |
|
|
194
|
+
| `palette.text`, `palette.up`, `palette.now` | `--p1-ink` |
|
|
195
|
+
| `palette.down`, `line.color` | `--p1-primary` |
|
|
196
|
+
| `palette.grid`, `palette.border` | `--p1-line` |
|
|
197
|
+
| `palette.crosshair`, `palette.neutral` | `--p1-ash-shadow` |
|
|
198
|
+
| `typography.axis.family`, `typography.label.family`, `typography.title.family` | `--p1-font-sans` |
|
|
199
|
+
| `typography.value.family` | `--p1-font-mono` |
|
|
200
|
+
| `palette.categorical` | `--p1-primary`, `--p1-blue`, `--p1-amber`, `--p1-ash-shadow`, `--p1-ink` |
|
|
201
|
+
|
|
202
|
+
Set `typography.axis.family` from `next/font` when that family is not published as a custom property on the element yet. The full map is `p1CssVariables`.
|
|
203
|
+
|
|
204
|
+
### Candlestick
|
|
205
|
+
|
|
206
|
+
Bars are always filled. Color shows the hollow or filled state.
|
|
207
|
+
|
|
208
|
+
| Color | Meaning |
|
|
209
|
+
| ----- | -------------------------------------- |
|
|
210
|
+
| Green | Hollow candle, up bar (Close > Open) |
|
|
211
|
+
| Red | Filled candle, down bar (Close < Open) |
|
|
212
|
+
| Gray | Wick above and/or below the body |
|
|
213
|
+
|
|
214
|
+
### Candlestick with Trend
|
|
215
|
+
|
|
216
|
+
Body shows bar direction, color shows bar-to-bar trend.
|
|
217
|
+
|
|
218
|
+
| Body | Meaning |
|
|
219
|
+
| ------ | ----------------------- |
|
|
220
|
+
| Hollow | Up bar (Close > Open) |
|
|
221
|
+
| Filled | Down bar (Close < Open) |
|
|
222
|
+
|
|
223
|
+
| Color | Meaning |
|
|
224
|
+
| ----- | ---------------------------------------- |
|
|
225
|
+
| Green | Up trend (Close > previous Close) |
|
|
226
|
+
| Red | Down trend (Close < previous Close) |
|
|
227
|
+
| Gray | No change in Close from the previous bar |
|
|
228
|
+
|
|
229
|
+
Reference: [TradeStation candlestick chart docs](https://help.tradestation.com/10_00/eng/tradestationhelp/charting/candlestick_chart.htm)
|
|
230
|
+
|
|
231
|
+
### Line
|
|
232
|
+
|
|
233
|
+
`<LineChart data={points} />` plots one value per time. Points are `{ time, value,color? }`; colour drives the flash fallback.
|
|
234
|
+
|
|
235
|
+
### Bands
|
|
236
|
+
|
|
237
|
+
Full-height tints behind the series, one per time range, coloured by key (for example market regimes). Available on every series chart; edges sit halfway between bars and adjacent bands share an edge.
|
|
238
|
+
|
|
239
|
+
```tsx
|
|
240
|
+
<LineChart data={prices} bands={regimes} />
|
|
241
|
+
<LineChart data={prices} bands={regimes} bandStyles={{ riskOff: "#c33" }} />
|
|
242
|
+
<LineChart data={prices} bands={regimes} bandStyles={{ riskOff: { fill, label, legendColor } }} />
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
`regimes` is `{ from, to, key }[]`; a band covers `from` up to, not including, `to`. Colours resolve per key: `palette.categorical[i]` at `theme.bands.opacity` (default `0.15`), then `theme.bands.styles[key]`, then `bandStyles[key]` (a string sets the fill). A legend for the keys present renders top-right; replace it with `renderBandLegend`, or pass `null` to hide it. The hovered band reaches `renderLegend`, `renderTooltip`, `onPointHover` and `onPointClick` as `summary.band` (`{ key, label, from, to, bars }`).
|
|
246
|
+
|
|
247
|
+
### Range select, reset and log scale
|
|
248
|
+
|
|
249
|
+
Shift-drag selects a time range, zooms to it and calls `onRangeSelect({ from, to, high, low, change, bars, ... })`; Esc cancels. Double-click fits the content and calls `onReset`. Turn them off with `rangeSelect={false}` and `doubleClickReset={false}`. `range` also takes `"3Y"` and `"5Y"`. For a log price scale pass `chartOptions={{ rightPriceScale: { mode: PriceScaleMode.Logarithmic } }}`; removing it restores the linear scale.
|
|
250
|
+
|
|
251
|
+
### Bar
|
|
252
|
+
|
|
253
|
+
`<BarChart data={points} />` draws the standard bar graph: solid columns from abaseline (default `0`, set with `seriesOptions.base`) to each value, using the samepoints as `<LineChart>` (`{ time, value, color? }`). Columns above the base use`seriesOptions.upColor`, columns at or below use `seriesOptions.downColor` (defaults`#26a69a` / `#ef5350`); a colour on the point itself, or a series-level`seriesOptions.color`, wins over both.
|
|
254
|
+
|
|
255
|
+
### Pie
|
|
256
|
+
|
|
257
|
+
`<PieChart data={parts} />` draws a pie, or a donut with `innerRadius` (0 to 0.95). Parts are `{ label, value, color? }`, sorted largest first; `maxSlices` folds the tail into one Other slice. A donut shows the total in its hole.
|
|
258
|
+
|
|
259
|
+
### Pie interactions
|
|
260
|
+
|
|
261
|
+
Every prop is optional and each piece of state is controlled (`x` + `onXChange`) or uncontrolled (`defaultX`). Slices are keyed by label; Other's key is `"other"`.
|
|
262
|
+
|
|
263
|
+
```tsx
|
|
264
|
+
<PieChart data={cargo} selectionMode="multiple" onSelectionChange={(keys, slices) => {}} />
|
|
265
|
+
<PieChart data={cargo} renderLegend={(entries) => <PieLegend entries={entries} />} />
|
|
266
|
+
<PieChart data={cargo} renderTooltip={(slice, { source, x, y }) => <Tip slice={slice} />} />
|
|
267
|
+
<PieChart data={cargo} maxSlices={5} drillOther renderBreadcrumb={({ other, back }) => <Crumb />} />
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
| Behaviour | Trigger | Props |
|
|
271
|
+
| --------- | ------- | ----- |
|
|
272
|
+
| Active | Hover a slice or its label, keyboard focus, legend hover | `activeKey`, `onActiveChange(slice, source)`, `emphasis` (`"dim"` default, `"none"`) |
|
|
273
|
+
| Selection | Click, Enter or Space; Esc clears | `selectionMode` (`"none"` default, `"single"`, `"multiple"`), `selectedKeys`, `defaultSelectedKeys`, `onSelectionChange` |
|
|
274
|
+
| Visibility | Legend click hides, Shift+click shows only that slice; the last visible slice cannot be hidden | `hiddenKeys`, `defaultHiddenKeys`, `onHiddenChange` |
|
|
275
|
+
| Legend | Renders only what you return | `renderLegend(entries)`, optional unstyled `PieLegend` |
|
|
276
|
+
| Tooltip | Follows the pointer, sits at the slice centre for keyboard, flips at the edges | `renderTooltip(slice, { source, x, y })` |
|
|
277
|
+
| Drill | Click or Enter on Other opens its parts; Esc (after clearing the selection) or `back` returns | `drillOther`, `onDrill(other \| null)`, `renderBreadcrumb({ other, back })` |
|
|
278
|
+
| Motion | Data, visibility and level changes sweep the angles over 240 ms; off for reduced motion | `animate` (`true`, `false` or `{ duration, easing }`) |
|
|
279
|
+
|
|
280
|
+
Selection props do nothing until `selectionMode` is set, the same as React Aria. Shares renormalise to the visible total; each slice also keeps `shareOfAll`. The library ships behaviour, positions, `data-part` and `data-*` attributes and ARIA only: style the parts (`slice`, `label`, `leader`, `center`, `selection`, `focus`, `legend`, `legend-item`, `tooltip`, `breadcrumb`) with the theme's `pie` slot (`dimOpacity`, `selection`, `focus`), `classNames` / `styles`, or CSS on `data-active`, `data-dimmed`, `data-selected`, `data-hidden`, `data-other` and `data-focus-visible`. `usePieState` exposes the same state for a fully custom renderer.
|
|
281
|
+
|
|
282
|
+
### Heatmap
|
|
283
|
+
|
|
284
|
+
`<Heatmap rows={days} cols={hours} value={(day, hour, r, c) => price[r][c]} />` draws one value over two categorical axes as square cells coloured by a quantised step, not a gradient, so the legend can state each range. `value` may return `null` for a gap: the cell is hatched, still focusable, announced as "no data" and left out of the scale and the stats.
|
|
285
|
+
|
|
286
|
+
```tsx
|
|
287
|
+
<Heatmap rows={days} cols={hours} value={v} steps={[50, 75, 100, 125]} unit="€/MWh" markExtreme="max" />
|
|
288
|
+
<Heatmap rows={days} cols={hours} value={v} scale="quantile" showValues />
|
|
289
|
+
<Heatmap rows={days} cols={hours} value={v} selectionMode="range" onSelectionChange={(range, stats) => {}} renderTooltip={(cell) => <Tip {...cell} />} />
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
| Behaviour | Trigger | Props |
|
|
293
|
+
| --------- | ------- | ----- |
|
|
294
|
+
| Steps | Equal-width bins of the data (default), equal-count bins, or your thresholds | `steps` (count or thresholds), `scale` (`"equal"`, `"quantile"`), `colors` |
|
|
295
|
+
| Active | Hover a cell (hit-tested from coordinates), keyboard focus | `activeCell`, `onActiveChange(cell, source)`, `emphasis` (`"crosshair"` default, `"cell"`, `"none"`) |
|
|
296
|
+
| Selection | Click; in range mode also drag, Shift+click, a row label, the strip under a column tick, Shift+arrows; Esc clears | `selectionMode` (`"none"` default, `"single"`, `"range"`), `selection`, `defaultSelection`, `onSelectionChange(range, stats)` |
|
|
297
|
+
| Step filter | Legend click hides a step, Shift+click shows only that step, hover previews it; the last visible step cannot be hidden | `hiddenSteps`, `defaultHiddenSteps`, `onHiddenStepsChange` |
|
|
298
|
+
| Legend | A default `HeatmapLegend` (unit, one entry per step, extreme marks); `null` hides it | `renderLegend(entries, marks)` |
|
|
299
|
+
| Tooltip | Follows the pointer, sits below right of the focused cell, flips at the edges, hidden while dragging | `renderTooltip(cell, { source, x, y })` |
|
|
300
|
+
| Keyboard | One tab stop; arrows clamp at the edges, Home / End in the row, Ctrl or Cmd + Home / End to the corners, Enter or Space selects | |
|
|
301
|
+
|
|
302
|
+
Cells carry `data-step` (1 to N, 0 for a gap), `data-missing`, `data-dimmed`, `data-filtered`, `data-selected` and `data-extreme`; the root carries `data-emphasis`. Style them with the theme's `heatmap` slot (`gap`, `dimOpacity`, `filteredOpacity`, `missing`, `active`, `focus`, `selection`, `extreme`, `valueInk`), `classNames` / `styles`, or CSS on those attributes; `unstyled` emits no fills at all. Below 14px per cell the grid scrolls sideways inside its root instead of shrinking. `rangeStats`, `normaliseRange`, `extremes`, `heatmapLayout`, `useHeatmapState`, `useHeatmapSelection` and `useHeatmapSteps` are exported for a custom renderer.
|
|
303
|
+
|
|
304
|
+
## Development
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
npm install
|
|
308
|
+
npm run dev
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
| Script | Description |
|
|
312
|
+
| -------------------- | ------------------------------- |
|
|
313
|
+
| `npm run dev` | Rebuild on file changes |
|
|
314
|
+
| `npm run build` | Build ESM and type declarations |
|
|
315
|
+
| `npm test` | Run tests once |
|
|
316
|
+
| `npm run test:watch` | Run tests in watch mode |
|
|
317
|
+
| `npm run typecheck` | Type-check without emitting |
|
|
318
|
+
|
|
319
|
+
## License
|
|
320
|
+
|
|
321
|
+
[Apache-2.0](LICENSE)
|