@mui/x-charts 6.0.0-alpha.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/BarChart/BarChart.d.ts +19 -0
- package/BarChart/BarChart.js +262 -0
- package/BarChart/BarElement.d.ts +21 -0
- package/BarChart/BarElement.js +92 -0
- package/BarChart/BarPlot.d.ts +2 -0
- package/BarChart/BarPlot.js +76 -0
- package/BarChart/extremums.d.ts +3 -0
- package/BarChart/extremums.js +27 -0
- package/BarChart/formatter.d.ts +3 -0
- package/BarChart/formatter.js +54 -0
- package/BarChart/index.d.ts +2 -0
- package/BarChart/index.js +19 -0
- package/BarChart/package.json +6 -0
- package/CHANGELOG.md +3211 -0
- package/ChartContainer/index.d.ts +9 -0
- package/ChartContainer/index.js +61 -0
- package/ChartContainer/package.json +6 -0
- package/ChartsAxis/ChartsAxis.d.ts +33 -0
- package/ChartsAxis/ChartsAxis.js +152 -0
- package/ChartsAxis/axisClasses.d.ts +29 -0
- package/ChartsAxis/axisClasses.js +13 -0
- package/ChartsAxis/index.d.ts +2 -0
- package/ChartsAxis/index.js +27 -0
- package/ChartsAxis/package.json +6 -0
- package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +10 -0
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +67 -0
- package/ChartsAxisHighlight/index.d.ts +1 -0
- package/ChartsAxisHighlight/index.js +16 -0
- package/ChartsAxisHighlight/package.json +6 -0
- package/ChartsClipPath/ChartsClipPath.d.ts +15 -0
- package/ChartsClipPath/ChartsClipPath.js +54 -0
- package/ChartsClipPath/index.d.ts +1 -0
- package/ChartsClipPath/index.js +16 -0
- package/ChartsClipPath/package.json +6 -0
- package/ChartsLegend/ChartsLegend.d.ts +44 -0
- package/ChartsLegend/ChartsLegend.js +202 -0
- package/ChartsLegend/chartsLegendClasses.d.ts +17 -0
- package/ChartsLegend/chartsLegendClasses.js +13 -0
- package/ChartsLegend/index.d.ts +2 -0
- package/ChartsLegend/index.js +27 -0
- package/ChartsLegend/package.json +6 -0
- package/ChartsLegend/utils.d.ts +14 -0
- package/ChartsLegend/utils.js +9 -0
- package/ChartsSurface.d.ts +21 -0
- package/ChartsSurface.js +58 -0
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +40 -0
- package/ChartsTooltip/ChartsAxisTooltipContent.js +116 -0
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +27 -0
- package/ChartsTooltip/ChartsItemTooltipContent.js +70 -0
- package/ChartsTooltip/ChartsTooltip.d.ts +32 -0
- package/ChartsTooltip/ChartsTooltip.js +104 -0
- package/ChartsTooltip/ChartsTooltipTable.d.ts +26 -0
- package/ChartsTooltip/ChartsTooltipTable.js +81 -0
- package/ChartsTooltip/index.d.ts +1 -0
- package/ChartsTooltip/index.js +16 -0
- package/ChartsTooltip/package.json +6 -0
- package/ChartsTooltip/tooltipClasses.d.ts +13 -0
- package/ChartsTooltip/tooltipClasses.js +13 -0
- package/ChartsTooltip/utils.d.ts +24 -0
- package/ChartsTooltip/utils.js +91 -0
- package/ChartsXAxis/ChartsXAxis.d.ts +7 -0
- package/ChartsXAxis/ChartsXAxis.js +191 -0
- package/ChartsXAxis/index.d.ts +1 -0
- package/ChartsXAxis/index.js +16 -0
- package/ChartsXAxis/package.json +6 -0
- package/ChartsYAxis/ChartsYAxis.d.ts +7 -0
- package/ChartsYAxis/ChartsYAxis.js +192 -0
- package/ChartsYAxis/index.d.ts +1 -0
- package/ChartsYAxis/index.js +16 -0
- package/ChartsYAxis/package.json +6 -0
- package/LICENSE +21 -0
- package/LineChart/AreaElement.d.ts +28 -0
- package/LineChart/AreaElement.js +115 -0
- package/LineChart/AreaPlot.d.ts +2 -0
- package/LineChart/AreaPlot.js +67 -0
- package/LineChart/LineChart.d.ts +19 -0
- package/LineChart/LineChart.js +266 -0
- package/LineChart/LineElement.d.ts +28 -0
- package/LineChart/LineElement.js +117 -0
- package/LineChart/LinePlot.d.ts +2 -0
- package/LineChart/LinePlot.js +67 -0
- package/LineChart/MarkElement.d.ts +38 -0
- package/LineChart/MarkElement.js +140 -0
- package/LineChart/MarkPlot.d.ts +2 -0
- package/LineChart/MarkPlot.js +86 -0
- package/LineChart/extremums.d.ts +3 -0
- package/LineChart/extremums.js +36 -0
- package/LineChart/formatter.d.ts +3 -0
- package/LineChart/formatter.js +55 -0
- package/LineChart/index.d.ts +7 -0
- package/LineChart/index.js +75 -0
- package/LineChart/package.json +6 -0
- package/README.md +5 -0
- package/ResponsiveChartContainer/index.d.ts +5 -0
- package/ResponsiveChartContainer/index.js +54 -0
- package/ResponsiveChartContainer/package.json +6 -0
- package/ScatterChart/Scatter.d.ts +15 -0
- package/ScatterChart/Scatter.js +114 -0
- package/ScatterChart/ScatterChart.d.ts +19 -0
- package/ScatterChart/ScatterChart.js +252 -0
- package/ScatterChart/ScatterPlot.d.ts +2 -0
- package/ScatterChart/ScatterPlot.js +52 -0
- package/ScatterChart/extremums.d.ts +3 -0
- package/ScatterChart/extremums.js +49 -0
- package/ScatterChart/formatter.d.ts +3 -0
- package/ScatterChart/formatter.js +19 -0
- package/ScatterChart/index.d.ts +3 -0
- package/ScatterChart/index.js +26 -0
- package/ScatterChart/package.json +6 -0
- package/colorPalettes/colorPalettes.d.ts +11 -0
- package/colorPalettes/colorPalettes.js +24 -0
- package/colorPalettes/index.d.ts +1 -0
- package/colorPalettes/index.js +16 -0
- package/colorPalettes/package.json +6 -0
- package/constants.d.ts +8 -0
- package/constants.js +17 -0
- package/context/CartesianContextProvider.d.ts +30 -0
- package/context/CartesianContextProvider.js +227 -0
- package/context/DrawingProvider.d.ts +22 -0
- package/context/DrawingProvider.js +64 -0
- package/context/HighlightProvider.d.ts +28 -0
- package/context/HighlightProvider.js +57 -0
- package/context/InteractionProvider.d.ts +34 -0
- package/context/InteractionProvider.js +62 -0
- package/context/SeriesContextProvider.d.ts +17 -0
- package/context/SeriesContextProvider.js +69 -0
- package/context/index.d.ts +3 -0
- package/context/index.js +19 -0
- package/context/package.json +6 -0
- package/esm/BarChart/BarChart.js +255 -0
- package/esm/BarChart/BarElement.js +80 -0
- package/esm/BarChart/BarPlot.js +70 -0
- package/esm/BarChart/extremums.js +20 -0
- package/esm/BarChart/formatter.js +46 -0
- package/esm/BarChart/index.js +2 -0
- package/esm/ChartContainer/index.js +53 -0
- package/esm/ChartsAxis/ChartsAxis.js +145 -0
- package/esm/ChartsAxis/axisClasses.js +5 -0
- package/esm/ChartsAxis/index.js +2 -0
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +60 -0
- package/esm/ChartsAxisHighlight/index.js +1 -0
- package/esm/ChartsClipPath/ChartsClipPath.js +46 -0
- package/esm/ChartsClipPath/index.js +1 -0
- package/esm/ChartsLegend/ChartsLegend.js +189 -0
- package/esm/ChartsLegend/chartsLegendClasses.js +5 -0
- package/esm/ChartsLegend/index.js +2 -0
- package/esm/ChartsLegend/utils.js +3 -0
- package/esm/ChartsSurface.js +49 -0
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +108 -0
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +63 -0
- package/esm/ChartsTooltip/ChartsTooltip.js +96 -0
- package/esm/ChartsTooltip/ChartsTooltipTable.js +69 -0
- package/esm/ChartsTooltip/index.js +1 -0
- package/esm/ChartsTooltip/tooltipClasses.js +5 -0
- package/esm/ChartsTooltip/utils.js +81 -0
- package/esm/ChartsXAxis/ChartsXAxis.js +184 -0
- package/esm/ChartsXAxis/index.js +1 -0
- package/esm/ChartsYAxis/ChartsYAxis.js +185 -0
- package/esm/ChartsYAxis/index.js +1 -0
- package/esm/LineChart/AreaElement.js +104 -0
- package/esm/LineChart/AreaPlot.js +58 -0
- package/esm/LineChart/LineChart.js +259 -0
- package/esm/LineChart/LineElement.js +106 -0
- package/esm/LineChart/LinePlot.js +58 -0
- package/esm/LineChart/MarkElement.js +130 -0
- package/esm/LineChart/MarkPlot.js +78 -0
- package/esm/LineChart/extremums.js +29 -0
- package/esm/LineChart/formatter.js +48 -0
- package/esm/LineChart/index.js +7 -0
- package/esm/ResponsiveChartContainer/index.js +46 -0
- package/esm/ScatterChart/Scatter.js +106 -0
- package/esm/ScatterChart/ScatterChart.js +245 -0
- package/esm/ScatterChart/ScatterPlot.js +44 -0
- package/esm/ScatterChart/extremums.js +41 -0
- package/esm/ScatterChart/formatter.js +11 -0
- package/esm/ScatterChart/index.js +3 -0
- package/esm/colorPalettes/colorPalettes.js +9 -0
- package/esm/colorPalettes/index.js +1 -0
- package/esm/constants.js +8 -0
- package/esm/context/CartesianContextProvider.js +221 -0
- package/esm/context/DrawingProvider.js +52 -0
- package/esm/context/HighlightProvider.js +46 -0
- package/esm/context/InteractionProvider.js +51 -0
- package/esm/context/SeriesContextProvider.js +60 -0
- package/esm/context/index.js +2 -0
- package/esm/hooks/useAxisEvents.js +145 -0
- package/esm/hooks/useChartDimensions.js +14 -0
- package/esm/hooks/useInteractionItemProps.js +68 -0
- package/esm/hooks/useScale.js +33 -0
- package/esm/hooks/useTicks.js +46 -0
- package/esm/index.js +15 -0
- package/esm/internals/components/AxisSharedComponents.js +81 -0
- package/esm/internals/defaultizeColor.js +7 -0
- package/esm/internals/defaultizeValueFormatter.js +11 -0
- package/esm/internals/getCurve.js +39 -0
- package/esm/internals/stackSeries.js +93 -0
- package/esm/internals/utils.js +5 -0
- package/esm/models/axis.js +1 -0
- package/esm/models/helpers.js +1 -0
- package/esm/models/index.js +1 -0
- package/esm/models/layout.js +1 -0
- package/esm/models/seriesType/bar.js +1 -0
- package/esm/models/seriesType/common.js +1 -0
- package/esm/models/seriesType/config.js +1 -0
- package/esm/models/seriesType/index.js +12 -0
- package/esm/models/seriesType/line.js +1 -0
- package/esm/models/seriesType/pie.js +1 -0
- package/esm/models/seriesType/scatter.js +1 -0
- package/esm/themeAugmentation/index.js +3 -0
- package/hooks/useAxisEvents.d.ts +1 -0
- package/hooks/useAxisEvents.js +154 -0
- package/hooks/useChartDimensions.d.ts +8 -0
- package/hooks/useChartDimensions.js +24 -0
- package/hooks/useInteractionItemProps.d.ts +8 -0
- package/hooks/useInteractionItemProps.js +79 -0
- package/hooks/useScale.d.ts +13 -0
- package/hooks/useScale.js +41 -0
- package/hooks/useTicks.d.ts +23 -0
- package/hooks/useTicks.js +50 -0
- package/index.d.ts +15 -0
- package/index.js +177 -0
- package/internals/components/AxisSharedComponents.d.ts +6 -0
- package/internals/components/AxisSharedComponents.js +93 -0
- package/internals/defaultizeColor.d.ts +41 -0
- package/internals/defaultizeColor.js +14 -0
- package/internals/defaultizeValueFormatter.d.ts +8 -0
- package/internals/defaultizeValueFormatter.js +19 -0
- package/internals/getCurve.d.ts +2 -0
- package/internals/getCurve.js +45 -0
- package/internals/stackSeries.d.ts +29 -0
- package/internals/stackSeries.js +102 -0
- package/internals/utils.d.ts +2 -0
- package/internals/utils.js +11 -0
- package/legacy/BarChart/BarChart.js +260 -0
- package/legacy/BarChart/BarElement.js +78 -0
- package/legacy/BarChart/BarPlot.js +65 -0
- package/legacy/BarChart/extremums.js +25 -0
- package/legacy/BarChart/formatter.js +49 -0
- package/legacy/BarChart/index.js +2 -0
- package/legacy/ChartContainer/index.js +51 -0
- package/legacy/ChartsAxis/ChartsAxis.js +143 -0
- package/legacy/ChartsAxis/axisClasses.js +5 -0
- package/legacy/ChartsAxis/index.js +2 -0
- package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +56 -0
- package/legacy/ChartsAxisHighlight/index.js +1 -0
- package/legacy/ChartsClipPath/ChartsClipPath.js +43 -0
- package/legacy/ChartsClipPath/index.js +1 -0
- package/legacy/ChartsLegend/ChartsLegend.js +186 -0
- package/legacy/ChartsLegend/chartsLegendClasses.js +5 -0
- package/legacy/ChartsLegend/index.js +2 -0
- package/legacy/ChartsLegend/utils.js +9 -0
- package/legacy/ChartsSurface.js +52 -0
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +106 -0
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +59 -0
- package/legacy/ChartsTooltip/ChartsTooltip.js +92 -0
- package/legacy/ChartsTooltip/ChartsTooltipTable.js +73 -0
- package/legacy/ChartsTooltip/index.js +1 -0
- package/legacy/ChartsTooltip/tooltipClasses.js +5 -0
- package/legacy/ChartsTooltip/utils.js +91 -0
- package/legacy/ChartsXAxis/ChartsXAxis.js +172 -0
- package/legacy/ChartsXAxis/index.js +1 -0
- package/legacy/ChartsYAxis/ChartsYAxis.js +173 -0
- package/legacy/ChartsYAxis/index.js +1 -0
- package/legacy/LineChart/AreaElement.js +102 -0
- package/legacy/LineChart/AreaPlot.js +62 -0
- package/legacy/LineChart/LineChart.js +265 -0
- package/legacy/LineChart/LineElement.js +104 -0
- package/legacy/LineChart/LinePlot.js +60 -0
- package/legacy/LineChart/MarkElement.js +128 -0
- package/legacy/LineChart/MarkPlot.js +75 -0
- package/legacy/LineChart/extremums.js +39 -0
- package/legacy/LineChart/formatter.js +51 -0
- package/legacy/LineChart/index.js +7 -0
- package/legacy/ResponsiveChartContainer/index.js +59 -0
- package/legacy/ScatterChart/Scatter.js +103 -0
- package/legacy/ScatterChart/ScatterChart.js +245 -0
- package/legacy/ScatterChart/ScatterPlot.js +39 -0
- package/legacy/ScatterChart/extremums.js +39 -0
- package/legacy/ScatterChart/formatter.js +12 -0
- package/legacy/ScatterChart/index.js +3 -0
- package/legacy/colorPalettes/colorPalettes.js +15 -0
- package/legacy/colorPalettes/index.js +1 -0
- package/legacy/constants.js +8 -0
- package/legacy/context/CartesianContextProvider.js +241 -0
- package/legacy/context/DrawingProvider.js +51 -0
- package/legacy/context/HighlightProvider.js +55 -0
- package/legacy/context/InteractionProvider.js +60 -0
- package/legacy/context/SeriesContextProvider.js +61 -0
- package/legacy/context/index.js +2 -0
- package/legacy/hooks/useAxisEvents.js +140 -0
- package/legacy/hooks/useChartDimensions.js +16 -0
- package/legacy/hooks/useInteractionItemProps.js +66 -0
- package/legacy/hooks/useScale.js +37 -0
- package/legacy/hooks/useTicks.js +46 -0
- package/legacy/index.js +22 -0
- package/legacy/internals/components/AxisSharedComponents.js +80 -0
- package/legacy/internals/defaultizeColor.js +8 -0
- package/legacy/internals/defaultizeValueFormatter.js +11 -0
- package/legacy/internals/getCurve.js +39 -0
- package/legacy/internals/stackSeries.js +90 -0
- package/legacy/internals/utils.js +5 -0
- package/legacy/models/axis.js +1 -0
- package/legacy/models/helpers.js +1 -0
- package/legacy/models/index.js +1 -0
- package/legacy/models/layout.js +1 -0
- package/legacy/models/seriesType/bar.js +1 -0
- package/legacy/models/seriesType/common.js +1 -0
- package/legacy/models/seriesType/config.js +1 -0
- package/legacy/models/seriesType/index.js +12 -0
- package/legacy/models/seriesType/line.js +1 -0
- package/legacy/models/seriesType/pie.js +1 -0
- package/legacy/models/seriesType/scatter.js +1 -0
- package/legacy/themeAugmentation/index.js +3 -0
- package/models/axis.d.ts +118 -0
- package/models/axis.js +5 -0
- package/models/helpers.d.ts +2 -0
- package/models/helpers.js +5 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +16 -0
- package/models/layout.d.ts +10 -0
- package/models/layout.js +5 -0
- package/models/package.json +6 -0
- package/models/seriesType/bar.d.ts +18 -0
- package/models/seriesType/bar.js +5 -0
- package/models/seriesType/common.d.ts +26 -0
- package/models/seriesType/common.js +5 -0
- package/models/seriesType/config.d.ts +66 -0
- package/models/seriesType/config.js +5 -0
- package/models/seriesType/index.d.ts +13 -0
- package/models/seriesType/index.js +38 -0
- package/models/seriesType/line.d.ts +25 -0
- package/models/seriesType/line.js +5 -0
- package/models/seriesType/pie.d.ts +5 -0
- package/models/seriesType/pie.js +5 -0
- package/models/seriesType/scatter.d.ts +24 -0
- package/models/seriesType/scatter.js +5 -0
- package/modern/BarChart/BarChart.js +255 -0
- package/modern/BarChart/BarElement.js +80 -0
- package/modern/BarChart/BarPlot.js +68 -0
- package/modern/BarChart/extremums.js +19 -0
- package/modern/BarChart/formatter.js +46 -0
- package/modern/BarChart/index.js +2 -0
- package/modern/ChartContainer/index.js +53 -0
- package/modern/ChartsAxis/ChartsAxis.js +145 -0
- package/modern/ChartsAxis/axisClasses.js +5 -0
- package/modern/ChartsAxis/index.js +2 -0
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +60 -0
- package/modern/ChartsAxisHighlight/index.js +1 -0
- package/modern/ChartsClipPath/ChartsClipPath.js +46 -0
- package/modern/ChartsClipPath/index.js +1 -0
- package/modern/ChartsLegend/ChartsLegend.js +189 -0
- package/modern/ChartsLegend/chartsLegendClasses.js +5 -0
- package/modern/ChartsLegend/index.js +2 -0
- package/modern/ChartsLegend/utils.js +3 -0
- package/modern/ChartsSurface.js +49 -0
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +107 -0
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +62 -0
- package/modern/ChartsTooltip/ChartsTooltip.js +96 -0
- package/modern/ChartsTooltip/ChartsTooltipTable.js +69 -0
- package/modern/ChartsTooltip/index.js +1 -0
- package/modern/ChartsTooltip/tooltipClasses.js +5 -0
- package/modern/ChartsTooltip/utils.js +81 -0
- package/modern/ChartsXAxis/ChartsXAxis.js +184 -0
- package/modern/ChartsXAxis/index.js +1 -0
- package/modern/ChartsYAxis/ChartsYAxis.js +185 -0
- package/modern/ChartsYAxis/index.js +1 -0
- package/modern/LineChart/AreaElement.js +104 -0
- package/modern/LineChart/AreaPlot.js +58 -0
- package/modern/LineChart/LineChart.js +259 -0
- package/modern/LineChart/LineElement.js +106 -0
- package/modern/LineChart/LinePlot.js +58 -0
- package/modern/LineChart/MarkElement.js +129 -0
- package/modern/LineChart/MarkPlot.js +78 -0
- package/modern/LineChart/extremums.js +28 -0
- package/modern/LineChart/formatter.js +48 -0
- package/modern/LineChart/index.js +7 -0
- package/modern/ResponsiveChartContainer/index.js +45 -0
- package/modern/ScatterChart/Scatter.js +106 -0
- package/modern/ScatterChart/ScatterChart.js +245 -0
- package/modern/ScatterChart/ScatterPlot.js +44 -0
- package/modern/ScatterChart/extremums.js +41 -0
- package/modern/ScatterChart/formatter.js +11 -0
- package/modern/ScatterChart/index.js +3 -0
- package/modern/colorPalettes/colorPalettes.js +9 -0
- package/modern/colorPalettes/index.js +1 -0
- package/modern/constants.js +8 -0
- package/modern/context/CartesianContextProvider.js +217 -0
- package/modern/context/DrawingProvider.js +52 -0
- package/modern/context/HighlightProvider.js +46 -0
- package/modern/context/InteractionProvider.js +51 -0
- package/modern/context/SeriesContextProvider.js +58 -0
- package/modern/context/index.js +2 -0
- package/modern/hooks/useAxisEvents.js +145 -0
- package/modern/hooks/useChartDimensions.js +14 -0
- package/modern/hooks/useInteractionItemProps.js +68 -0
- package/modern/hooks/useScale.js +33 -0
- package/modern/hooks/useTicks.js +40 -0
- package/modern/index.js +22 -0
- package/modern/internals/components/AxisSharedComponents.js +81 -0
- package/modern/internals/defaultizeColor.js +7 -0
- package/modern/internals/defaultizeValueFormatter.js +11 -0
- package/modern/internals/getCurve.js +39 -0
- package/modern/internals/stackSeries.js +93 -0
- package/modern/internals/utils.js +5 -0
- package/modern/models/axis.js +1 -0
- package/modern/models/helpers.js +1 -0
- package/modern/models/index.js +1 -0
- package/modern/models/layout.js +1 -0
- package/modern/models/seriesType/bar.js +1 -0
- package/modern/models/seriesType/common.js +1 -0
- package/modern/models/seriesType/config.js +1 -0
- package/modern/models/seriesType/index.js +12 -0
- package/modern/models/seriesType/line.js +1 -0
- package/modern/models/seriesType/pie.js +1 -0
- package/modern/models/seriesType/scatter.js +1 -0
- package/modern/themeAugmentation/index.js +3 -0
- package/package.json +57 -0
- package/themeAugmentation/components.d.ts +72 -0
- package/themeAugmentation/index.d.ts +3 -0
- package/themeAugmentation/index.js +38 -0
- package/themeAugmentation/overrides.d.ts +29 -0
- package/themeAugmentation/package.json +6 -0
- package/themeAugmentation/props.d.ts +43 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SeriesContext } from '../context/SeriesContextProvider';
|
|
3
|
+
import { ChartsTooltipTable, ChartsTooltipCell, ChartsTooltipMark, ChartsTooltipPaper, ChartsTooltipRow } from './ChartsTooltipTable';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
export function DefaultChartsItemContent(props) {
|
|
7
|
+
var _series$label;
|
|
8
|
+
var series = props.series,
|
|
9
|
+
itemData = props.itemData,
|
|
10
|
+
sx = props.sx,
|
|
11
|
+
classes = props.classes;
|
|
12
|
+
if (itemData.dataIndex === undefined) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
var displayedLabel = (_series$label = series.label) != null ? _series$label : null;
|
|
16
|
+
var color = series.color;
|
|
17
|
+
// TODO: Manage to let TS understand series.data and series.valueFormatter are coherent
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
var formattedValue = series.valueFormatter(series.data[itemData.dataIndex]);
|
|
20
|
+
return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
21
|
+
sx: sx,
|
|
22
|
+
variant: "outlined",
|
|
23
|
+
className: classes.root,
|
|
24
|
+
children: /*#__PURE__*/_jsx(ChartsTooltipTable, {
|
|
25
|
+
children: /*#__PURE__*/_jsx("tbody", {
|
|
26
|
+
children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
27
|
+
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
28
|
+
className: classes.markCell,
|
|
29
|
+
children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
|
|
30
|
+
ownerState: {
|
|
31
|
+
color: color
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
35
|
+
className: classes.labelCell,
|
|
36
|
+
children: displayedLabel
|
|
37
|
+
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
38
|
+
className: classes.valueCell,
|
|
39
|
+
children: formattedValue
|
|
40
|
+
})]
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export function ChartsItemTooltipContent(props) {
|
|
47
|
+
var content = props.content,
|
|
48
|
+
itemData = props.itemData,
|
|
49
|
+
sx = props.sx,
|
|
50
|
+
classes = props.classes;
|
|
51
|
+
var series = React.useContext(SeriesContext)[itemData.type].series[itemData.seriesId];
|
|
52
|
+
var Content = content != null ? content : DefaultChartsItemContent;
|
|
53
|
+
return /*#__PURE__*/_jsx(Content, {
|
|
54
|
+
itemData: itemData,
|
|
55
|
+
series: series,
|
|
56
|
+
sx: sx,
|
|
57
|
+
classes: classes
|
|
58
|
+
});
|
|
59
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
4
|
+
import Popper from '@mui/material/Popper';
|
|
5
|
+
import NoSsr from '@mui/material/NoSsr';
|
|
6
|
+
import { InteractionContext } from '../context/InteractionProvider';
|
|
7
|
+
import { generateVirtualElement, useMouseTracker, getTootipHasData } from './utils';
|
|
8
|
+
import { ChartsItemTooltipContent } from './ChartsItemTooltipContent';
|
|
9
|
+
import { ChartsAxisTooltipContent } from './ChartsAxisTooltipContent';
|
|
10
|
+
import { getTooltipUtilityClass } from './tooltipClasses';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
13
|
+
var classes = ownerState.classes;
|
|
14
|
+
var slots = {
|
|
15
|
+
root: ['root'],
|
|
16
|
+
markCell: ['markCell'],
|
|
17
|
+
labelCell: ['labelCell'],
|
|
18
|
+
valueCell: ['valueCell']
|
|
19
|
+
};
|
|
20
|
+
return composeClasses(slots, getTooltipUtilityClass, classes);
|
|
21
|
+
};
|
|
22
|
+
function ChartsTooltip(props) {
|
|
23
|
+
var _props$trigger = props.trigger,
|
|
24
|
+
trigger = _props$trigger === void 0 ? 'axis' : _props$trigger,
|
|
25
|
+
itemContent = props.itemContent,
|
|
26
|
+
axisContent = props.axisContent;
|
|
27
|
+
var mousePosition = useMouseTracker();
|
|
28
|
+
var _React$useContext = React.useContext(InteractionContext),
|
|
29
|
+
item = _React$useContext.item,
|
|
30
|
+
axis = _React$useContext.axis;
|
|
31
|
+
var displayedData = trigger === 'item' ? item : axis;
|
|
32
|
+
var tooltipHasData = getTootipHasData(trigger, displayedData);
|
|
33
|
+
var popperOpen = mousePosition !== null && tooltipHasData;
|
|
34
|
+
var classes = useUtilityClasses({
|
|
35
|
+
classes: props.classes
|
|
36
|
+
});
|
|
37
|
+
if (trigger === 'none') {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return /*#__PURE__*/_jsx(NoSsr, {
|
|
41
|
+
children: popperOpen && /*#__PURE__*/_jsx(Popper, {
|
|
42
|
+
open: popperOpen,
|
|
43
|
+
placement: "right-start",
|
|
44
|
+
anchorEl: generateVirtualElement(mousePosition),
|
|
45
|
+
style: {
|
|
46
|
+
pointerEvents: 'none'
|
|
47
|
+
},
|
|
48
|
+
children: trigger === 'item' ? /*#__PURE__*/_jsx(ChartsItemTooltipContent, {
|
|
49
|
+
itemData: displayedData,
|
|
50
|
+
content: itemContent,
|
|
51
|
+
sx: {
|
|
52
|
+
mx: 2
|
|
53
|
+
},
|
|
54
|
+
classes: classes
|
|
55
|
+
}) : /*#__PURE__*/_jsx(ChartsAxisTooltipContent, {
|
|
56
|
+
axisData: displayedData,
|
|
57
|
+
content: axisContent,
|
|
58
|
+
sx: {
|
|
59
|
+
mx: 2
|
|
60
|
+
},
|
|
61
|
+
classes: classes
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
|
|
67
|
+
// ----------------------------- Warning --------------------------------
|
|
68
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
69
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
70
|
+
// ----------------------------------------------------------------------
|
|
71
|
+
/**
|
|
72
|
+
* Component to override the tooltip content when triger is set to 'axis'.
|
|
73
|
+
*/
|
|
74
|
+
axisContent: PropTypes.elementType,
|
|
75
|
+
/**
|
|
76
|
+
* Override or extend the styles applied to the component.
|
|
77
|
+
*/
|
|
78
|
+
classes: PropTypes.object,
|
|
79
|
+
/**
|
|
80
|
+
* Component to override the tooltip content when triger is set to 'item'.
|
|
81
|
+
*/
|
|
82
|
+
itemContent: PropTypes.elementType,
|
|
83
|
+
/**
|
|
84
|
+
* Select the kind of tooltip to display
|
|
85
|
+
* - 'item': Shows data about the item below the mouse.
|
|
86
|
+
* - 'axis': Shows values associated with the hovered x value
|
|
87
|
+
* - 'none': Does not display tooltip
|
|
88
|
+
* @default 'item'
|
|
89
|
+
*/
|
|
90
|
+
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|
|
91
|
+
} : void 0;
|
|
92
|
+
export { ChartsTooltip };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import Paper from '@mui/material/Paper';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { tooltipClasses } from './tooltipClasses';
|
|
6
|
+
export var ChartsTooltipPaper = styled(Paper, {
|
|
7
|
+
name: 'MuiChartsTooltip',
|
|
8
|
+
slot: 'Table'
|
|
9
|
+
})({});
|
|
10
|
+
export var ChartsTooltipTable = styled('table', {
|
|
11
|
+
name: 'MuiChartsTooltip',
|
|
12
|
+
slot: 'Table'
|
|
13
|
+
})(function (_ref) {
|
|
14
|
+
var theme = _ref.theme;
|
|
15
|
+
return {
|
|
16
|
+
borderSpacing: 0,
|
|
17
|
+
'& thead td': {
|
|
18
|
+
borderBottom: "solid ".concat(theme.palette.divider, " 1px")
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
export var ChartsTooltipRow = styled('tr', {
|
|
23
|
+
name: 'MuiChartsTooltip',
|
|
24
|
+
slot: 'Row'
|
|
25
|
+
})(function (_ref2) {
|
|
26
|
+
var theme = _ref2.theme;
|
|
27
|
+
return {
|
|
28
|
+
'&:first-child td': {
|
|
29
|
+
paddingTop: theme.spacing(1)
|
|
30
|
+
},
|
|
31
|
+
'&:last-child td': {
|
|
32
|
+
paddingBottom: theme.spacing(1)
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
export var ChartsTooltipCell = styled('td', {
|
|
37
|
+
name: 'MuiChartsTooltip',
|
|
38
|
+
slot: 'Cell'
|
|
39
|
+
})(function (_ref3) {
|
|
40
|
+
var _ref4;
|
|
41
|
+
var theme = _ref3.theme;
|
|
42
|
+
return _ref4 = {
|
|
43
|
+
verticalAlign: 'middle',
|
|
44
|
+
color: theme.palette.text.secondary,
|
|
45
|
+
'&:first-child': {
|
|
46
|
+
paddingLeft: theme.spacing(2)
|
|
47
|
+
},
|
|
48
|
+
'&:last-child': {
|
|
49
|
+
paddingRight: theme.spacing(2)
|
|
50
|
+
}
|
|
51
|
+
}, _defineProperty(_ref4, "&.".concat(tooltipClasses.labelCell), {
|
|
52
|
+
paddingLeft: theme.spacing(1)
|
|
53
|
+
}), _defineProperty(_ref4, "&.".concat(tooltipClasses.valueCell), {
|
|
54
|
+
paddingLeft: theme.spacing(4),
|
|
55
|
+
color: theme.palette.text.primary
|
|
56
|
+
}), _ref4;
|
|
57
|
+
});
|
|
58
|
+
export var ChartsTooltipMark = styled(Box, {
|
|
59
|
+
name: 'MuiChartsTooltip',
|
|
60
|
+
slot: 'Mark'
|
|
61
|
+
})(function (_ref5) {
|
|
62
|
+
var theme = _ref5.theme,
|
|
63
|
+
ownerState = _ref5.ownerState;
|
|
64
|
+
return {
|
|
65
|
+
width: theme.spacing(1),
|
|
66
|
+
height: theme.spacing(1),
|
|
67
|
+
borderRadius: '50%',
|
|
68
|
+
backgroundColor: ownerState.color,
|
|
69
|
+
borderColor: theme.palette.background.paper,
|
|
70
|
+
border: "solid ".concat(theme.palette.background.paper, " ").concat(theme.spacing(0.25)),
|
|
71
|
+
boxSizing: 'content-box'
|
|
72
|
+
};
|
|
73
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ChartsTooltip';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
2
|
+
export function getTooltipUtilityClass(slot) {
|
|
3
|
+
return generateUtilityClass('MuiChartsTooltip', slot);
|
|
4
|
+
}
|
|
5
|
+
export var tooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'markCell', 'labelCell', 'valueCell']);
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { SVGContext } from '../context/DrawingProvider';
|
|
4
|
+
export function generateVirtualElement(mousePosition) {
|
|
5
|
+
if (mousePosition === null) {
|
|
6
|
+
return {
|
|
7
|
+
getBoundingClientRect: function getBoundingClientRect() {
|
|
8
|
+
return {
|
|
9
|
+
width: 0,
|
|
10
|
+
height: 0,
|
|
11
|
+
x: 0,
|
|
12
|
+
y: 0,
|
|
13
|
+
top: 0,
|
|
14
|
+
right: 0,
|
|
15
|
+
bottom: 0,
|
|
16
|
+
left: 0,
|
|
17
|
+
toJSON: function toJSON() {
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
var x = mousePosition.x,
|
|
25
|
+
y = mousePosition.y;
|
|
26
|
+
return {
|
|
27
|
+
getBoundingClientRect: function getBoundingClientRect() {
|
|
28
|
+
return {
|
|
29
|
+
width: 0,
|
|
30
|
+
height: 0,
|
|
31
|
+
x: x,
|
|
32
|
+
y: y,
|
|
33
|
+
top: y,
|
|
34
|
+
right: x,
|
|
35
|
+
bottom: y,
|
|
36
|
+
left: x,
|
|
37
|
+
toJSON: function toJSON() {
|
|
38
|
+
return JSON.stringify({
|
|
39
|
+
width: 0,
|
|
40
|
+
height: 0,
|
|
41
|
+
x: x,
|
|
42
|
+
y: y,
|
|
43
|
+
top: y,
|
|
44
|
+
right: x,
|
|
45
|
+
bottom: y,
|
|
46
|
+
left: x
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export function useMouseTracker() {
|
|
54
|
+
var svgRef = React.useContext(SVGContext);
|
|
55
|
+
|
|
56
|
+
// Use a ref to avoid rerendering on every mousemove event.
|
|
57
|
+
var _React$useState = React.useState(null),
|
|
58
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
59
|
+
mousePosition = _React$useState2[0],
|
|
60
|
+
setMousePosition = _React$useState2[1];
|
|
61
|
+
React.useEffect(function () {
|
|
62
|
+
var element = svgRef.current;
|
|
63
|
+
if (element === null) {
|
|
64
|
+
return function () {};
|
|
65
|
+
}
|
|
66
|
+
var handleMouseOut = function handleMouseOut() {
|
|
67
|
+
setMousePosition(null);
|
|
68
|
+
};
|
|
69
|
+
var handleMouseMove = function handleMouseMove(event) {
|
|
70
|
+
setMousePosition({
|
|
71
|
+
x: event.clientX,
|
|
72
|
+
y: event.clientY
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
element.addEventListener('mouseout', handleMouseOut);
|
|
76
|
+
element.addEventListener('mousemove', handleMouseMove);
|
|
77
|
+
return function () {
|
|
78
|
+
element.removeEventListener('mouseout', handleMouseOut);
|
|
79
|
+
element.removeEventListener('mousemove', handleMouseMove);
|
|
80
|
+
};
|
|
81
|
+
}, [svgRef]);
|
|
82
|
+
return mousePosition;
|
|
83
|
+
}
|
|
84
|
+
export function getTootipHasData(trigger, displayedData) {
|
|
85
|
+
if (trigger === 'item') {
|
|
86
|
+
return displayedData !== null;
|
|
87
|
+
}
|
|
88
|
+
var hasAxisXData = displayedData.x !== null;
|
|
89
|
+
var hasAxisYData = displayedData.y !== null;
|
|
90
|
+
return hasAxisXData || hasAxisYData;
|
|
91
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
var _excluded = ["scale", "ticksNumber"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
7
|
+
import { useThemeProps, useTheme } from '@mui/material/styles';
|
|
8
|
+
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
9
|
+
import { DrawingContext } from '../context/DrawingProvider';
|
|
10
|
+
import useTicks from '../hooks/useTicks';
|
|
11
|
+
import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
|
|
12
|
+
import { Line, Tick, TickLabel, Label, AxisRoot } from '../internals/components/AxisSharedComponents';
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
16
|
+
var classes = ownerState.classes,
|
|
17
|
+
position = ownerState.position;
|
|
18
|
+
var slots = {
|
|
19
|
+
root: ['root', 'directionX', position],
|
|
20
|
+
line: ['line'],
|
|
21
|
+
tickContainer: ['tickContainer'],
|
|
22
|
+
tick: ['tick'],
|
|
23
|
+
tickLabel: ['tickLabel'],
|
|
24
|
+
label: ['label']
|
|
25
|
+
};
|
|
26
|
+
return composeClasses(slots, getAxisUtilityClass, classes);
|
|
27
|
+
};
|
|
28
|
+
var defaultProps = {
|
|
29
|
+
position: 'bottom',
|
|
30
|
+
disableLine: false,
|
|
31
|
+
disableTicks: false,
|
|
32
|
+
tickFontSize: 12,
|
|
33
|
+
labelFontSize: 14,
|
|
34
|
+
tickSize: 6
|
|
35
|
+
};
|
|
36
|
+
function ChartsXAxis(inProps) {
|
|
37
|
+
var props = useThemeProps({
|
|
38
|
+
props: _extends({}, defaultProps, inProps),
|
|
39
|
+
name: 'MuiChartsXAxis'
|
|
40
|
+
});
|
|
41
|
+
var _React$useContext = React.useContext(CartesianContext),
|
|
42
|
+
_React$useContext$xAx = _React$useContext.xAxis[props.axisId],
|
|
43
|
+
xScale = _React$useContext$xAx.scale,
|
|
44
|
+
ticksNumber = _React$useContext$xAx.ticksNumber,
|
|
45
|
+
settings = _objectWithoutProperties(_React$useContext$xAx, _excluded);
|
|
46
|
+
var defaultizedProps = _extends({}, defaultProps, settings, props);
|
|
47
|
+
var position = defaultizedProps.position,
|
|
48
|
+
disableLine = defaultizedProps.disableLine,
|
|
49
|
+
disableTicks = defaultizedProps.disableTicks,
|
|
50
|
+
tickFontSize = defaultizedProps.tickFontSize,
|
|
51
|
+
label = defaultizedProps.label,
|
|
52
|
+
labelFontSize = defaultizedProps.labelFontSize,
|
|
53
|
+
tickSizeProp = defaultizedProps.tickSize,
|
|
54
|
+
valueFormatter = defaultizedProps.valueFormatter;
|
|
55
|
+
var theme = useTheme();
|
|
56
|
+
var classes = useUtilityClasses(_extends({}, defaultizedProps, {
|
|
57
|
+
theme: theme
|
|
58
|
+
}));
|
|
59
|
+
var _React$useContext2 = React.useContext(DrawingContext),
|
|
60
|
+
left = _React$useContext2.left,
|
|
61
|
+
top = _React$useContext2.top,
|
|
62
|
+
width = _React$useContext2.width,
|
|
63
|
+
height = _React$useContext2.height;
|
|
64
|
+
var tickSize = disableTicks ? 4 : tickSizeProp;
|
|
65
|
+
var xTicks = useTicks({
|
|
66
|
+
scale: xScale,
|
|
67
|
+
ticksNumber: ticksNumber,
|
|
68
|
+
valueFormatter: valueFormatter
|
|
69
|
+
});
|
|
70
|
+
var positionSigne = position === 'bottom' ? 1 : -1;
|
|
71
|
+
var labelRefPoint = {
|
|
72
|
+
x: left + width / 2,
|
|
73
|
+
y: positionSigne * (tickFontSize + tickSize + 10)
|
|
74
|
+
};
|
|
75
|
+
return /*#__PURE__*/_jsxs(AxisRoot, {
|
|
76
|
+
transform: "translate(0, ".concat(position === 'bottom' ? top + height : top, ")"),
|
|
77
|
+
className: classes.root,
|
|
78
|
+
children: [!disableLine && /*#__PURE__*/_jsx(Line, {
|
|
79
|
+
x1: xScale.range()[0],
|
|
80
|
+
x2: xScale.range()[1],
|
|
81
|
+
className: classes.line
|
|
82
|
+
}), xTicks.map(function (_ref, index) {
|
|
83
|
+
var formattedValue = _ref.formattedValue,
|
|
84
|
+
offset = _ref.offset,
|
|
85
|
+
labelOffset = _ref.labelOffset;
|
|
86
|
+
var xTickLabel = labelOffset != null ? labelOffset : 0;
|
|
87
|
+
var yTickLabel = positionSigne * (tickSize + 3);
|
|
88
|
+
return /*#__PURE__*/_jsxs("g", {
|
|
89
|
+
transform: "translate(".concat(offset, ", 0)"),
|
|
90
|
+
className: classes.tickContainer,
|
|
91
|
+
children: [!disableTicks && /*#__PURE__*/_jsx(Tick, {
|
|
92
|
+
y2: positionSigne * tickSize,
|
|
93
|
+
className: classes.tick
|
|
94
|
+
}), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, {
|
|
95
|
+
x: xTickLabel,
|
|
96
|
+
y: yTickLabel,
|
|
97
|
+
"transform-origin": "".concat(xTickLabel, "px ").concat(yTickLabel, "px"),
|
|
98
|
+
sx: {
|
|
99
|
+
fontSize: tickFontSize
|
|
100
|
+
},
|
|
101
|
+
className: classes.tickLabel,
|
|
102
|
+
children: formattedValue
|
|
103
|
+
})]
|
|
104
|
+
}, index);
|
|
105
|
+
}), label && /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, {
|
|
106
|
+
sx: {
|
|
107
|
+
fontSize: labelFontSize,
|
|
108
|
+
transformOrigin: "".concat(labelRefPoint.x, "px ").concat(labelRefPoint.y, "px")
|
|
109
|
+
},
|
|
110
|
+
className: classes.label,
|
|
111
|
+
children: label
|
|
112
|
+
}))]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
116
|
+
// ----------------------------- Warning --------------------------------
|
|
117
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
118
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
119
|
+
// ----------------------------------------------------------------------
|
|
120
|
+
/**
|
|
121
|
+
* Id of the axis to render.
|
|
122
|
+
*/
|
|
123
|
+
axisId: PropTypes.string.isRequired,
|
|
124
|
+
/**
|
|
125
|
+
* Override or extend the styles applied to the component.
|
|
126
|
+
*/
|
|
127
|
+
classes: PropTypes.object,
|
|
128
|
+
/**
|
|
129
|
+
* If true, the axis line is disabled.
|
|
130
|
+
* @default false
|
|
131
|
+
*/
|
|
132
|
+
disableLine: PropTypes.bool,
|
|
133
|
+
/**
|
|
134
|
+
* If true, the ticks are disabled.
|
|
135
|
+
* @default false
|
|
136
|
+
*/
|
|
137
|
+
disableTicks: PropTypes.bool,
|
|
138
|
+
/**
|
|
139
|
+
* The fill color of the axis text.
|
|
140
|
+
* @default 'currentColor'
|
|
141
|
+
*/
|
|
142
|
+
fill: PropTypes.string,
|
|
143
|
+
/**
|
|
144
|
+
* The label of the axis.
|
|
145
|
+
*/
|
|
146
|
+
label: PropTypes.string,
|
|
147
|
+
/**
|
|
148
|
+
* The font size of the axis label.
|
|
149
|
+
* @default 14
|
|
150
|
+
*/
|
|
151
|
+
labelFontSize: PropTypes.number,
|
|
152
|
+
/**
|
|
153
|
+
* Position of the axis.
|
|
154
|
+
*/
|
|
155
|
+
position: PropTypes.oneOf(['bottom', 'top']),
|
|
156
|
+
/**
|
|
157
|
+
* The stroke color of the axis line.
|
|
158
|
+
* @default 'currentColor'
|
|
159
|
+
*/
|
|
160
|
+
stroke: PropTypes.string,
|
|
161
|
+
/**
|
|
162
|
+
* The font size of the axis ticks text.
|
|
163
|
+
* @default 12
|
|
164
|
+
*/
|
|
165
|
+
tickFontSize: PropTypes.number,
|
|
166
|
+
/**
|
|
167
|
+
* The size of the ticks.
|
|
168
|
+
* @default 6
|
|
169
|
+
*/
|
|
170
|
+
tickSize: PropTypes.number
|
|
171
|
+
} : void 0;
|
|
172
|
+
export { ChartsXAxis };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ChartsXAxis';
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
var _excluded = ["scale", "ticksNumber"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
7
|
+
import { useThemeProps, useTheme } from '@mui/material/styles';
|
|
8
|
+
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
9
|
+
import { DrawingContext } from '../context/DrawingProvider';
|
|
10
|
+
import useTicks from '../hooks/useTicks';
|
|
11
|
+
import { Line, Tick, TickLabel, Label, AxisRoot } from '../internals/components/AxisSharedComponents';
|
|
12
|
+
import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
16
|
+
var classes = ownerState.classes,
|
|
17
|
+
position = ownerState.position;
|
|
18
|
+
var slots = {
|
|
19
|
+
root: ['root', 'directionY', position],
|
|
20
|
+
line: ['line'],
|
|
21
|
+
tickContainer: ['tickContainer'],
|
|
22
|
+
tick: ['tick'],
|
|
23
|
+
tickLabel: ['tickLabel'],
|
|
24
|
+
label: ['label']
|
|
25
|
+
};
|
|
26
|
+
return composeClasses(slots, getAxisUtilityClass, classes);
|
|
27
|
+
};
|
|
28
|
+
var defaultProps = {
|
|
29
|
+
position: 'left',
|
|
30
|
+
disableLine: false,
|
|
31
|
+
disableTicks: false,
|
|
32
|
+
tickFontSize: 12,
|
|
33
|
+
labelFontSize: 14,
|
|
34
|
+
tickSize: 6
|
|
35
|
+
};
|
|
36
|
+
function ChartsYAxis(inProps) {
|
|
37
|
+
var props = useThemeProps({
|
|
38
|
+
props: _extends({}, defaultProps, inProps),
|
|
39
|
+
name: 'MuiChartsYAxis'
|
|
40
|
+
});
|
|
41
|
+
var _React$useContext = React.useContext(CartesianContext),
|
|
42
|
+
_React$useContext$yAx = _React$useContext.yAxis[props.axisId],
|
|
43
|
+
yScale = _React$useContext$yAx.scale,
|
|
44
|
+
ticksNumber = _React$useContext$yAx.ticksNumber,
|
|
45
|
+
settings = _objectWithoutProperties(_React$useContext$yAx, _excluded);
|
|
46
|
+
var defaultizedProps = _extends({}, defaultProps, settings, props);
|
|
47
|
+
var position = defaultizedProps.position,
|
|
48
|
+
disableLine = defaultizedProps.disableLine,
|
|
49
|
+
disableTicks = defaultizedProps.disableTicks,
|
|
50
|
+
tickFontSize = defaultizedProps.tickFontSize,
|
|
51
|
+
label = defaultizedProps.label,
|
|
52
|
+
labelFontSize = defaultizedProps.labelFontSize,
|
|
53
|
+
tickSizeProp = defaultizedProps.tickSize,
|
|
54
|
+
valueFormatter = defaultizedProps.valueFormatter;
|
|
55
|
+
var theme = useTheme();
|
|
56
|
+
var classes = useUtilityClasses(_extends({}, defaultizedProps, {
|
|
57
|
+
theme: theme
|
|
58
|
+
}));
|
|
59
|
+
var _React$useContext2 = React.useContext(DrawingContext),
|
|
60
|
+
left = _React$useContext2.left,
|
|
61
|
+
top = _React$useContext2.top,
|
|
62
|
+
width = _React$useContext2.width,
|
|
63
|
+
height = _React$useContext2.height;
|
|
64
|
+
var tickSize = disableTicks ? 4 : tickSizeProp;
|
|
65
|
+
var yTicks = useTicks({
|
|
66
|
+
scale: yScale,
|
|
67
|
+
ticksNumber: ticksNumber,
|
|
68
|
+
valueFormatter: valueFormatter
|
|
69
|
+
});
|
|
70
|
+
var positionSigne = position === 'right' ? 1 : -1;
|
|
71
|
+
var labelRefPoint = {
|
|
72
|
+
x: positionSigne * (tickFontSize + tickSize + 10),
|
|
73
|
+
y: top + height / 2
|
|
74
|
+
};
|
|
75
|
+
return /*#__PURE__*/_jsxs(AxisRoot, {
|
|
76
|
+
transform: "translate(".concat(position === 'right' ? left + width : left, ", 0)"),
|
|
77
|
+
className: classes.root,
|
|
78
|
+
children: [!disableLine && /*#__PURE__*/_jsx(Line, {
|
|
79
|
+
y1: yScale.range()[0],
|
|
80
|
+
y2: yScale.range()[1],
|
|
81
|
+
className: classes.line
|
|
82
|
+
}), yTicks.map(function (_ref, index) {
|
|
83
|
+
var formattedValue = _ref.formattedValue,
|
|
84
|
+
offset = _ref.offset,
|
|
85
|
+
labelOffset = _ref.labelOffset;
|
|
86
|
+
var xTickLabel = positionSigne * (tickSize + 2);
|
|
87
|
+
var yTickLabel = labelOffset;
|
|
88
|
+
return /*#__PURE__*/_jsxs("g", {
|
|
89
|
+
transform: "translate(0, ".concat(offset, ")"),
|
|
90
|
+
className: classes.tickContainer,
|
|
91
|
+
children: [!disableTicks && /*#__PURE__*/_jsx(Tick, {
|
|
92
|
+
x2: positionSigne * tickSize,
|
|
93
|
+
className: classes.tick
|
|
94
|
+
}), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, {
|
|
95
|
+
x: xTickLabel,
|
|
96
|
+
y: yTickLabel,
|
|
97
|
+
"transform-origin": "".concat(xTickLabel, "px ").concat(yTickLabel, "px"),
|
|
98
|
+
sx: {
|
|
99
|
+
fontSize: tickFontSize
|
|
100
|
+
},
|
|
101
|
+
className: classes.tickLabel,
|
|
102
|
+
children: formattedValue.toLocaleString()
|
|
103
|
+
})]
|
|
104
|
+
}, index);
|
|
105
|
+
}), label && /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, {
|
|
106
|
+
sx: {
|
|
107
|
+
fontSize: labelFontSize,
|
|
108
|
+
transform: "rotate(".concat(positionSigne * 90, "deg)"),
|
|
109
|
+
transformOrigin: "".concat(labelRefPoint.x, "px ").concat(labelRefPoint.y, "px")
|
|
110
|
+
},
|
|
111
|
+
className: classes.label,
|
|
112
|
+
children: label
|
|
113
|
+
}))]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
117
|
+
// ----------------------------- Warning --------------------------------
|
|
118
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
119
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
120
|
+
// ----------------------------------------------------------------------
|
|
121
|
+
/**
|
|
122
|
+
* Id of the axis to render.
|
|
123
|
+
*/
|
|
124
|
+
axisId: PropTypes.string.isRequired,
|
|
125
|
+
/**
|
|
126
|
+
* Override or extend the styles applied to the component.
|
|
127
|
+
*/
|
|
128
|
+
classes: PropTypes.object,
|
|
129
|
+
/**
|
|
130
|
+
* If true, the axis line is disabled.
|
|
131
|
+
* @default false
|
|
132
|
+
*/
|
|
133
|
+
disableLine: PropTypes.bool,
|
|
134
|
+
/**
|
|
135
|
+
* If true, the ticks are disabled.
|
|
136
|
+
* @default false
|
|
137
|
+
*/
|
|
138
|
+
disableTicks: PropTypes.bool,
|
|
139
|
+
/**
|
|
140
|
+
* The fill color of the axis text.
|
|
141
|
+
* @default 'currentColor'
|
|
142
|
+
*/
|
|
143
|
+
fill: PropTypes.string,
|
|
144
|
+
/**
|
|
145
|
+
* The label of the axis.
|
|
146
|
+
*/
|
|
147
|
+
label: PropTypes.string,
|
|
148
|
+
/**
|
|
149
|
+
* The font size of the axis label.
|
|
150
|
+
* @default 14
|
|
151
|
+
*/
|
|
152
|
+
labelFontSize: PropTypes.number,
|
|
153
|
+
/**
|
|
154
|
+
* Position of the axis.
|
|
155
|
+
*/
|
|
156
|
+
position: PropTypes.oneOf(['left', 'right']),
|
|
157
|
+
/**
|
|
158
|
+
* The stroke color of the axis line.
|
|
159
|
+
* @default 'currentColor'
|
|
160
|
+
*/
|
|
161
|
+
stroke: PropTypes.string,
|
|
162
|
+
/**
|
|
163
|
+
* The font size of the axis ticks text.
|
|
164
|
+
* @default 12
|
|
165
|
+
*/
|
|
166
|
+
tickFontSize: PropTypes.number,
|
|
167
|
+
/**
|
|
168
|
+
* The size of the ticks.
|
|
169
|
+
* @default 6
|
|
170
|
+
*/
|
|
171
|
+
tickSize: PropTypes.number
|
|
172
|
+
} : void 0;
|
|
173
|
+
export { ChartsYAxis };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ChartsYAxis';
|