@fluentui/react-charts 1.2.0 → 9.0.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/CHANGELOG.md +177 -15
- package/LICENSE +11 -17
- package/README.md +174 -23
- package/dist/index.d.ts +2143 -0
- package/lib/CartesianChart.js +1 -0
- package/lib/CartesianChart.js.map +1 -0
- package/lib/DeclarativeChart.js +1 -0
- package/lib/DeclarativeChart.js.map +1 -0
- package/lib/DonutChart.js +1 -0
- package/lib/DonutChart.js.map +1 -0
- package/lib/HorizontalBarChart.js +1 -0
- package/lib/HorizontalBarChart.js.map +1 -0
- package/lib/Legends.js +1 -0
- package/lib/Legends.js.map +1 -0
- package/lib/LineChart.js +1 -0
- package/lib/LineChart.js.map +1 -0
- package/lib/Popover.js +1 -0
- package/lib/Popover.js.map +1 -0
- package/lib/ResponsiveContainer.js +1 -0
- package/lib/ResponsiveContainer.js.map +1 -0
- package/lib/Sparkline.js +1 -0
- package/lib/Sparkline.js.map +1 -0
- package/lib/VerticalBarChart.js +1 -0
- package/lib/VerticalBarChart.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.js +462 -0
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.types.js +1 -0
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -0
- package/lib/components/CommonComponents/ChartPopover.js +187 -0
- package/lib/components/CommonComponents/ChartPopover.js.map +1 -0
- package/lib/components/CommonComponents/ChartPopover.types.js +1 -0
- package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -0
- package/lib/components/CommonComponents/index.js +4 -0
- package/lib/components/CommonComponents/index.js.map +1 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +229 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -0
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +178 -0
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.js +150 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchema.js +7 -0
- package/lib/components/DeclarativeChart/PlotlySchema.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +400 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -0
- package/lib/components/DeclarativeChart/imageExporter.js +221 -0
- package/lib/components/DeclarativeChart/imageExporter.js.map +1 -0
- package/lib/components/DeclarativeChart/index.js +1 -0
- package/lib/components/DeclarativeChart/index.js.map +1 -0
- package/lib/components/DonutChart/Arc/Arc.js +110 -0
- package/lib/components/DonutChart/Arc/Arc.js.map +1 -0
- package/lib/components/DonutChart/Arc/Arc.types.js +1 -0
- package/lib/components/DonutChart/Arc/Arc.types.js.map +1 -0
- package/lib/components/DonutChart/Arc/index.js +2 -0
- package/lib/components/DonutChart/Arc/index.js.map +1 -0
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js +54 -0
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -0
- package/lib/components/DonutChart/DonutChart.js +291 -0
- package/lib/components/DonutChart/DonutChart.js.map +1 -0
- package/lib/components/DonutChart/DonutChart.types.js +1 -0
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -0
- package/lib/components/DonutChart/Pie/Pie.js +72 -0
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -0
- package/lib/components/DonutChart/Pie/Pie.types.js +1 -0
- package/lib/components/DonutChart/Pie/Pie.types.js.map +1 -0
- package/lib/components/DonutChart/Pie/index.js +2 -0
- package/lib/components/DonutChart/Pie/index.js.map +1 -0
- package/lib/components/DonutChart/Pie/usePieStyles.styles.js +44 -0
- package/lib/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -0
- package/lib/components/DonutChart/index.js +3 -0
- package/lib/components/DonutChart/index.js.map +1 -0
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +58 -0
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -0
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js +402 -0
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -0
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js +6 -0
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -0
- package/lib/components/HorizontalBarChart/index.js +3 -0
- package/lib/components/HorizontalBarChart/index.js.map +1 -0
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +163 -0
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -0
- package/lib/components/Legends/Legends.js +302 -0
- package/lib/components/Legends/Legends.js.map +1 -0
- package/lib/components/Legends/Legends.types.js +1 -0
- package/lib/components/Legends/Legends.types.js.map +1 -0
- package/lib/components/Legends/OverflowMenu.js +25 -0
- package/lib/components/Legends/OverflowMenu.js.map +1 -0
- package/lib/components/Legends/index.js +3 -0
- package/lib/components/Legends/index.js.map +1 -0
- package/lib/components/Legends/shape.js +35 -0
- package/lib/components/Legends/shape.js.map +1 -0
- package/lib/components/Legends/useLegendsStyles.styles.js +147 -0
- package/lib/components/Legends/useLegendsStyles.styles.js.map +1 -0
- package/lib/components/LineChart/LineChart.js +1026 -0
- package/lib/components/LineChart/LineChart.js.map +1 -0
- package/lib/components/LineChart/LineChart.types.js +3 -0
- package/lib/components/LineChart/LineChart.types.js.map +1 -0
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +119 -0
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -0
- package/lib/components/LineChart/eventAnnotation/LabelLink.js +57 -0
- package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +1 -0
- package/lib/components/LineChart/eventAnnotation/Textbox.js +40 -0
- package/lib/components/LineChart/eventAnnotation/Textbox.js.map +1 -0
- package/lib/components/LineChart/index.js +4 -0
- package/lib/components/LineChart/index.js.map +1 -0
- package/lib/components/LineChart/useLineChartStyles.styles.js +65 -0
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -0
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js +65 -0
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -0
- package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js +1 -0
- package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -0
- package/lib/components/ResponsiveContainer/index.js +1 -0
- package/lib/components/ResponsiveContainer/index.js.map +1 -0
- package/lib/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js +23 -0
- package/lib/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js.map +1 -0
- package/lib/components/Sparkline/Sparkline.js +119 -0
- package/lib/components/Sparkline/Sparkline.js.map +1 -0
- package/lib/components/Sparkline/Sparkline.types.js +4 -0
- package/lib/components/Sparkline/Sparkline.types.js.map +1 -0
- package/lib/components/Sparkline/index.js +3 -0
- package/lib/components/Sparkline/index.js.map +1 -0
- package/lib/components/Sparkline/useSparklineStyles.styles.js +49 -0
- package/lib/components/Sparkline/useSparklineStyles.styles.js.map +1 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.js +849 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.types.js +4 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -0
- package/lib/components/VerticalBarChart/index.js +3 -0
- package/lib/components/VerticalBarChart/index.js.map +1 -0
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +74 -0
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -0
- package/lib/index.js +12 -8
- package/lib/index.js.map +1 -1
- package/lib/types/DataPoint.js +3 -0
- package/lib/types/DataPoint.js.map +1 -0
- package/lib/types/EventAnnotation.js +1 -0
- package/lib/types/EventAnnotation.js.map +1 -0
- package/lib/types/LegendDataItem.js +1 -0
- package/lib/types/LegendDataItem.js.map +1 -0
- package/lib/types/index.js +2 -2
- package/lib/types/index.js.map +1 -1
- package/lib/utilities/FocusableTooltipText.js +65 -0
- package/lib/utilities/FocusableTooltipText.js.map +1 -0
- package/lib/utilities/KeyCodes.js +8 -0
- package/lib/utilities/KeyCodes.js.map +1 -0
- package/lib/utilities/SVGTooltipText.js +138 -0
- package/lib/utilities/SVGTooltipText.js.map +1 -0
- package/lib/utilities/async-utils.js +380 -0
- package/lib/utilities/async-utils.js.map +1 -0
- package/lib/utilities/colors.js +249 -0
- package/lib/utilities/colors.js.map +1 -0
- package/lib/utilities/getWindow.js +25 -0
- package/lib/utilities/getWindow.js.map +1 -0
- package/lib/utilities/index.js +3 -0
- package/lib/utilities/index.js.map +1 -0
- package/lib/utilities/locale-util.js +15 -0
- package/lib/utilities/locale-util.js.map +1 -0
- package/lib/utilities/overflow-utils.js +27 -0
- package/lib/utilities/overflow-utils.js.map +1 -0
- package/lib/utilities/test-data.js +276 -0
- package/lib/utilities/test-data.js.map +1 -0
- package/lib/utilities/utilities.js +1215 -0
- package/lib/utilities/utilities.js.map +1 -0
- package/lib/utilities/vbc-utils.js +27 -0
- package/lib/utilities/vbc-utils.js.map +1 -0
- package/lib-commonjs/CartesianChart.js +6 -0
- package/lib-commonjs/CartesianChart.js.map +1 -0
- package/lib-commonjs/DeclarativeChart.js +6 -0
- package/lib-commonjs/DeclarativeChart.js.map +1 -0
- package/lib-commonjs/DonutChart.js +6 -0
- package/lib-commonjs/DonutChart.js.map +1 -0
- package/lib-commonjs/HorizontalBarChart.js +6 -0
- package/lib-commonjs/HorizontalBarChart.js.map +1 -0
- package/lib-commonjs/Legends.js +6 -0
- package/lib-commonjs/Legends.js.map +1 -0
- package/lib-commonjs/LineChart.js +6 -0
- package/lib-commonjs/LineChart.js.map +1 -0
- package/lib-commonjs/Popover.js +6 -0
- package/lib-commonjs/Popover.js.map +1 -0
- package/lib-commonjs/ResponsiveContainer.js +6 -0
- package/lib-commonjs/ResponsiveContainer.js.map +1 -0
- package/lib-commonjs/Sparkline.js +6 -0
- package/lib-commonjs/Sparkline.js.map +1 -0
- package/lib-commonjs/VerticalBarChart.js +6 -0
- package/lib-commonjs/VerticalBarChart.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +469 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js +6 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/ChartPopover.js +197 -0
- package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/ChartPopover.types.js +4 -0
- package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/index.js +9 -0
- package/lib-commonjs/components/CommonComponents/index.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +356 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +261 -0
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +158 -0
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js +10 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +445 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js +231 -0
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/index.js +6 -0
- package/lib-commonjs/components/DeclarativeChart/index.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Arc/Arc.js +117 -0
- package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Arc/Arc.types.js +4 -0
- package/lib-commonjs/components/DonutChart/Arc/Arc.types.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Arc/index.js +7 -0
- package/lib-commonjs/components/DonutChart/Arc/index.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +83 -0
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -0
- package/lib-commonjs/components/DonutChart/DonutChart.js +298 -0
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -0
- package/lib-commonjs/components/DonutChart/DonutChart.types.js +6 -0
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Pie/Pie.js +79 -0
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Pie/Pie.types.js +4 -0
- package/lib-commonjs/components/DonutChart/Pie/Pie.types.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Pie/index.js +7 -0
- package/lib-commonjs/components/DonutChart/Pie/index.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js +61 -0
- package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -0
- package/lib-commonjs/components/DonutChart/index.js +8 -0
- package/lib-commonjs/components/DonutChart/index.js.map +1 -0
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +82 -0
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +408 -0
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js +17 -0
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChart/index.js +8 -0
- package/lib-commonjs/components/HorizontalBarChart/index.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +251 -0
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Legends/Legends.js +313 -0
- package/lib-commonjs/components/Legends/Legends.js.map +1 -0
- package/lib-commonjs/components/Legends/Legends.types.js +6 -0
- package/lib-commonjs/components/Legends/Legends.types.js.map +1 -0
- package/lib-commonjs/components/Legends/OverflowMenu.js +36 -0
- package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -0
- package/lib-commonjs/components/Legends/index.js +8 -0
- package/lib-commonjs/components/Legends/index.js.map +1 -0
- package/lib-commonjs/components/Legends/shape.js +46 -0
- package/lib-commonjs/components/Legends/shape.js.map +1 -0
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +304 -0
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +1 -0
- package/lib-commonjs/components/LineChart/LineChart.js +1032 -0
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -0
- package/lib-commonjs/components/LineChart/LineChart.types.js +6 -0
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +129 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js +68 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +1 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js +51 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +1 -0
- package/lib-commonjs/components/LineChart/index.js +9 -0
- package/lib-commonjs/components/LineChart/index.js.map +1 -0
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +96 -0
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +76 -0
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -0
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js +6 -0
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -0
- package/lib-commonjs/components/ResponsiveContainer/index.js +6 -0
- package/lib-commonjs/components/ResponsiveContainer/index.js.map +1 -0
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js +47 -0
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Sparkline/Sparkline.js +125 -0
- package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -0
- package/lib-commonjs/components/Sparkline/Sparkline.types.js +7 -0
- package/lib-commonjs/components/Sparkline/Sparkline.types.js.map +1 -0
- package/lib-commonjs/components/Sparkline/index.js +8 -0
- package/lib-commonjs/components/Sparkline/index.js.map +1 -0
- package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js +77 -0
- package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js.map +1 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +851 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js +7 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -0
- package/lib-commonjs/components/VerticalBarChart/index.js +8 -0
- package/lib-commonjs/components/VerticalBarChart/index.js.map +1 -0
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +117 -0
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/index.js +17 -0
- package/lib-commonjs/index.js.map +1 -0
- package/lib-commonjs/types/DataPoint.js +6 -0
- package/lib-commonjs/types/DataPoint.js.map +1 -0
- package/lib-commonjs/types/EventAnnotation.js +6 -0
- package/lib-commonjs/types/EventAnnotation.js.map +1 -0
- package/lib-commonjs/types/LegendDataItem.js +4 -0
- package/lib-commonjs/types/LegendDataItem.js.map +1 -0
- package/lib-commonjs/types/index.js +7 -0
- package/lib-commonjs/types/index.js.map +1 -0
- package/lib-commonjs/utilities/FocusableTooltipText.js +75 -0
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -0
- package/lib-commonjs/utilities/KeyCodes.js +18 -0
- package/lib-commonjs/utilities/KeyCodes.js.map +1 -0
- package/lib-commonjs/utilities/SVGTooltipText.js +148 -0
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -0
- package/lib-commonjs/utilities/async-utils.js +382 -0
- package/lib-commonjs/utilities/async-utils.js.map +1 -0
- package/lib-commonjs/utilities/colors.js +270 -0
- package/lib-commonjs/utilities/colors.js.map +1 -0
- package/lib-commonjs/utilities/getWindow.js +28 -0
- package/lib-commonjs/utilities/getWindow.js.map +1 -0
- package/lib-commonjs/utilities/index.js +8 -0
- package/lib-commonjs/utilities/index.js.map +1 -0
- package/lib-commonjs/utilities/locale-util.js +25 -0
- package/lib-commonjs/utilities/locale-util.js.map +1 -0
- package/lib-commonjs/utilities/overflow-utils.js +36 -0
- package/lib-commonjs/utilities/overflow-utils.js.map +1 -0
- package/lib-commonjs/utilities/test-data.js +324 -0
- package/lib-commonjs/utilities/test-data.js.map +1 -0
- package/lib-commonjs/utilities/utilities.js +1184 -0
- package/lib-commonjs/utilities/utilities.js.map +1 -0
- package/lib-commonjs/utilities/vbc-utils.js +45 -0
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -0
- package/package.json +80 -72
- package/CHANGELOG.json +0 -65
- package/lib/chart/chart-legend.d.ts +0 -6
- package/lib/chart/chart-legend.js +0 -445
- package/lib/chart/chart-legend.js.map +0 -1
- package/lib/chart/chart-render.d.ts +0 -3
- package/lib/chart/chart-render.js +0 -50
- package/lib/chart/chart-render.js.map +0 -1
- package/lib/chart/chart.d.ts +0 -3
- package/lib/chart/chart.js +0 -10
- package/lib/chart/chart.js.map +0 -1
- package/lib/chart/index.d.ts +0 -1
- package/lib/chart/index.js +0 -2
- package/lib/chart/index.js.map +0 -1
- package/lib/index.d.ts +0 -7
- package/lib/lib/builder.d.ts +0 -89
- package/lib/lib/builder.js +0 -379
- package/lib/lib/builder.js.map +0 -1
- package/lib/lib/datasets.d.ts +0 -123
- package/lib/lib/datasets.js +0 -285
- package/lib/lib/datasets.js.map +0 -1
- package/lib/lib/patterns.d.ts +0 -43
- package/lib/lib/patterns.js +0 -433
- package/lib/lib/patterns.js.map +0 -1
- package/lib/lib/plugins.d.ts +0 -11
- package/lib/lib/plugins.js +0 -403
- package/lib/lib/plugins.js.map +0 -1
- package/lib/lib/settings.d.ts +0 -12
- package/lib/lib/settings.js +0 -368
- package/lib/lib/settings.js.map +0 -1
- package/lib/lib/storybook.d.ts +0 -11
- package/lib/lib/storybook.js +0 -13
- package/lib/lib/storybook.js.map +0 -1
- package/lib/lib/utils.d.ts +0 -34
- package/lib/lib/utils.js +0 -253
- package/lib/lib/utils.js.map +0 -1
- package/lib/types/index.d.ts +0 -1
- package/lib/types/types.d.ts +0 -101
- package/lib/types/types.js +0 -41
- package/lib/types/types.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/CommonComponents/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["CartesianChart.ts"],"sourcesContent":["export * from './components/CommonComponents/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,sCAAsC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/DeclarativeChart/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["DeclarativeChart.ts"],"sourcesContent":["export * from './components/DeclarativeChart/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,sCAAsC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/DonutChart/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["DonutChart.ts"],"sourcesContent":["export * from './components/DonutChart/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,gCAAgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/HorizontalBarChart/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["HorizontalBarChart.ts"],"sourcesContent":["export * from './components/HorizontalBarChart/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,wCAAwC"}
|
package/lib/Legends.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/Legends/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Legends.ts"],"sourcesContent":["export * from './components/Legends/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,6BAA6B"}
|
package/lib/LineChart.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/LineChart/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["LineChart.ts"],"sourcesContent":["export * from './components/LineChart/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,+BAA+B"}
|
package/lib/Popover.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/CommonComponents/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Popover.ts"],"sourcesContent":["export * from './components/CommonComponents/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,sCAAsC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/ResponsiveContainer/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ResponsiveContainer.ts"],"sourcesContent":["export * from './components/ResponsiveContainer/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,yCAAyC"}
|
package/lib/Sparkline.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/Sparkline/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Sparkline.ts"],"sourcesContent":["export * from './components/Sparkline/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,+BAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/VerticalBarChart/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["VerticalBarChart.ts"],"sourcesContent":["export * from './components/VerticalBarChart/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,sCAAsC"}
|
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useCartesianChartStyles } from './useCartesianChartStyles.styles';
|
|
3
|
+
import { createNumericXAxis, createStringXAxis, getDomainNRangeValues, createDateXAxis, createYAxis, createStringYAxis, getMinMaxOfYAxis, XAxisTypes, YAxisType, createWrapOfXLabels, rotateXAxisLabels, calculateLongestLabelWidth, createYAxisLabels, ChartTypes, wrapContent, useRtl } from '../../utilities/index';
|
|
4
|
+
import { SVGTooltipText } from '../../utilities/SVGTooltipText';
|
|
5
|
+
import { ChartPopover } from './ChartPopover';
|
|
6
|
+
import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
7
|
+
/**
|
|
8
|
+
* Cartesian Chart component
|
|
9
|
+
* {@docCategory CartesianChart}
|
|
10
|
+
*/ export const CartesianChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
11
|
+
var _props_margins, _props_margins1, _props_margins2, _props_margins3, _props_margins4, _props_margins5;
|
|
12
|
+
const chartContainer = React.useRef();
|
|
13
|
+
let legendContainer;
|
|
14
|
+
const minLegendContainerHeight = 40;
|
|
15
|
+
const xAxisElement = React.useRef();
|
|
16
|
+
const yAxisElement = React.useRef();
|
|
17
|
+
const yAxisElementSecondary = React.useRef();
|
|
18
|
+
let margins;
|
|
19
|
+
const idForGraph = 'chart_';
|
|
20
|
+
let _reqID;
|
|
21
|
+
const _useRtl = useRtl();
|
|
22
|
+
let _tickValues;
|
|
23
|
+
const titleMargin = 8;
|
|
24
|
+
const _isFirstRender = React.useRef(true);
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
+
let _xScale;
|
|
27
|
+
let isIntegralDataset = true;
|
|
28
|
+
const [containerWidth, setContainerWidth] = React.useState(0);
|
|
29
|
+
const [containerHeight, setContainerHeight] = React.useState(0);
|
|
30
|
+
const [isRemoveValCalculated, setIsRemoveValCalculated] = React.useState(true);
|
|
31
|
+
const [removalValueForTextTuncate, setRemovalValueForTextTuncate] = React.useState(0);
|
|
32
|
+
const [startFromX, setStartFromX] = React.useState(0);
|
|
33
|
+
const [prevProps, setPrevProps] = React.useState(null);
|
|
34
|
+
var _props_margins_top, _props_margins_bottom, _props_margins_left, _props_margins_right, _props_margins_right1, _props_margins_left1;
|
|
35
|
+
/**
|
|
36
|
+
* In RTL mode, Only graph will be rendered left/right. We need to provide left and right margins manually.
|
|
37
|
+
* So that, in RTL, left margins becomes right margins and viceversa.
|
|
38
|
+
* As graph needs to be drawn perfecty, these values consider as default values.
|
|
39
|
+
* Same margins using for all other cartesian charts. Can be accessible through 'getMargins' call back method.
|
|
40
|
+
*/ // eslint-disable-next-line prefer-const
|
|
41
|
+
margins = {
|
|
42
|
+
top: (_props_margins_top = (_props_margins = props.margins) === null || _props_margins === void 0 ? void 0 : _props_margins.top) !== null && _props_margins_top !== void 0 ? _props_margins_top : 20,
|
|
43
|
+
bottom: (_props_margins_bottom = (_props_margins1 = props.margins) === null || _props_margins1 === void 0 ? void 0 : _props_margins1.bottom) !== null && _props_margins_bottom !== void 0 ? _props_margins_bottom : 35,
|
|
44
|
+
right: _useRtl ? (_props_margins_left = (_props_margins2 = props.margins) === null || _props_margins2 === void 0 ? void 0 : _props_margins2.left) !== null && _props_margins_left !== void 0 ? _props_margins_left : 40 : ((_props_margins_right = (_props_margins3 = props.margins) === null || _props_margins3 === void 0 ? void 0 : _props_margins3.right) !== null && _props_margins_right !== void 0 ? _props_margins_right : props === null || props === void 0 ? void 0 : props.secondaryYScaleOptions) ? 40 : 20,
|
|
45
|
+
left: _useRtl ? ((_props_margins_right1 = (_props_margins4 = props.margins) === null || _props_margins4 === void 0 ? void 0 : _props_margins4.right) !== null && _props_margins_right1 !== void 0 ? _props_margins_right1 : props === null || props === void 0 ? void 0 : props.secondaryYScaleOptions) ? 40 : 20 : (_props_margins_left1 = (_props_margins5 = props.margins) === null || _props_margins5 === void 0 ? void 0 : _props_margins5.left) !== null && _props_margins_left1 !== void 0 ? _props_margins_left1 : 40
|
|
46
|
+
};
|
|
47
|
+
if (props.xAxisTitle !== undefined && props.xAxisTitle !== '') {
|
|
48
|
+
var _props_margins6;
|
|
49
|
+
var _props_margins_bottom1;
|
|
50
|
+
margins.bottom = (_props_margins_bottom1 = (_props_margins6 = props.margins) === null || _props_margins6 === void 0 ? void 0 : _props_margins6.bottom) !== null && _props_margins_bottom1 !== void 0 ? _props_margins_bottom1 : 55;
|
|
51
|
+
}
|
|
52
|
+
if (props.yAxisTitle !== undefined && props.yAxisTitle !== '') {
|
|
53
|
+
var _props_margins7, _props_margins8, _props_margins9, _props_margins10;
|
|
54
|
+
var _props_margins_right2, _props_margins_left2;
|
|
55
|
+
margins.left = _useRtl ? ((_props_margins_right2 = (_props_margins7 = props.margins) === null || _props_margins7 === void 0 ? void 0 : _props_margins7.right) !== null && _props_margins_right2 !== void 0 ? _props_margins_right2 : props === null || props === void 0 ? void 0 : props.secondaryYAxistitle) ? 60 : 40 : (_props_margins_left2 = (_props_margins8 = props.margins) === null || _props_margins8 === void 0 ? void 0 : _props_margins8.left) !== null && _props_margins_left2 !== void 0 ? _props_margins_left2 : 60;
|
|
56
|
+
var _props_margins_left3, _props_margins_right3;
|
|
57
|
+
margins.right = _useRtl ? (_props_margins_left3 = (_props_margins9 = props.margins) === null || _props_margins9 === void 0 ? void 0 : _props_margins9.left) !== null && _props_margins_left3 !== void 0 ? _props_margins_left3 : 60 : ((_props_margins_right3 = (_props_margins10 = props.margins) === null || _props_margins10 === void 0 ? void 0 : _props_margins10.right) !== null && _props_margins_right3 !== void 0 ? _props_margins_right3 : props === null || props === void 0 ? void 0 : props.secondaryYAxistitle) ? 60 : 40;
|
|
58
|
+
}
|
|
59
|
+
const classes = useCartesianChartStyles(props);
|
|
60
|
+
const focusAttributes = useFocusableGroup();
|
|
61
|
+
const arrowAttributes = useArrowNavigationGroup({
|
|
62
|
+
axis: 'horizontal'
|
|
63
|
+
});
|
|
64
|
+
// ComponentdidMount and Componentwillunmount logic
|
|
65
|
+
React.useEffect(()=>{
|
|
66
|
+
_fitParentContainer();
|
|
67
|
+
if (props !== null) {
|
|
68
|
+
setPrevProps(props);
|
|
69
|
+
}
|
|
70
|
+
if (props.chartType === ChartTypes.HorizontalBarChartWithAxis && props.showYAxisLables && yAxisElement.current) {
|
|
71
|
+
const maxYAxisLabelLength = calculateLongestLabelWidth(props.points.map((point)=>point.y), `.${classes.yAxis} text`);
|
|
72
|
+
if (startFromX !== maxYAxisLabelLength) {
|
|
73
|
+
setStartFromX(maxYAxisLabelLength);
|
|
74
|
+
}
|
|
75
|
+
} else if (startFromX !== 0) {
|
|
76
|
+
setStartFromX(0);
|
|
77
|
+
}
|
|
78
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
79
|
+
isIntegralDataset = !props.points.some((point)=>point.y % 1 !== 0);
|
|
80
|
+
return ()=>{
|
|
81
|
+
cancelAnimationFrame(_reqID);
|
|
82
|
+
};
|
|
83
|
+
}, [
|
|
84
|
+
props
|
|
85
|
+
]);
|
|
86
|
+
// ComponentDidUpdate logic
|
|
87
|
+
React.useEffect(()=>{
|
|
88
|
+
if (prevProps) {
|
|
89
|
+
if (prevProps.height !== props.height || prevProps.width !== props.width) {
|
|
90
|
+
_fitParentContainer();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (props.chartType === ChartTypes.HorizontalBarChartWithAxis && props.showYAxisLables && yAxisElement.current) {
|
|
94
|
+
const maxYAxisLabelLength = calculateLongestLabelWidth(props.points.map((point)=>point.y), `.${classes.yAxis} text`);
|
|
95
|
+
if (startFromX !== maxYAxisLabelLength) {
|
|
96
|
+
setStartFromX(maxYAxisLabelLength);
|
|
97
|
+
}
|
|
98
|
+
} else if (startFromX !== 0) {
|
|
99
|
+
setStartFromX(0);
|
|
100
|
+
}
|
|
101
|
+
if (prevProps !== null && prevProps.points !== props.points) {
|
|
102
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
103
|
+
isIntegralDataset = !props.points.some((point)=>point.y % 1 !== 0);
|
|
104
|
+
}
|
|
105
|
+
}, [
|
|
106
|
+
props,
|
|
107
|
+
prevProps
|
|
108
|
+
]);
|
|
109
|
+
React.useEffect(()=>{
|
|
110
|
+
if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType === XAxisTypes.StringAxis) {
|
|
111
|
+
const rotateLabelProps = {
|
|
112
|
+
node: xAxisElement.current,
|
|
113
|
+
xAxis: _xScale
|
|
114
|
+
};
|
|
115
|
+
const rotatedHeight = rotateXAxisLabels(rotateLabelProps);
|
|
116
|
+
if (isRemoveValCalculated && removalValueForTextTuncate !== rotatedHeight + margins.bottom && rotatedHeight > 0) {
|
|
117
|
+
setRemovalValueForTextTuncate(rotatedHeight + margins.bottom);
|
|
118
|
+
setIsRemoveValCalculated(false);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
React.useImperativeHandle(props.componentRef, ()=>{
|
|
123
|
+
var _chartContainer_current;
|
|
124
|
+
return {
|
|
125
|
+
chartContainer: (_chartContainer_current = chartContainer.current) !== null && _chartContainer_current !== void 0 ? _chartContainer_current : null
|
|
126
|
+
};
|
|
127
|
+
}, []);
|
|
128
|
+
/**
|
|
129
|
+
* Dedicated function to return the Callout JSX Element , which can further be used to only call this when
|
|
130
|
+
* only the calloutprops and charthover props changes.
|
|
131
|
+
* @param calloutProps
|
|
132
|
+
* @param chartHoverProps
|
|
133
|
+
* @returns
|
|
134
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
135
|
+
function _generateCallout(calloutProps) {
|
|
136
|
+
return /*#__PURE__*/ React.createElement(ChartPopover, calloutProps);
|
|
137
|
+
}
|
|
138
|
+
const { calloutProps, points, chartType, svgProps, culture, dateLocalizeOptions, timeFormatLocale, customDateTimeFormatter } = props;
|
|
139
|
+
if (props.parentRef) {
|
|
140
|
+
_fitParentContainer();
|
|
141
|
+
}
|
|
142
|
+
const margin = {
|
|
143
|
+
...margins
|
|
144
|
+
};
|
|
145
|
+
if (props.chartType === ChartTypes.HorizontalBarChartWithAxis) {
|
|
146
|
+
if (!_useRtl) {
|
|
147
|
+
margin.left += startFromX;
|
|
148
|
+
} else {
|
|
149
|
+
margin.right += startFromX;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// Callback for margins to the chart
|
|
153
|
+
props.getmargins && props.getmargins(margin);
|
|
154
|
+
let callout = null;
|
|
155
|
+
let children = null;
|
|
156
|
+
if (props.enableFirstRenderOptimization && chartContainer.current || !props.enableFirstRenderOptimization) {
|
|
157
|
+
_isFirstRender.current = false;
|
|
158
|
+
const XAxisParams = {
|
|
159
|
+
domainNRangeValues: getDomainNRangeValues(points, props.getDomainMargins ? props.getDomainMargins(containerWidth) : margins, containerWidth, chartType, _useRtl, props.xAxisType, props.barwidth, props.tickValues, // This is only used for Horizontal Bar Chart with Axis for y as string axis
|
|
160
|
+
startFromX),
|
|
161
|
+
containerHeight: containerHeight - removalValueForTextTuncate,
|
|
162
|
+
margins: margins,
|
|
163
|
+
xAxisElement: xAxisElement.current,
|
|
164
|
+
showRoundOffXTickValues: true,
|
|
165
|
+
xAxisCount: props.xAxisTickCount,
|
|
166
|
+
xAxistickSize: props.xAxistickSize,
|
|
167
|
+
tickPadding: props.tickPadding || props.showXAxisLablesTooltip ? 5 : 10,
|
|
168
|
+
xAxisPadding: props.xAxisPadding,
|
|
169
|
+
xAxisInnerPadding: props.xAxisInnerPadding,
|
|
170
|
+
xAxisOuterPadding: props.xAxisOuterPadding,
|
|
171
|
+
containerWidth: containerWidth,
|
|
172
|
+
hideTickOverlap: props.hideTickOverlap && !props.rotateXAxisLables && !props.showXAxisLablesTooltip && !props.wrapXAxisLables
|
|
173
|
+
};
|
|
174
|
+
const YAxisParams = {
|
|
175
|
+
margins: margins,
|
|
176
|
+
containerWidth: containerWidth,
|
|
177
|
+
containerHeight: containerHeight - removalValueForTextTuncate,
|
|
178
|
+
yAxisElement: yAxisElement.current,
|
|
179
|
+
yAxisTickFormat: props.yAxisTickFormat,
|
|
180
|
+
yAxisTickCount: props.yAxisTickCount,
|
|
181
|
+
yMinValue: props.yMinValue || 0,
|
|
182
|
+
yMaxValue: props.yMaxValue || 0,
|
|
183
|
+
tickPadding: 10,
|
|
184
|
+
maxOfYVal: props.maxOfYVal,
|
|
185
|
+
yMinMaxValues: getMinMaxOfYAxis(points, chartType, props.yAxisType),
|
|
186
|
+
// please note these padding default values must be consistent in here
|
|
187
|
+
// and the parent chart(HBWA/Vertical etc..) for more details refer example
|
|
188
|
+
// http://using-d3js.com/04_07_ordinal_scales.html
|
|
189
|
+
yAxisPadding: props.yAxisPadding || 0
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* These scales used for 2 purposes.
|
|
193
|
+
* 1. To create x and y axis
|
|
194
|
+
* 2. To draw the graph.
|
|
195
|
+
* For area/line chart using same scales. For other charts, creating their own scales to draw the graph.
|
|
196
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
197
|
+
let xScale;
|
|
198
|
+
let tickValues;
|
|
199
|
+
switch(props.xAxisType){
|
|
200
|
+
case XAxisTypes.NumericAxis:
|
|
201
|
+
({ xScale, tickValues } = createNumericXAxis(XAxisParams, props.tickParams, props.chartType, culture));
|
|
202
|
+
break;
|
|
203
|
+
case XAxisTypes.DateAxis:
|
|
204
|
+
({ xScale, tickValues } = createDateXAxis(XAxisParams, props.tickParams, culture, dateLocalizeOptions, timeFormatLocale, customDateTimeFormatter, props.useUTC));
|
|
205
|
+
break;
|
|
206
|
+
case XAxisTypes.StringAxis:
|
|
207
|
+
({ xScale, tickValues } = createStringXAxis(XAxisParams, props.tickParams, props.datasetForXAxisDomain, culture));
|
|
208
|
+
break;
|
|
209
|
+
default:
|
|
210
|
+
({ xScale, tickValues } = createNumericXAxis(XAxisParams, props.tickParams, props.chartType, culture));
|
|
211
|
+
}
|
|
212
|
+
_xScale = xScale;
|
|
213
|
+
_tickValues = tickValues;
|
|
214
|
+
/*
|
|
215
|
+
* To enable wrapping of x axis tick values or to display complete x axis tick values,
|
|
216
|
+
* we need to calculate how much space it needed to render the text.
|
|
217
|
+
* No need to re-calculate every time the chart renders and same time need to get an update. So using set
|
|
218
|
+
* Required space will be calculated first time chart rendering and if any width/height of chart updated.
|
|
219
|
+
* */ if (props.wrapXAxisLables || props.showXAxisLablesTooltip) {
|
|
220
|
+
const wrapLabelProps = {
|
|
221
|
+
node: xAxisElement.current,
|
|
222
|
+
xAxis: xScale,
|
|
223
|
+
showXAxisLablesTooltip: props.showXAxisLablesTooltip || false,
|
|
224
|
+
noOfCharsToTruncate: props.noOfCharsToTruncate || 4
|
|
225
|
+
};
|
|
226
|
+
const temp = xScale && createWrapOfXLabels(wrapLabelProps);
|
|
227
|
+
// this value need to be updated for draw graph updated. So instead of using private value, using set
|
|
228
|
+
if (isRemoveValCalculated && removalValueForTextTuncate !== temp) {
|
|
229
|
+
setRemovalValueForTextTuncate(temp);
|
|
230
|
+
setIsRemoveValCalculated(false);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* These scales used for 2 purposes.
|
|
235
|
+
* 1. To create x and y axis
|
|
236
|
+
* 2. To draw the graph.
|
|
237
|
+
* For area/line chart using same scales. For other charts, creating their own scales to draw the graph.
|
|
238
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
239
|
+
let yScale;
|
|
240
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
241
|
+
let yScaleSecondary;
|
|
242
|
+
const axisData = {
|
|
243
|
+
yAxisDomainValues: []
|
|
244
|
+
};
|
|
245
|
+
if (props.yAxisType && props.yAxisType === YAxisType.StringAxis) {
|
|
246
|
+
yScale = createStringYAxis(YAxisParams, props.stringDatasetForYAxisDomain, _useRtl, props.chartType, props.barwidth, culture);
|
|
247
|
+
} else {
|
|
248
|
+
if (props === null || props === void 0 ? void 0 : props.secondaryYScaleOptions) {
|
|
249
|
+
var _props_secondaryYScaleOptions, _props_secondaryYScaleOptions1, _props_secondaryYScaleOptions2;
|
|
250
|
+
var _props_secondaryYScaleOptions_yMaxValue, _props_secondaryYScaleOptions_yMaxValue1;
|
|
251
|
+
const YAxisParamsSecondary = {
|
|
252
|
+
margins: margins,
|
|
253
|
+
containerWidth: containerWidth,
|
|
254
|
+
containerHeight: containerHeight - removalValueForTextTuncate,
|
|
255
|
+
yAxisElement: yAxisElementSecondary.current,
|
|
256
|
+
yAxisTickFormat: props.yAxisTickFormat,
|
|
257
|
+
yAxisTickCount: props.yAxisTickCount,
|
|
258
|
+
yMinValue: ((_props_secondaryYScaleOptions = props.secondaryYScaleOptions) === null || _props_secondaryYScaleOptions === void 0 ? void 0 : _props_secondaryYScaleOptions.yMinValue) || 0,
|
|
259
|
+
yMaxValue: (_props_secondaryYScaleOptions_yMaxValue = (_props_secondaryYScaleOptions1 = props.secondaryYScaleOptions) === null || _props_secondaryYScaleOptions1 === void 0 ? void 0 : _props_secondaryYScaleOptions1.yMaxValue) !== null && _props_secondaryYScaleOptions_yMaxValue !== void 0 ? _props_secondaryYScaleOptions_yMaxValue : 100,
|
|
260
|
+
tickPadding: 10,
|
|
261
|
+
maxOfYVal: (_props_secondaryYScaleOptions_yMaxValue1 = (_props_secondaryYScaleOptions2 = props.secondaryYScaleOptions) === null || _props_secondaryYScaleOptions2 === void 0 ? void 0 : _props_secondaryYScaleOptions2.yMaxValue) !== null && _props_secondaryYScaleOptions_yMaxValue1 !== void 0 ? _props_secondaryYScaleOptions_yMaxValue1 : 100,
|
|
262
|
+
yMinMaxValues: getMinMaxOfYAxis(points, chartType),
|
|
263
|
+
yAxisPadding: props.yAxisPadding
|
|
264
|
+
};
|
|
265
|
+
yScaleSecondary = createYAxis(YAxisParamsSecondary, _useRtl, axisData, chartType, props.barwidth, isIntegralDataset, true);
|
|
266
|
+
}
|
|
267
|
+
yScale = createYAxis(YAxisParams, _useRtl, axisData, chartType, props.barwidth, isIntegralDataset);
|
|
268
|
+
}
|
|
269
|
+
/*
|
|
270
|
+
* To create y axis tick values by if specified
|
|
271
|
+
truncating the rest of the text and showing elipsis
|
|
272
|
+
or showing the whole string,
|
|
273
|
+
* */ props.chartType === ChartTypes.HorizontalBarChartWithAxis && yScale && createYAxisLabels(yAxisElement.current, yScale, props.noOfCharsToTruncate || 4, props.showYAxisLablesTooltip || false, startFromX, _useRtl);
|
|
274
|
+
// Call back to the chart.
|
|
275
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
276
|
+
const _getData = (xScale, yScale)=>{
|
|
277
|
+
props.getGraphData && props.getGraphData(xScale, yScale, containerHeight - removalValueForTextTuncate, containerWidth, xAxisElement.current, yAxisElement.current);
|
|
278
|
+
};
|
|
279
|
+
props.getAxisData && props.getAxisData(axisData);
|
|
280
|
+
// Callback function for chart, returns axis
|
|
281
|
+
_getData(xScale, yScale);
|
|
282
|
+
children = props.children({
|
|
283
|
+
xScale,
|
|
284
|
+
yScale,
|
|
285
|
+
yScaleSecondary,
|
|
286
|
+
containerHeight,
|
|
287
|
+
containerWidth
|
|
288
|
+
});
|
|
289
|
+
if (!props.hideTooltip && calloutProps.isPopoverOpen) {
|
|
290
|
+
callout = _generateCallout(calloutProps);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
const svgDimensions = {
|
|
294
|
+
width: containerWidth,
|
|
295
|
+
height: containerHeight
|
|
296
|
+
};
|
|
297
|
+
const xAxisTitleMaximumAllowedWidth = svgDimensions.width - margins.left - margins.right - startFromX;
|
|
298
|
+
const yAxisTitleMaximumAllowedHeight = svgDimensions.height - margins.bottom - margins.top - removalValueForTextTuncate - titleMargin;
|
|
299
|
+
/**
|
|
300
|
+
* When screen resizes, along with screen, chart also auto adjusted.
|
|
301
|
+
* This method used to adjust height and width of the charts.
|
|
302
|
+
*/ function _fitParentContainer() {
|
|
303
|
+
//_reqID = requestAnimationFrame(() => {
|
|
304
|
+
let legendContainerHeight;
|
|
305
|
+
if (props.hideLegend) {
|
|
306
|
+
// If there is no legend, need not to allocate some space from total chart space.
|
|
307
|
+
legendContainerHeight = 0;
|
|
308
|
+
} else {
|
|
309
|
+
const legendContainerComputedStyles = legendContainer && getComputedStyle(legendContainer);
|
|
310
|
+
legendContainerHeight = (legendContainer && legendContainer.getBoundingClientRect().height || minLegendContainerHeight) + parseFloat(legendContainerComputedStyles && legendContainerComputedStyles.marginTop || '0') + parseFloat(legendContainerComputedStyles && legendContainerComputedStyles.marginBottom || '0');
|
|
311
|
+
}
|
|
312
|
+
if (props.parentRef || chartContainer.current) {
|
|
313
|
+
var _props_reflowProps;
|
|
314
|
+
const container = props.parentRef ? props.parentRef : chartContainer.current;
|
|
315
|
+
const currentContainerWidth = ((_props_reflowProps = props.reflowProps) === null || _props_reflowProps === void 0 ? void 0 : _props_reflowProps.mode) === 'min-width' && !_isFirstRender.current ? Math.max(container.getBoundingClientRect().width, _calculateChartMinWidth()) : container.getBoundingClientRect().width;
|
|
316
|
+
const currentContainerHeight = container.getBoundingClientRect().height > legendContainerHeight ? container.getBoundingClientRect().height : 350;
|
|
317
|
+
const shouldResize = containerWidth !== currentContainerWidth || containerHeight !== currentContainerHeight - legendContainerHeight;
|
|
318
|
+
if (shouldResize) {
|
|
319
|
+
setContainerWidth(currentContainerWidth);
|
|
320
|
+
setContainerHeight(currentContainerHeight - legendContainerHeight);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
//});
|
|
324
|
+
}
|
|
325
|
+
function _onChartLeave() {
|
|
326
|
+
props.onChartMouseLeave && props.onChartMouseLeave();
|
|
327
|
+
}
|
|
328
|
+
function _calculateChartMinWidth() {
|
|
329
|
+
let labelWidth = 10; // Total padding on the left and right sides of the label
|
|
330
|
+
// Case: rotated labels
|
|
331
|
+
if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType === XAxisTypes.StringAxis) {
|
|
332
|
+
const longestLabelWidth = calculateLongestLabelWidth(_tickValues, `.${classes.xAxis} text`);
|
|
333
|
+
labelWidth += Math.ceil(longestLabelWidth * Math.cos(Math.PI / 4));
|
|
334
|
+
} else if (props.showXAxisLablesTooltip) {
|
|
335
|
+
const tickValues = _tickValues.map((val)=>{
|
|
336
|
+
const numChars = props.noOfCharsToTruncate || 4;
|
|
337
|
+
return val.toString().length > numChars ? `${val.toString().slice(0, numChars)}...` : val;
|
|
338
|
+
});
|
|
339
|
+
const longestLabelWidth = calculateLongestLabelWidth(tickValues, `.${classes.xAxis} text`);
|
|
340
|
+
labelWidth += Math.ceil(longestLabelWidth);
|
|
341
|
+
} else if (props.wrapXAxisLables) {
|
|
342
|
+
const words = [];
|
|
343
|
+
_tickValues.forEach((val)=>{
|
|
344
|
+
words.push(...val.toString().split(/\s+/));
|
|
345
|
+
});
|
|
346
|
+
const longestLabelWidth = calculateLongestLabelWidth(words, `.${classes.xAxis} text`);
|
|
347
|
+
labelWidth += Math.max(Math.ceil(longestLabelWidth), 10);
|
|
348
|
+
} else {
|
|
349
|
+
const longestLabelWidth = calculateLongestLabelWidth(_tickValues, `.${classes.xAxis} text`);
|
|
350
|
+
labelWidth += Math.ceil(longestLabelWidth);
|
|
351
|
+
}
|
|
352
|
+
let minChartWidth = margins.left + margins.right + labelWidth * (_tickValues.length - 1);
|
|
353
|
+
if ([
|
|
354
|
+
ChartTypes.GroupedVerticalBarChart,
|
|
355
|
+
ChartTypes.VerticalBarChart,
|
|
356
|
+
ChartTypes.VerticalStackedBarChart
|
|
357
|
+
].includes(props.chartType)) {
|
|
358
|
+
const minDomainMargin = 8;
|
|
359
|
+
minChartWidth += minDomainMargin * 2;
|
|
360
|
+
}
|
|
361
|
+
return minChartWidth;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* We have use the {@link defaultTabbableElement } to fix
|
|
365
|
+
* the Focus not landing on chart while tabbing, instead goes to legend.
|
|
366
|
+
* This issue is observed in Area, line chart after performance optimization done in the PR {@link https://github.com/microsoft/fluentui/pull/27721 }
|
|
367
|
+
* This issue is observed in Bar charts after the changes done by FocusZone team in the PR: {@link https://github.com/microsoft/fluentui/pull/24175 }
|
|
368
|
+
* The issue in Bar Charts(VB and VSB) is due to a {@link FocusZone } update where previously an event listener was
|
|
369
|
+
* attached on keydown to the window, so that whenever the tab key is pressed all outer FocusZone's
|
|
370
|
+
* tab-indexes are updated (an outer FocusZone is a FocusZone that is not within another one).
|
|
371
|
+
* But now after the above PR : they are attaching the
|
|
372
|
+
* listeners to the FocusZone elements instead of the window. So in the first render cycle in Bar charts
|
|
373
|
+
* bars are not created as in the first render cycle the size of the chart container is not known( or is 0)
|
|
374
|
+
* which creates bars of height 0 so instead we do not create any bars and instead return empty fragments.
|
|
375
|
+
*
|
|
376
|
+
* We have tried 2 Approaches to fix the issue:
|
|
377
|
+
* 1. Using the {@link elementRef} property of FocusZone where we dispatch event for tab keydown
|
|
378
|
+
* after the second render cycle which triggers an update of the tab index in FocusZone.
|
|
379
|
+
* But this is a hacky solution and not a proper fix and also elementRef is deprecated.
|
|
380
|
+
* 2. Using the default tabbable element to fix the issue.
|
|
381
|
+
*/ return /*#__PURE__*/ React.createElement("div", {
|
|
382
|
+
id: idForGraph,
|
|
383
|
+
className: classes.root,
|
|
384
|
+
role: 'presentation',
|
|
385
|
+
ref: (rootElem)=>chartContainer.current = rootElem,
|
|
386
|
+
onMouseLeave: _onChartLeave
|
|
387
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
388
|
+
className: classes.chartWrapper,
|
|
389
|
+
...focusAttributes,
|
|
390
|
+
...arrowAttributes
|
|
391
|
+
}, _isFirstRender.current, /*#__PURE__*/ React.createElement("svg", {
|
|
392
|
+
width: svgDimensions.width,
|
|
393
|
+
height: svgDimensions.height,
|
|
394
|
+
"aria-label": props.chartTitle,
|
|
395
|
+
style: {
|
|
396
|
+
display: 'block'
|
|
397
|
+
},
|
|
398
|
+
...svgProps
|
|
399
|
+
}, /*#__PURE__*/ React.createElement("g", {
|
|
400
|
+
ref: (e)=>{
|
|
401
|
+
xAxisElement.current = e;
|
|
402
|
+
},
|
|
403
|
+
id: `xAxisGElement${idForGraph}`,
|
|
404
|
+
// To add wrap of x axis lables feature, need to remove word height from svg height.
|
|
405
|
+
transform: `translate(0, ${svgDimensions.height - margins.bottom - removalValueForTextTuncate})`,
|
|
406
|
+
className: classes.xAxis
|
|
407
|
+
}), props.xAxisTitle !== undefined && props.xAxisTitle !== '' && /*#__PURE__*/ React.createElement(SVGTooltipText, {
|
|
408
|
+
content: props.xAxisTitle,
|
|
409
|
+
textProps: {
|
|
410
|
+
x: margins.left + startFromX + xAxisTitleMaximumAllowedWidth / 2,
|
|
411
|
+
y: svgDimensions.height - titleMargin,
|
|
412
|
+
className: classes.axisTitle,
|
|
413
|
+
textAnchor: 'middle'
|
|
414
|
+
},
|
|
415
|
+
maxWidth: xAxisTitleMaximumAllowedWidth,
|
|
416
|
+
wrapContent: wrapContent
|
|
417
|
+
}), /*#__PURE__*/ React.createElement("g", {
|
|
418
|
+
ref: (e)=>{
|
|
419
|
+
yAxisElement.current = e;
|
|
420
|
+
},
|
|
421
|
+
id: `yAxisGElement${idForGraph}`,
|
|
422
|
+
transform: `translate(${_useRtl ? svgDimensions.width - margins.right - startFromX : margins.left + startFromX}, 0)`,
|
|
423
|
+
className: classes.yAxis
|
|
424
|
+
}), props.secondaryYScaleOptions && /*#__PURE__*/ React.createElement("g", null, /*#__PURE__*/ React.createElement("g", {
|
|
425
|
+
ref: (e)=>{
|
|
426
|
+
yAxisElementSecondary.current = e;
|
|
427
|
+
},
|
|
428
|
+
id: `yAxisGElementSecondary${idForGraph}`,
|
|
429
|
+
transform: `translate(${_useRtl ? margins.left : svgDimensions.width - margins.right}, 0)`,
|
|
430
|
+
className: classes.yAxis
|
|
431
|
+
}), props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '' && /*#__PURE__*/ React.createElement(SVGTooltipText, {
|
|
432
|
+
content: props.secondaryYAxistitle,
|
|
433
|
+
textProps: {
|
|
434
|
+
x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + removalValueForTextTuncate,
|
|
435
|
+
y: _useRtl ? startFromX - titleMargin : svgDimensions.width - margins.right,
|
|
436
|
+
textAnchor: 'middle',
|
|
437
|
+
transform: `translate(${_useRtl ? margins.right / 2 - titleMargin : margins.right / 2 + titleMargin},
|
|
438
|
+
${svgDimensions.height - margins.bottom - margins.top - titleMargin})rotate(-90)`,
|
|
439
|
+
className: classes.axisTitle
|
|
440
|
+
},
|
|
441
|
+
maxWidth: yAxisTitleMaximumAllowedHeight,
|
|
442
|
+
wrapContent: wrapContent
|
|
443
|
+
})), children, props.yAxisTitle !== undefined && props.yAxisTitle !== '' && /*#__PURE__*/ React.createElement(SVGTooltipText, {
|
|
444
|
+
content: props.yAxisTitle,
|
|
445
|
+
textProps: {
|
|
446
|
+
x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + removalValueForTextTuncate,
|
|
447
|
+
y: _useRtl ? svgDimensions.width - margins.right / 2 + titleMargin : margins.left / 2 + startFromX - titleMargin,
|
|
448
|
+
textAnchor: 'middle',
|
|
449
|
+
transform: `translate(0,
|
|
450
|
+
${svgDimensions.height - margins.bottom - margins.top - titleMargin})rotate(-90)`,
|
|
451
|
+
className: classes.axisTitle
|
|
452
|
+
},
|
|
453
|
+
maxWidth: yAxisTitleMaximumAllowedHeight,
|
|
454
|
+
wrapContent: wrapContent
|
|
455
|
+
}))), !props.hideLegend && /*#__PURE__*/ React.createElement("div", {
|
|
456
|
+
ref: (e)=>legendContainer = e,
|
|
457
|
+
className: classes.legendContainer
|
|
458
|
+
}, props.legendBars), callout && /*#__PURE__*/ React.createElement(React.Suspense, {
|
|
459
|
+
fallback: /*#__PURE__*/ React.createElement("div", null, "Loading...")
|
|
460
|
+
}, callout));
|
|
461
|
+
});
|
|
462
|
+
CartesianChart.displayName = 'CartesianChart';
|