@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,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
donutClassNames: function() {
|
|
13
|
+
return donutClassNames;
|
|
14
|
+
},
|
|
15
|
+
useDonutChartStyles: function() {
|
|
16
|
+
return useDonutChartStyles;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _react = require("@griffel/react");
|
|
20
|
+
const donutClassNames = {
|
|
21
|
+
root: 'fui-donut__root',
|
|
22
|
+
chart: 'fui-donut__chart',
|
|
23
|
+
legendContainer: 'fui-donut__legendContainer',
|
|
24
|
+
chartWrapper: 'fui-donut__chartWrapper'
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Base Styles
|
|
28
|
+
*/ const useStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
29
|
+
root: {
|
|
30
|
+
Bahqtrf: "fk6fouc",
|
|
31
|
+
Be2twd7: "fkhj508",
|
|
32
|
+
Bhrd7zp: "figsok6",
|
|
33
|
+
Bg96gwp: "f1i3iumi",
|
|
34
|
+
mc9l5x: "f22iagw",
|
|
35
|
+
Beiy3e4: "f1vx9l62",
|
|
36
|
+
a9b677: "fly5x3f",
|
|
37
|
+
Bqenvij: "f1l02sjl"
|
|
38
|
+
},
|
|
39
|
+
chart: {
|
|
40
|
+
B7ck84d: "f1e4lqlz",
|
|
41
|
+
ek0pe7: "fzm18in",
|
|
42
|
+
mc9l5x: "ftgm304",
|
|
43
|
+
B68tc82: 0,
|
|
44
|
+
Bmxbyg5: 0,
|
|
45
|
+
Bpg54ce: "f1gl81tg"
|
|
46
|
+
},
|
|
47
|
+
legendContainer: {
|
|
48
|
+
z8tnut: "fikn0iw"
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
d: [
|
|
52
|
+
".fk6fouc{font-family:var(--fontFamilyBase);}",
|
|
53
|
+
".fkhj508{font-size:var(--fontSizeBase300);}",
|
|
54
|
+
".figsok6{font-weight:var(--fontWeightRegular);}",
|
|
55
|
+
".f1i3iumi{line-height:var(--lineHeightBase300);}",
|
|
56
|
+
".f22iagw{display:flex;}",
|
|
57
|
+
".f1vx9l62{flex-direction:column;}",
|
|
58
|
+
".fly5x3f{width:100%;}",
|
|
59
|
+
".f1l02sjl{height:100%;}",
|
|
60
|
+
".f1e4lqlz{box-sizing:content-box;}",
|
|
61
|
+
".fzm18in{alignment-adjust:center;}",
|
|
62
|
+
".ftgm304{display:block;}",
|
|
63
|
+
[
|
|
64
|
+
".f1gl81tg{overflow:visible;}",
|
|
65
|
+
{
|
|
66
|
+
p: -1
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
".fikn0iw{padding-top:var(--spacingVerticalL);}"
|
|
70
|
+
]
|
|
71
|
+
});
|
|
72
|
+
const useDonutChartStyles = (props)=>{
|
|
73
|
+
var _props_styles, _props_styles1, _props_styles2;
|
|
74
|
+
const { className } = props;
|
|
75
|
+
const baseStyles = useStyles();
|
|
76
|
+
return {
|
|
77
|
+
root: (0, _react.mergeClasses)(donutClassNames.root, baseStyles.root, className, (_props_styles = props.styles) === null || _props_styles === void 0 ? void 0 : _props_styles.root),
|
|
78
|
+
chart: (0, _react.mergeClasses)(donutClassNames.chart, baseStyles.chart, (_props_styles1 = props.styles) === null || _props_styles1 === void 0 ? void 0 : _props_styles1.chart),
|
|
79
|
+
legendContainer: (0, _react.mergeClasses)(donutClassNames.legendContainer, baseStyles.legendContainer, (_props_styles2 = props.styles) === null || _props_styles2 === void 0 ? void 0 : _props_styles2.legendContainer),
|
|
80
|
+
chartWrapper: donutClassNames.chartWrapper
|
|
81
|
+
};
|
|
82
|
+
}; //# sourceMappingURL=useDonutChartStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useDonutChartStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\n/**\n * @internal\n */ export const donutClassNames = {\n root: 'fui-donut__root',\n chart: 'fui-donut__chart',\n legendContainer: 'fui-donut__legendContainer',\n chartWrapper: 'fui-donut__chartWrapper'\n};\n/**\n * Base Styles\n */ const useStyles = makeStyles({\n root: {\n // alignItems: 'center',\n ...typographyStyles.body1,\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n height: '100%'\n },\n chart: {\n boxSizing: 'content-box',\n alignmentAdjust: 'center',\n display: 'block',\n overflow: 'visible'\n },\n legendContainer: {\n paddingTop: tokens.spacingVerticalL\n }\n});\n/**\n * Apply styling to the DonutChart component\n */ export const useDonutChartStyles = (props)=>{\n var _props_styles, _props_styles1, _props_styles2;\n const { className } = props;\n const baseStyles = useStyles();\n return {\n root: mergeClasses(donutClassNames.root, baseStyles.root, className, (_props_styles = props.styles) === null || _props_styles === void 0 ? void 0 : _props_styles.root),\n chart: mergeClasses(donutClassNames.chart, baseStyles.chart, (_props_styles1 = props.styles) === null || _props_styles1 === void 0 ? void 0 : _props_styles1.chart),\n legendContainer: mergeClasses(donutClassNames.legendContainer, baseStyles.legendContainer, (_props_styles2 = props.styles) === null || _props_styles2 === void 0 ? void 0 : _props_styles2.legendContainer),\n chartWrapper: donutClassNames.chartWrapper\n };\n};\n"],"names":["donutClassNames","useDonutChartStyles","root","chart","legendContainer","chartWrapper","useStyles","__styles","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","mc9l5x","Beiy3e4","a9b677","Bqenvij","B7ck84d","ek0pe7","B68tc82","Bmxbyg5","Bpg54ce","z8tnut","d","p","props","_props_styles","_props_styles1","_props_styles2","className","baseStyles","mergeClasses","styles"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIiBA,eAAe;eAAfA;;IA6BAC,mBAAmB;eAAnBA;;;uBAjCwB;AAI9B,MAAMD,kBAAkB;IAC/BE,MAAM;IACNC,OAAO;IACPC,iBAAiB;IACjBC,cAAc;AAClB;AACA;;CAEA,GAAI,MAAMC,YAAS,WAAA,GAAGC,IAAAA,eAAA,EAAA;IAAAL,MAAA;QAAAM,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,QAAA;QAAAC,SAAA;IAAA;IAAAZ,OAAA;QAAAa,SAAA;QAAAC,QAAA;QAAAL,QAAA;QAAAM,SAAA;QAAAC,SAAA;QAAAC,SAAA;IAAA;IAAAhB,iBAAA;QAAAiB,QAAA;IAAA;AAAA,GAAA;IAAAC,GAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;YAAA;YAAA;gBAAAC,GAAA,CAAA;YAAA;SAAA;QAAA;KAAA;AAAA;AAqBX,MAAMtB,sBAAuBuB,CAAAA;IACpC,IAAIC,eAAeC,gBAAgBC;IACnC,MAAM,EAAEC,SAAAA,EAAW,GAAGJ;IACtB,MAAMK,aAAavB;IACnB,OAAO;QACHJ,MAAM4B,IAAAA,mBAAY,EAAC9B,gBAAgBE,IAAI,EAAE2B,WAAW3B,IAAI,EAAE0B,WAAW,AAACH,CAAAA,gBAAgBD,MAAMO,MAAM,AAANA,MAAY,QAAQN,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcvB,IAAI;QACtKC,OAAO2B,IAAAA,mBAAY,EAAC9B,gBAAgBG,KAAK,EAAE0B,WAAW1B,KAAK,EAAE,AAACuB,CAAAA,iBAAiBF,MAAMO,MAAM,AAANA,MAAY,QAAQL,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAevB,KAAK;QAClKC,iBAAiB0B,IAAAA,mBAAY,EAAC9B,gBAAgBI,eAAe,EAAEyB,WAAWzB,eAAe,EAAE,AAACuB,CAAAA,iBAAiBH,MAAMO,MAAM,AAANA,MAAY,QAAQJ,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAevB,eAAe;QAC1MC,cAAcL,gBAAgBK,YAAAA;IAClC;AACJ"}
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "HorizontalBarChart", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return HorizontalBarChart;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _useHorizontalBarChartStylesstyles = require("./useHorizontalBarChartStyles.styles");
|
|
14
|
+
const _index = require("./index");
|
|
15
|
+
const _localeutil = require("../../utilities/locale-util");
|
|
16
|
+
const _index1 = require("../../utilities/index");
|
|
17
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
|
18
|
+
const _reacttheme = require("@fluentui/react-theme");
|
|
19
|
+
const _reacttabster = require("@fluentui/react-tabster");
|
|
20
|
+
const _ChartPopover = require("../CommonComponents/ChartPopover");
|
|
21
|
+
const _FocusableTooltipText = require("../../utilities/FocusableTooltipText");
|
|
22
|
+
const _index2 = require("../../index");
|
|
23
|
+
const HorizontalBarChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
24
|
+
const legendContainer = _react.useRef(null);
|
|
25
|
+
const _uniqLineText = '_HorizontalLine_' + Math.random().toString(36).substring(7);
|
|
26
|
+
const _refArray = [];
|
|
27
|
+
const _isRTL = (0, _index1.useRtl)();
|
|
28
|
+
const barChartSvgRef = /*#__PURE__*/ _react.createRef();
|
|
29
|
+
const _emptyChartId = (0, _reactutilities.useId)('_HBC_empty');
|
|
30
|
+
let _barHeight;
|
|
31
|
+
let _calloutAnchorPoint;
|
|
32
|
+
let isSingleBar = true;
|
|
33
|
+
const [hoverValue, setHoverValue] = _react.useState('');
|
|
34
|
+
const [lineColor, setLineColor] = _react.useState('');
|
|
35
|
+
const [legend, setLegend] = _react.useState('');
|
|
36
|
+
const [xCalloutValue, setXCalloutValue] = _react.useState('');
|
|
37
|
+
const [yCalloutValue, setYCalloutValue] = _react.useState('');
|
|
38
|
+
const [barCalloutProps, setBarCalloutProps] = _react.useState();
|
|
39
|
+
const [barSpacingInPercent, setBarSpacingInPercent] = _react.useState(0);
|
|
40
|
+
const [isPopoverOpen, setPopoverOpen] = _react.useState(false);
|
|
41
|
+
const [clickPosition, setClickPosition] = _react.useState({
|
|
42
|
+
x: 0,
|
|
43
|
+
y: 0
|
|
44
|
+
});
|
|
45
|
+
const [selectedLegend, setSelectedLegend] = _react.useState('');
|
|
46
|
+
const [activeLegend, setActiveLegend] = _react.useState('');
|
|
47
|
+
function _refCallback(element, legendTitle) {
|
|
48
|
+
_refArray.push({
|
|
49
|
+
index: legendTitle,
|
|
50
|
+
refElement: element
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function _hoverOn(event, hoverVal, point) {
|
|
54
|
+
if ((!isPopoverOpen || legend !== point.legend) && _calloutAnchorPoint !== point && (_legendHighlighted(point.legend) || _noLegendHighlighted())) {
|
|
55
|
+
_calloutAnchorPoint = point;
|
|
56
|
+
updatePosition(event.clientX, event.clientY);
|
|
57
|
+
setHoverValue(hoverVal);
|
|
58
|
+
setLineColor(point.color);
|
|
59
|
+
setLegend(point.legend);
|
|
60
|
+
setXCalloutValue(point.xAxisCalloutData);
|
|
61
|
+
setYCalloutValue(point.yAxisCalloutData);
|
|
62
|
+
setBarCalloutProps(point);
|
|
63
|
+
// ToDo - Confirm setting multiple state variables like this is performant.
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function _hoverOff() {
|
|
67
|
+
/*ToDo. To fix*/ }
|
|
68
|
+
const _handleChartMouseLeave = ()=>{
|
|
69
|
+
_calloutAnchorPoint = null;
|
|
70
|
+
if (isPopoverOpen) {
|
|
71
|
+
setPopoverOpen(false);
|
|
72
|
+
setHoverValue('');
|
|
73
|
+
setLineColor('');
|
|
74
|
+
setLegend('');
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const _adjustProps = ()=>{
|
|
78
|
+
_barHeight = props.barHeight || 12;
|
|
79
|
+
};
|
|
80
|
+
const _getChartDataText = (data)=>{
|
|
81
|
+
/* return props.barChartCustomData ? (
|
|
82
|
+
<div role="text">{props.barChartCustomData(data)}</div>
|
|
83
|
+
) : ( */ return _getDefaultTextData(data);
|
|
84
|
+
//)
|
|
85
|
+
};
|
|
86
|
+
function _createLegends(chartProps) {
|
|
87
|
+
const legendItems = [];
|
|
88
|
+
chartProps.forEach((point)=>{
|
|
89
|
+
point.chartData.forEach((dataPoint)=>{
|
|
90
|
+
const color = dataPoint.color;
|
|
91
|
+
// mapping data to the format Legends component needs
|
|
92
|
+
const legendItem = {
|
|
93
|
+
title: dataPoint.legend,
|
|
94
|
+
color,
|
|
95
|
+
action: ()=>{
|
|
96
|
+
if (selectedLegend === dataPoint.legend) {
|
|
97
|
+
setSelectedLegend('');
|
|
98
|
+
} else {
|
|
99
|
+
setSelectedLegend(dataPoint.legend);
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
hoverAction: ()=>{
|
|
103
|
+
_handleChartMouseLeave();
|
|
104
|
+
setActiveLegend(dataPoint.legend);
|
|
105
|
+
},
|
|
106
|
+
onMouseOutAction: ()=>{
|
|
107
|
+
setActiveLegend('');
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
legendItems.push(legendItem);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
const legends = /*#__PURE__*/ _react.createElement(_index2.Legends, {
|
|
114
|
+
legends: legendItems,
|
|
115
|
+
centerLegends: true,
|
|
116
|
+
overflowText: props.legendsOverflowText,
|
|
117
|
+
...props.legendProps
|
|
118
|
+
});
|
|
119
|
+
return legends;
|
|
120
|
+
}
|
|
121
|
+
function _getDefaultTextData(data) {
|
|
122
|
+
const { culture } = props;
|
|
123
|
+
const accessibilityData = (0, _index1.getAccessibleDataObject)(data.chartDataAccessibilityData, 'text', false);
|
|
124
|
+
if (!isSingleBar) {
|
|
125
|
+
const total = data.chartData.reduce((acc, point)=>acc + (point.horizontalBarChartdata.x ? point.horizontalBarChartdata.x : 0), 0);
|
|
126
|
+
return /*#__PURE__*/ _react.createElement("div", {
|
|
127
|
+
className: classes.chartTitleRight,
|
|
128
|
+
...accessibilityData
|
|
129
|
+
}, (0, _localeutil.convertToLocaleString)(total, culture));
|
|
130
|
+
}
|
|
131
|
+
const chartDataMode = props.chartDataMode || 'default';
|
|
132
|
+
const chartData = data.chartData[0];
|
|
133
|
+
const x = chartData.horizontalBarChartdata.x;
|
|
134
|
+
const y = chartData.horizontalBarChartdata.total;
|
|
135
|
+
switch(chartDataMode){
|
|
136
|
+
case 'default':
|
|
137
|
+
return /*#__PURE__*/ _react.createElement("div", {
|
|
138
|
+
className: classes.chartTitleRight,
|
|
139
|
+
...accessibilityData
|
|
140
|
+
}, (0, _localeutil.convertToLocaleString)(x, culture));
|
|
141
|
+
case 'fraction':
|
|
142
|
+
return /*#__PURE__*/ _react.createElement("div", accessibilityData, /*#__PURE__*/ _react.createElement("span", {
|
|
143
|
+
className: classes.chartTitleRight
|
|
144
|
+
}, (0, _localeutil.convertToLocaleString)(x, culture)), /*#__PURE__*/ _react.createElement("span", {
|
|
145
|
+
className: classes.chartDataTextDenominator
|
|
146
|
+
}, ' / ' + (0, _localeutil.convertToLocaleString)(y, culture)));
|
|
147
|
+
case 'percentage':
|
|
148
|
+
const dataRatioPercentage = `${(0, _localeutil.convertToLocaleString)(Math.round(x / y * 100), culture)}%`;
|
|
149
|
+
return /*#__PURE__*/ _react.createElement("div", {
|
|
150
|
+
className: classes.chartTitleRight,
|
|
151
|
+
...accessibilityData
|
|
152
|
+
}, dataRatioPercentage);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function _createBenchmark(data) {
|
|
156
|
+
if (data.chartData[0].horizontalBarChartdata.total === undefined) {
|
|
157
|
+
return /*#__PURE__*/ _react.createElement(_react.Fragment, null);
|
|
158
|
+
}
|
|
159
|
+
const totalData = data.chartData[0].horizontalBarChartdata.total;
|
|
160
|
+
const benchmarkData = data.chartData[0].data;
|
|
161
|
+
const benchmarkRatio = Math.round((benchmarkData ? benchmarkData : 0) / totalData * 100);
|
|
162
|
+
const benchmarkStyles = {
|
|
163
|
+
left: 'calc(' + benchmarkRatio + '% - 4px)'
|
|
164
|
+
};
|
|
165
|
+
return /*#__PURE__*/ _react.createElement("div", {
|
|
166
|
+
className: classes.benchmarkContainer
|
|
167
|
+
}, /*#__PURE__*/ _react.createElement("div", {
|
|
168
|
+
className: classes.triangle,
|
|
169
|
+
style: benchmarkStyles
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* This functions returns an array of <rect> elements, which form the bars
|
|
174
|
+
* For each bar an x value, and a width needs to be specified
|
|
175
|
+
* The computations are done based on percentages
|
|
176
|
+
* Extra margin is also provided, in the x value to provide some spacing in between the bars
|
|
177
|
+
*/ function _createBars(data) {
|
|
178
|
+
var _data_chartData;
|
|
179
|
+
const noOfBars = ((_data_chartData = data.chartData) === null || _data_chartData === void 0 ? void 0 : _data_chartData.reduce((count, point)=>count += (point.data || 0) > 0 ? 1 : 0, 0)) || 1;
|
|
180
|
+
const totalMarginPercent = barSpacingInPercent * (noOfBars - 1);
|
|
181
|
+
const defaultColors = [
|
|
182
|
+
_reacttheme.tokens.colorPaletteBlueForeground2,
|
|
183
|
+
_reacttheme.tokens.colorPaletteCornflowerForeground2,
|
|
184
|
+
_reacttheme.tokens.colorPaletteDarkGreenForeground2,
|
|
185
|
+
_reacttheme.tokens.colorPaletteNavyForeground2,
|
|
186
|
+
_reacttheme.tokens.colorPaletteDarkOrangeForeground2
|
|
187
|
+
];
|
|
188
|
+
// calculating starting point of each bar and it's range
|
|
189
|
+
const startingPoint = [];
|
|
190
|
+
const total = data.chartData.reduce((acc, point)=>acc + (point.horizontalBarChartdata.x ? point.horizontalBarChartdata.x : 0), 0);
|
|
191
|
+
let prevPosition = 0;
|
|
192
|
+
let value = 0;
|
|
193
|
+
let sumOfPercent = 0;
|
|
194
|
+
data.chartData.map((point, index)=>{
|
|
195
|
+
const pointData = point.horizontalBarChartdata.x ? point.horizontalBarChartdata.x : 0;
|
|
196
|
+
value = pointData / total * 100;
|
|
197
|
+
if (value < 0) {
|
|
198
|
+
value = 0;
|
|
199
|
+
} else if (value < 1 && value !== 0) {
|
|
200
|
+
value = 1;
|
|
201
|
+
}
|
|
202
|
+
sumOfPercent += value;
|
|
203
|
+
return sumOfPercent;
|
|
204
|
+
});
|
|
205
|
+
/**
|
|
206
|
+
* The %age of the space occupied by the margin needs to subtracted
|
|
207
|
+
* while computing the scaling ratio, since the margins are not being
|
|
208
|
+
* scaled down, only the data is being scaled down from a higher percentage to lower percentage
|
|
209
|
+
* Eg: 95% of the space is taken by the bars, 5% by the margins
|
|
210
|
+
* Now if the sumOfPercent is 120% -> This needs to be scaled down to 95%, not 100%
|
|
211
|
+
* since that's only space available to the bars
|
|
212
|
+
*/ const scalingRatio = sumOfPercent !== 0 ? (sumOfPercent - totalMarginPercent) / 100 : 1;
|
|
213
|
+
const bars = data.chartData.map((point, index)=>{
|
|
214
|
+
const color = point.color ? point.color : defaultColors[Math.floor(Math.random() * 4 + 1)];
|
|
215
|
+
const pointData = point.horizontalBarChartdata.x ? point.horizontalBarChartdata.x : 0;
|
|
216
|
+
if (index > 0) {
|
|
217
|
+
prevPosition += value;
|
|
218
|
+
}
|
|
219
|
+
value = pointData / total * 100;
|
|
220
|
+
if (value < 0) {
|
|
221
|
+
value = 0;
|
|
222
|
+
} else if (value < 1 && value !== 0) {
|
|
223
|
+
value = 1 / scalingRatio;
|
|
224
|
+
} else {
|
|
225
|
+
value = value / scalingRatio;
|
|
226
|
+
}
|
|
227
|
+
startingPoint.push(prevPosition);
|
|
228
|
+
const xValue = point.horizontalBarChartdata.x;
|
|
229
|
+
const placeholderIndex = 1;
|
|
230
|
+
const isLegendSelected = _legendHighlighted(point.legend) || _noLegendHighlighted();
|
|
231
|
+
// Render bar label instead of placeholder bar for absolute-scale variant
|
|
232
|
+
if (index === placeholderIndex && props.variant === _index.HorizontalBarChartVariant.AbsoluteScale) {
|
|
233
|
+
if (props.hideLabels) {
|
|
234
|
+
return /*#__PURE__*/ _react.createElement("text", {
|
|
235
|
+
key: index
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
const barValue = data.chartData[0].horizontalBarChartdata.x;
|
|
239
|
+
return /*#__PURE__*/ _react.createElement("text", {
|
|
240
|
+
key: index,
|
|
241
|
+
x: `${_isRTL ? 100 - startingPoint[index] : startingPoint[index]}%`,
|
|
242
|
+
y: _barHeight / 2,
|
|
243
|
+
dominantBaseline: "central",
|
|
244
|
+
transform: `translate(${_isRTL ? -4 : 4})`,
|
|
245
|
+
className: classes.barLabel,
|
|
246
|
+
"aria-hidden": true
|
|
247
|
+
}, (0, _index1.formatValueWithSIPrefix)(barValue));
|
|
248
|
+
}
|
|
249
|
+
return /*#__PURE__*/ _react.createElement("rect", {
|
|
250
|
+
key: index,
|
|
251
|
+
x: `${_isRTL ? 100 - startingPoint[index] - value - index * barSpacingInPercent : startingPoint[index] + index * barSpacingInPercent}%`,
|
|
252
|
+
y: 0,
|
|
253
|
+
"data-is-focusable": point.legend !== '' ? true : false,
|
|
254
|
+
width: value + '%',
|
|
255
|
+
height: _barHeight,
|
|
256
|
+
fill: color,
|
|
257
|
+
onMouseOver: point.legend !== '' ? (event)=>_hoverOn(event, xValue, point) : undefined,
|
|
258
|
+
onFocus: point.legend !== '' ? (event)=>_hoverOn.bind(event, xValue, point) : undefined,
|
|
259
|
+
role: "img",
|
|
260
|
+
"aria-label": _getAriaLabel(point),
|
|
261
|
+
onBlur: _hoverOff,
|
|
262
|
+
onMouseLeave: _hoverOff,
|
|
263
|
+
className: classes.barWrapper,
|
|
264
|
+
opacity: isLegendSelected ? 1 : 0.1,
|
|
265
|
+
tabIndex: point.legend !== '' ? 0 : undefined
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
return bars;
|
|
269
|
+
}
|
|
270
|
+
const _getAriaLabel = (point)=>{
|
|
271
|
+
var _point_callOutAccessibilityData;
|
|
272
|
+
const legend = point.xAxisCalloutData || point.legend;
|
|
273
|
+
var _point_horizontalBarChartdata_total;
|
|
274
|
+
const yValue = point.yAxisCalloutData || (point.horizontalBarChartdata ? `${point.horizontalBarChartdata.x}/${(_point_horizontalBarChartdata_total = point.horizontalBarChartdata.total) !== null && _point_horizontalBarChartdata_total !== void 0 ? _point_horizontalBarChartdata_total : ''}` : 0);
|
|
275
|
+
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || (legend ? `${legend}, ` : '') + `${yValue}.`;
|
|
276
|
+
};
|
|
277
|
+
function _isChartEmpty() {
|
|
278
|
+
return !(props.data && props.data.length > 0);
|
|
279
|
+
}
|
|
280
|
+
function updatePosition(newX, newY) {
|
|
281
|
+
const threshold = 1; // Set a threshold for movement
|
|
282
|
+
const { x, y } = clickPosition;
|
|
283
|
+
// Calculate the distance moved
|
|
284
|
+
const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));
|
|
285
|
+
// Update the position only if the distance moved is greater than the threshold
|
|
286
|
+
if (distance > threshold) {
|
|
287
|
+
setClickPosition({
|
|
288
|
+
x: newX,
|
|
289
|
+
y: newY
|
|
290
|
+
});
|
|
291
|
+
setPopoverOpen(true);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
_react.useEffect(()=>{
|
|
295
|
+
var _barChartSvgRef_current;
|
|
296
|
+
const svgWidth = (barChartSvgRef === null || barChartSvgRef === void 0 ? void 0 : (_barChartSvgRef_current = barChartSvgRef.current) === null || _barChartSvgRef_current === void 0 ? void 0 : _barChartSvgRef_current.getBoundingClientRect().width) || 0;
|
|
297
|
+
const MARGIN_WIDTH_IN_PX = 3;
|
|
298
|
+
if (svgWidth) {
|
|
299
|
+
const currentBarSpacing = MARGIN_WIDTH_IN_PX / svgWidth * 100;
|
|
300
|
+
setBarSpacingInPercent(currentBarSpacing);
|
|
301
|
+
}
|
|
302
|
+
}, [
|
|
303
|
+
barChartSvgRef
|
|
304
|
+
]);
|
|
305
|
+
function _legendHighlighted(barLegend) {
|
|
306
|
+
if (barLegend === undefined) {
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
return selectedLegend === barLegend || selectedLegend === '' && activeLegend === barLegend;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* This function checks if none of the legends is selected or hovered.*/ function _noLegendHighlighted() {
|
|
313
|
+
return selectedLegend === '' && activeLegend === '';
|
|
314
|
+
}
|
|
315
|
+
const { data } = props;
|
|
316
|
+
_adjustProps();
|
|
317
|
+
const classes = (0, _useHorizontalBarChartStylesstyles.useHorizontalBarChartStyles)(props);
|
|
318
|
+
const focusAttributes = (0, _reacttabster.useFocusableGroup)();
|
|
319
|
+
const legendButtons = _createLegends(data);
|
|
320
|
+
let datapoint = 0;
|
|
321
|
+
var _props_culture;
|
|
322
|
+
return !_isChartEmpty() ? /*#__PURE__*/ _react.createElement("div", {
|
|
323
|
+
className: classes.root,
|
|
324
|
+
onMouseLeave: _handleChartMouseLeave
|
|
325
|
+
}, data.map((points, index)=>{
|
|
326
|
+
if (points.chartData && points.chartData[0] && points.chartData[0].horizontalBarChartdata.x) {
|
|
327
|
+
datapoint = points.chartData[0].horizontalBarChartdata.x;
|
|
328
|
+
} else {
|
|
329
|
+
datapoint = 0;
|
|
330
|
+
}
|
|
331
|
+
isSingleBar = points.chartData.length === 1 || points.chartData.length > 1 && points.chartData[1].legend === '';
|
|
332
|
+
if (isSingleBar) {
|
|
333
|
+
points.chartData[1] = {
|
|
334
|
+
legend: '',
|
|
335
|
+
horizontalBarChartdata: {
|
|
336
|
+
x: points.chartData[0].horizontalBarChartdata.total - datapoint,
|
|
337
|
+
total: points.chartData[0].horizontalBarChartdata.total
|
|
338
|
+
},
|
|
339
|
+
color: _reacttheme.tokens.colorBackgroundOverlay
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
// Hide right side text of chart title for absolute-scale variant
|
|
343
|
+
const chartDataText = props.variant === _index.HorizontalBarChartVariant.AbsoluteScale ? null : _getChartDataText(points);
|
|
344
|
+
const bars = _createBars(points);
|
|
345
|
+
const keyVal = _uniqLineText + '_' + index;
|
|
346
|
+
// ToDo - Showtriangle property is per data series. How to account for it in the new stylesheet
|
|
347
|
+
/* const classes = useHorizontalBarChartStyles(props.styles!, {
|
|
348
|
+
width: props.width,
|
|
349
|
+
showTriangle: !!points!.chartData![0].data,
|
|
350
|
+
variant: props.variant,
|
|
351
|
+
}); */ return /*#__PURE__*/ _react.createElement("div", {
|
|
352
|
+
key: index
|
|
353
|
+
}, /*#__PURE__*/ _react.createElement("div", {
|
|
354
|
+
className: classes.items,
|
|
355
|
+
...focusAttributes
|
|
356
|
+
}, /*#__PURE__*/ _react.createElement("div", {
|
|
357
|
+
className: classes.chartTitle
|
|
358
|
+
}, points.chartTitle && /*#__PURE__*/ _react.createElement(_FocusableTooltipText.FocusableTooltipText, {
|
|
359
|
+
className: classes.chartTitleLeft,
|
|
360
|
+
content: points.chartTitle,
|
|
361
|
+
accessibilityData: points.chartTitleAccessibilityData
|
|
362
|
+
}), chartDataText), points.chartData[0].data && _createBenchmark(points), /*#__PURE__*/ _react.createElement("svg", {
|
|
363
|
+
ref: barChartSvgRef,
|
|
364
|
+
className: classes.chart,
|
|
365
|
+
"aria-label": points.chartTitle
|
|
366
|
+
}, /*#__PURE__*/ _react.createElement("g", {
|
|
367
|
+
id: keyVal,
|
|
368
|
+
key: keyVal,
|
|
369
|
+
ref: (e)=>{
|
|
370
|
+
_refCallback(e, points.chartData[0].legend);
|
|
371
|
+
},
|
|
372
|
+
// NOTE: points.chartData![0] contains current data value
|
|
373
|
+
onClick: ()=>{
|
|
374
|
+
const p = points.chartData[0];
|
|
375
|
+
if (p && p.onClick) {
|
|
376
|
+
p.onClick();
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}, bars))));
|
|
380
|
+
}), /*#__PURE__*/ _react.createElement(_ChartPopover.ChartPopover, {
|
|
381
|
+
xCalloutValue: xCalloutValue,
|
|
382
|
+
yCalloutValue: yCalloutValue,
|
|
383
|
+
culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
|
|
384
|
+
clickPosition: clickPosition,
|
|
385
|
+
isPopoverOpen: isPopoverOpen,
|
|
386
|
+
legend: legend,
|
|
387
|
+
YValue: hoverValue,
|
|
388
|
+
color: lineColor,
|
|
389
|
+
isCalloutForStack: false,
|
|
390
|
+
customCallout: {
|
|
391
|
+
customizedCallout: props.onRenderCalloutPerHorizontalBar ? props.onRenderCalloutPerHorizontalBar(barCalloutProps) : undefined,
|
|
392
|
+
customCalloutProps: props.calloutPropsPerDataPoint ? props.calloutPropsPerDataPoint(barCalloutProps) : undefined
|
|
393
|
+
},
|
|
394
|
+
isCartesian: false
|
|
395
|
+
}), !isSingleBar && /*#__PURE__*/ _react.createElement("div", {
|
|
396
|
+
ref: (e)=>legendContainer.current = e,
|
|
397
|
+
className: classes.legendContainer
|
|
398
|
+
}, legendButtons)) : /*#__PURE__*/ _react.createElement("div", {
|
|
399
|
+
id: _emptyChartId,
|
|
400
|
+
role: 'alert',
|
|
401
|
+
style: {
|
|
402
|
+
opacity: '0'
|
|
403
|
+
},
|
|
404
|
+
"aria-label": 'Graph has no data to display'
|
|
405
|
+
});
|
|
406
|
+
//TODO validate and fix focus border for issue for popover
|
|
407
|
+
});
|
|
408
|
+
HorizontalBarChart.displayName = 'HorizontalBarChart';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["HorizontalBarChart.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useHorizontalBarChartStyles } from './useHorizontalBarChartStyles.styles';\nimport { ChartProps, HorizontalBarChartProps, ChartDataPoint, RefArrayData, HorizontalBarChartVariant } from './index';\nimport { convertToLocaleString } from '../../utilities/locale-util';\nimport { formatValueWithSIPrefix, getAccessibleDataObject, useRtl } from '../../utilities/index';\nimport { useId } from '@fluentui/react-utilities';\nimport { tokens } from '@fluentui/react-theme';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { FocusableTooltipText } from '../../utilities/FocusableTooltipText';\nimport { Legend, Legends } from '../../index';\n\n/**\n * HorizontalBarChart is the context wrapper and container for all HorizontalBarChart content/controls,\n * It has no direct style or slot opinions.\n *\n * HorizontalBarChart also provides API interfaces for callbacks that will occur on navigation events.\n */\nexport const HorizontalBarChart: React.FunctionComponent<HorizontalBarChartProps> = React.forwardRef<\n HTMLDivElement,\n HorizontalBarChartProps\n>((props, forwardedRef) => {\n const legendContainer = React.useRef<HTMLDivElement | null>(null);\n const _uniqLineText: string = '_HorizontalLine_' + Math.random().toString(36).substring(7);\n const _refArray: RefArrayData[] = [];\n const _isRTL: boolean = useRtl();\n const barChartSvgRef: React.RefObject<SVGSVGElement> = React.createRef<SVGSVGElement>();\n const _emptyChartId: string = useId('_HBC_empty');\n let _barHeight: number;\n let _calloutAnchorPoint: ChartDataPoint | null;\n let isSingleBar: boolean = true;\n\n const [hoverValue, setHoverValue] = React.useState<string | number | Date | null>('');\n const [lineColor, setLineColor] = React.useState<string>('');\n const [legend, setLegend] = React.useState<string | null>('');\n const [xCalloutValue, setXCalloutValue] = React.useState<string | undefined>('');\n const [yCalloutValue, setYCalloutValue] = React.useState<string | undefined>('');\n const [barCalloutProps, setBarCalloutProps] = React.useState<ChartDataPoint>();\n const [barSpacingInPercent, setBarSpacingInPercent] = React.useState<number>(0);\n const [isPopoverOpen, setPopoverOpen] = React.useState<boolean>(false);\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const [selectedLegend, setSelectedLegend] = React.useState<string>('');\n const [activeLegend, setActiveLegend] = React.useState<string>('');\n\n function _refCallback(element: SVGGElement, legendTitle: string | undefined): void {\n _refArray.push({ index: legendTitle, refElement: element });\n }\n\n function _hoverOn(\n event: React.MouseEvent<SVGRectElement, MouseEvent>,\n hoverVal: string | number | Date,\n point: ChartDataPoint,\n ): void {\n if (\n (!isPopoverOpen || legend !== point.legend!) &&\n _calloutAnchorPoint !== point &&\n (_legendHighlighted(point.legend) || _noLegendHighlighted())\n ) {\n _calloutAnchorPoint = point;\n updatePosition(event.clientX, event.clientY);\n setHoverValue(hoverVal);\n setLineColor(point.color!);\n setLegend(point.legend!);\n setXCalloutValue(point.xAxisCalloutData!);\n setYCalloutValue(point.yAxisCalloutData!);\n setBarCalloutProps(point);\n // ToDo - Confirm setting multiple state variables like this is performant.\n }\n }\n\n function _hoverOff(): void {\n /*ToDo. To fix*/\n }\n\n const _handleChartMouseLeave = () => {\n _calloutAnchorPoint = null;\n if (isPopoverOpen) {\n setPopoverOpen(false);\n setHoverValue('');\n setLineColor('');\n setLegend('');\n }\n };\n\n const _adjustProps = (): void => {\n _barHeight = props.barHeight || 12;\n };\n\n const _getChartDataText = (data: ChartProps) => {\n /* return props.barChartCustomData ? (\n <div role=\"text\">{props.barChartCustomData(data)}</div>\n ) : ( */\n return _getDefaultTextData(data);\n //)\n };\n\n function _createLegends(chartProps: ChartProps[]): JSX.Element {\n const legendItems: Legend[] = [];\n chartProps.forEach((point: ChartProps) => {\n point.chartData!.forEach((dataPoint: ChartDataPoint) => {\n const color: string = dataPoint.color!;\n // mapping data to the format Legends component needs\n const legendItem: Legend = {\n title: dataPoint.legend!,\n color,\n action: () => {\n if (selectedLegend === dataPoint.legend) {\n setSelectedLegend('');\n } else {\n setSelectedLegend(dataPoint.legend!);\n }\n },\n hoverAction: () => {\n _handleChartMouseLeave();\n setActiveLegend(dataPoint.legend!);\n },\n onMouseOutAction: () => {\n setActiveLegend('');\n },\n };\n legendItems.push(legendItem);\n });\n });\n const legends = (\n <Legends legends={legendItems} centerLegends overflowText={props.legendsOverflowText} {...props.legendProps} />\n );\n return legends;\n }\n\n function _getDefaultTextData(data: ChartProps): JSX.Element {\n const { culture } = props;\n const accessibilityData = getAccessibleDataObject(data.chartDataAccessibilityData!, 'text', false);\n if (!isSingleBar) {\n const total = data.chartData!.reduce(\n (acc: number, point: ChartDataPoint) =>\n acc + (point.horizontalBarChartdata!.x ? point.horizontalBarChartdata!.x : 0),\n 0,\n );\n return (\n <div className={classes.chartTitleRight} {...accessibilityData}>\n {convertToLocaleString(total, culture)}\n </div>\n );\n }\n const chartDataMode = props.chartDataMode || 'default';\n const chartData: ChartDataPoint = data!.chartData![0];\n const x = chartData.horizontalBarChartdata!.x;\n const y = chartData.horizontalBarChartdata!.total!;\n\n switch (chartDataMode) {\n case 'default':\n return (\n <div className={classes.chartTitleRight} {...accessibilityData}>\n {convertToLocaleString(x, culture)}\n </div>\n );\n case 'fraction':\n return (\n <div {...accessibilityData}>\n <span className={classes.chartTitleRight}>{convertToLocaleString(x, culture)}</span>\n <span className={classes.chartDataTextDenominator}>{' / ' + convertToLocaleString(y, culture)}</span>\n </div>\n );\n case 'percentage':\n const dataRatioPercentage = `${convertToLocaleString(Math.round((x / y) * 100), culture)}%`;\n return (\n <div className={classes.chartTitleRight} {...accessibilityData}>\n {dataRatioPercentage}\n </div>\n );\n }\n }\n\n function _createBenchmark(data: ChartProps): JSX.Element {\n if (data.chartData![0].horizontalBarChartdata!.total === undefined) {\n return <></>;\n }\n const totalData = data.chartData![0].horizontalBarChartdata!.total!;\n const benchmarkData = data.chartData![0].data;\n const benchmarkRatio = Math.round(((benchmarkData ? benchmarkData : 0) / totalData) * 100);\n\n const benchmarkStyles = {\n left: 'calc(' + benchmarkRatio + '% - 4px)',\n };\n\n return (\n <div className={classes.benchmarkContainer}>\n <div className={classes.triangle} style={benchmarkStyles} />\n </div>\n );\n }\n\n /**\n * This functions returns an array of <rect> elements, which form the bars\n * For each bar an x value, and a width needs to be specified\n * The computations are done based on percentages\n * Extra margin is also provided, in the x value to provide some spacing in between the bars\n */\n\n function _createBars(data: ChartProps): JSX.Element[] {\n const noOfBars =\n data.chartData?.reduce((count: number, point: ChartDataPoint) => (count += (point.data || 0) > 0 ? 1 : 0), 0) ||\n 1;\n const totalMarginPercent = barSpacingInPercent * (noOfBars - 1);\n const defaultColors: string[] = [\n tokens.colorPaletteBlueForeground2,\n tokens.colorPaletteCornflowerForeground2,\n tokens.colorPaletteDarkGreenForeground2,\n tokens.colorPaletteNavyForeground2,\n tokens.colorPaletteDarkOrangeForeground2,\n ];\n // calculating starting point of each bar and it's range\n const startingPoint: number[] = [];\n const total = data.chartData!.reduce(\n (acc: number, point: ChartDataPoint) =>\n acc + (point.horizontalBarChartdata!.x ? point.horizontalBarChartdata!.x : 0),\n 0,\n );\n let prevPosition = 0;\n let value = 0;\n\n let sumOfPercent = 0;\n data.chartData!.map((point: ChartDataPoint, index: number) => {\n const pointData = point.horizontalBarChartdata!.x ? point.horizontalBarChartdata!.x : 0;\n value = (pointData / total) * 100;\n if (value < 0) {\n value = 0;\n } else if (value < 1 && value !== 0) {\n value = 1;\n }\n sumOfPercent += value;\n\n return sumOfPercent;\n });\n\n /**\n * The %age of the space occupied by the margin needs to subtracted\n * while computing the scaling ratio, since the margins are not being\n * scaled down, only the data is being scaled down from a higher percentage to lower percentage\n * Eg: 95% of the space is taken by the bars, 5% by the margins\n * Now if the sumOfPercent is 120% -> This needs to be scaled down to 95%, not 100%\n * since that's only space available to the bars\n */\n const scalingRatio = sumOfPercent !== 0 ? (sumOfPercent - totalMarginPercent) / 100 : 1;\n\n const bars = data.chartData!.map((point: ChartDataPoint, index: number) => {\n const color: string = point.color ? point.color : defaultColors[Math.floor(Math.random() * 4 + 1)];\n const pointData = point.horizontalBarChartdata!.x ? point.horizontalBarChartdata!.x : 0;\n if (index > 0) {\n prevPosition += value;\n }\n value = (pointData / total) * 100;\n if (value < 0) {\n value = 0;\n } else if (value < 1 && value !== 0) {\n value = 1 / scalingRatio;\n } else {\n value = value / scalingRatio;\n }\n startingPoint.push(prevPosition);\n\n const xValue = point.horizontalBarChartdata!.x;\n const placeholderIndex = 1;\n const isLegendSelected: boolean = _legendHighlighted(point.legend) || _noLegendHighlighted();\n\n // Render bar label instead of placeholder bar for absolute-scale variant\n if (index === placeholderIndex && props.variant === HorizontalBarChartVariant.AbsoluteScale) {\n if (props.hideLabels) {\n return <text key={index} />;\n }\n\n const barValue = data.chartData![0].horizontalBarChartdata!.x;\n\n return (\n <text\n key={index}\n x={`${_isRTL ? 100 - startingPoint[index] : startingPoint[index]}%`}\n y={_barHeight / 2}\n dominantBaseline=\"central\"\n transform={`translate(${_isRTL ? -4 : 4})`}\n className={classes.barLabel}\n aria-hidden={true}\n >\n {formatValueWithSIPrefix(barValue)}\n </text>\n );\n }\n\n return (\n <rect\n key={index}\n x={`${\n _isRTL\n ? 100 - startingPoint[index] - value - index * barSpacingInPercent\n : startingPoint[index] + index * barSpacingInPercent\n }%`}\n y={0}\n data-is-focusable={point.legend !== '' ? true : false}\n width={value + '%'}\n height={_barHeight}\n fill={color}\n onMouseOver={point.legend !== '' ? event => _hoverOn(event, xValue, point) : undefined}\n onFocus={point.legend !== '' ? event => _hoverOn.bind(event, xValue, point) : undefined}\n role=\"img\"\n aria-label={_getAriaLabel(point)}\n onBlur={_hoverOff}\n onMouseLeave={_hoverOff}\n className={classes.barWrapper}\n opacity={isLegendSelected ? 1 : 0.1}\n tabIndex={point.legend !== '' ? 0 : undefined}\n />\n );\n });\n return bars;\n }\n\n const _getAriaLabel = (point: ChartDataPoint): string => {\n const legend = point.xAxisCalloutData || point.legend;\n const yValue =\n point.yAxisCalloutData ||\n (point.horizontalBarChartdata\n ? `${point.horizontalBarChartdata.x}/${point.horizontalBarChartdata.total ?? ''}`\n : 0);\n return point.callOutAccessibilityData?.ariaLabel || (legend ? `${legend}, ` : '') + `${yValue}.`;\n };\n\n function _isChartEmpty(): boolean {\n return !(props.data && props.data.length > 0);\n }\n\n function updatePosition(newX: number, newY: number): void {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\n }\n }\n\n React.useEffect(() => {\n const svgWidth = barChartSvgRef?.current?.getBoundingClientRect().width || 0;\n const MARGIN_WIDTH_IN_PX = 3;\n if (svgWidth) {\n const currentBarSpacing = (MARGIN_WIDTH_IN_PX / svgWidth) * 100;\n setBarSpacingInPercent(currentBarSpacing);\n }\n }, [barChartSvgRef]);\n\n function _legendHighlighted(barLegend?: string) {\n if (barLegend === undefined) {\n return false;\n }\n return selectedLegend === barLegend || (selectedLegend === '' && activeLegend === barLegend);\n }\n\n /**\n * This function checks if none of the legends is selected or hovered.*/\n\n function _noLegendHighlighted() {\n return selectedLegend === '' && activeLegend === '';\n }\n\n const { data } = props;\n _adjustProps();\n const classes = useHorizontalBarChartStyles(props);\n const focusAttributes = useFocusableGroup();\n const legendButtons = _createLegends(data!);\n\n let datapoint: number | undefined = 0;\n return !_isChartEmpty() ? (\n <div className={classes.root} onMouseLeave={_handleChartMouseLeave}>\n {data!.map((points: ChartProps, index: number) => {\n if (points.chartData && points.chartData![0] && points.chartData![0].horizontalBarChartdata!.x) {\n datapoint = points.chartData![0].horizontalBarChartdata!.x;\n } else {\n datapoint = 0;\n }\n isSingleBar =\n points.chartData!.length === 1 || (points.chartData!.length > 1 && points.chartData![1].legend === '');\n if (isSingleBar) {\n points.chartData![1] = {\n legend: '',\n horizontalBarChartdata: {\n x: points.chartData![0].horizontalBarChartdata!.total! - datapoint!,\n total: points.chartData![0].horizontalBarChartdata!.total!,\n },\n color: tokens.colorBackgroundOverlay,\n };\n }\n\n // Hide right side text of chart title for absolute-scale variant\n const chartDataText =\n props.variant === HorizontalBarChartVariant.AbsoluteScale ? null : _getChartDataText(points!);\n const bars = _createBars(points!);\n const keyVal = _uniqLineText + '_' + index;\n // ToDo - Showtriangle property is per data series. How to account for it in the new stylesheet\n /* const classes = useHorizontalBarChartStyles(props.styles!, {\n width: props.width,\n showTriangle: !!points!.chartData![0].data,\n variant: props.variant,\n }); */\n\n return (\n <div key={index}>\n <div className={classes.items} {...focusAttributes}>\n <div className={classes.chartTitle}>\n {points!.chartTitle && (\n <FocusableTooltipText\n className={classes.chartTitleLeft}\n content={points!.chartTitle}\n accessibilityData={points!.chartTitleAccessibilityData}\n />\n )}\n {chartDataText}\n </div>\n {points!.chartData![0].data && _createBenchmark(points!)}\n <svg ref={barChartSvgRef} className={classes.chart} aria-label={points!.chartTitle}>\n <g\n id={keyVal}\n key={keyVal}\n ref={(e: SVGGElement) => {\n _refCallback(e, points!.chartData![0].legend);\n }}\n // NOTE: points.chartData![0] contains current data value\n onClick={() => {\n const p = points!.chartData![0];\n if (p && p.onClick) {\n p.onClick();\n }\n }}\n >\n {bars}\n </g>\n </svg>\n </div>\n </div>\n );\n })}\n <ChartPopover\n xCalloutValue={xCalloutValue}\n yCalloutValue={yCalloutValue}\n culture={props.culture ?? 'en-us'}\n clickPosition={clickPosition}\n isPopoverOpen={isPopoverOpen}\n legend={legend!}\n YValue={hoverValue!}\n color={lineColor}\n isCalloutForStack={false}\n customCallout={{\n customizedCallout: props.onRenderCalloutPerHorizontalBar\n ? props.onRenderCalloutPerHorizontalBar(barCalloutProps!)\n : undefined,\n customCalloutProps: props.calloutPropsPerDataPoint\n ? props.calloutPropsPerDataPoint(barCalloutProps!)\n : undefined,\n }}\n isCartesian={false}\n />\n {!isSingleBar && (\n <div ref={(e: HTMLDivElement) => (legendContainer.current = e)} className={classes.legendContainer}>\n {legendButtons}\n </div>\n )}\n </div>\n ) : (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n //TODO validate and fix focus border for issue for popover\n});\nHorizontalBarChart.displayName = 'HorizontalBarChart';\n"],"names":["HorizontalBarChart","React","forwardRef","props","forwardedRef","legendContainer","useRef","_uniqLineText","Math","random","toString","substring","_refArray","_isRTL","useRtl","barChartSvgRef","createRef","_emptyChartId","useId","_barHeight","_calloutAnchorPoint","isSingleBar","hoverValue","setHoverValue","useState","lineColor","setLineColor","legend","setLegend","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","barCalloutProps","setBarCalloutProps","barSpacingInPercent","setBarSpacingInPercent","isPopoverOpen","setPopoverOpen","clickPosition","setClickPosition","x","y","selectedLegend","setSelectedLegend","activeLegend","setActiveLegend","_refCallback","element","legendTitle","push","index","refElement","_hoverOn","event","hoverVal","point","_legendHighlighted","_noLegendHighlighted","updatePosition","clientX","clientY","color","xAxisCalloutData","yAxisCalloutData","_hoverOff","_handleChartMouseLeave","_adjustProps","barHeight","_getChartDataText","data","_getDefaultTextData","_createLegends","chartProps","legendItems","forEach","chartData","dataPoint","legendItem","title","action","hoverAction","onMouseOutAction","legends","createElement","Legends","centerLegends","overflowText","legendsOverflowText","legendProps","culture","accessibilityData","getAccessibleDataObject","chartDataAccessibilityData","total","reduce","acc","horizontalBarChartdata","div","className","classes","chartTitleRight","convertToLocaleString","chartDataMode","span","chartDataTextDenominator","dataRatioPercentage","round","_createBenchmark","undefined","Fragment","totalData","benchmarkData","benchmarkRatio","benchmarkStyles","left","benchmarkContainer","triangle","style","_createBars","noOfBars","count","totalMarginPercent","defaultColors","tokens","colorPaletteBlueForeground2","colorPaletteCornflowerForeground2","colorPaletteDarkGreenForeground2","colorPaletteNavyForeground2","colorPaletteDarkOrangeForeground2","startingPoint","prevPosition","value","sumOfPercent","map","pointData","scalingRatio","bars","floor","xValue","placeholderIndex","isLegendSelected","variant","HorizontalBarChartVariant","AbsoluteScale","hideLabels","text","key","barValue","dominantBaseline","transform","barLabel","aria-hidden","formatValueWithSIPrefix","rect","data-is-focusable","width","height","fill","onMouseOver","onFocus","bind","role","aria-label","_getAriaLabel","onBlur","onMouseLeave","barWrapper","opacity","tabIndex","yValue","callOutAccessibilityData","ariaLabel","_isChartEmpty","length","newX","newY","threshold","distance","sqrt","pow","useEffect","svgWidth","current","getBoundingClientRect","MARGIN_WIDTH_IN_PX","currentBarSpacing","barLegend","useHorizontalBarChartStyles","focusAttributes","useFocusableGroup","legendButtons","datapoint","root","points","colorBackgroundOverlay","chartDataText","keyVal","items","chartTitle","FocusableTooltipText","chartTitleLeft","content","chartTitleAccessibilityData","svg","ref","chart","g","id","e","onClick","p","ChartPopover","YValue","isCalloutForStack","customCallout","customizedCallout","onRenderCalloutPerHorizontalBar","customCalloutProps","calloutPropsPerDataPoint","isCartesian","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAkBaA;;;eAAAA;;;;iEAlBU;mDACqB;uBACiE;4BACvE;wBACmC;gCACnD;4BACC;8BACW;8BACL;sCACQ;wBACL;AAQzB,MAAMA,qBAAAA,WAAAA,GAAuEC,OAAMC,UAAU,CAGlG,CAACC,OAAOC;IACR,MAAMC,kBAAkBJ,OAAMK,MAAM,CAAwB;IAC5D,MAAMC,gBAAwB,qBAAqBC,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,SAAS,CAAC;IACxF,MAAMC,YAA4B,EAAE;IACpC,MAAMC,SAAkBC,IAAAA,cAAAA;IACxB,MAAMC,iBAAAA,WAAAA,GAAiDd,OAAMe,SAAS;IACtE,MAAMC,gBAAwBC,IAAAA,qBAAAA,EAAM;IACpC,IAAIC;IACJ,IAAIC;IACJ,IAAIC,cAAuB;IAE3B,MAAM,CAACC,YAAYC,cAAc,GAAGtB,OAAMuB,QAAQ,CAAgC;IAClF,MAAM,CAACC,WAAWC,aAAa,GAAGzB,OAAMuB,QAAQ,CAAS;IAC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EkD,SAAS;QAAI;QAAGL,cAAY;;AAE9E,0DAA0D;AAC5D;AACAnK,mBAAmB6N,WAAW,GAAG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "HorizontalBarChartVariant", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return HorizontalBarChartVariant;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
var HorizontalBarChartVariant;
|
|
14
|
+
(function(HorizontalBarChartVariant) {
|
|
15
|
+
HorizontalBarChartVariant["PartToWhole"] = "part-to-whole";
|
|
16
|
+
HorizontalBarChartVariant["AbsoluteScale"] = "absolute-scale";
|
|
17
|
+
})(HorizontalBarChartVariant || (HorizontalBarChartVariant = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["HorizontalBarChart.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { ChartPopoverProps } from '../CommonComponents/ChartPopover.types';\nimport { ChartDataPoint, ChartProps } from './index';\nimport { LegendsProps } from '../Legends/index';\n\n/**\n * Horizontal Bar Chart properties\n * {@docCategory HorizontalBarChart}\n */\nexport interface HorizontalBarChartProps extends React.RefAttributes<HTMLDivElement> {\n /**\n * An array of chart data points for the Horizontal bar chart\n */\n data?: ChartProps[];\n\n /**\n * Width of bar chart\n */\n width?: number;\n\n /**\n * Height of bar chart\n * @default 15\n */\n barHeight?: number;\n\n /**\n * Additional CSS class(es) to apply to the StackedBarChart.\n */\n className?: string;\n\n /**\n * This property tells whether to show ratio on top of stacked bar chart or not.\n */\n hideRatio?: boolean[];\n\n /**\n * Do not show tooltips in chart\n *\n * @default false\n */\n hideTooltip?: boolean;\n\n /**\n * This property tells how to show data text on top right of bar chart.\n * If barChartCustomData props added, then this props will be overrided.\n * @default 'default'\n */\n chartDataMode?: ChartDataMode;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: HorizontalBarChartStyles;\n\n /**\n * Define a custom callout renderer for a horizontal bar\n */\n // onRenderCalloutPerHorizontalBar?: IRenderFunction<IChartDataPoint>; ToDo - Need to use slots here.\n\n /**\n * props for the callout in the chart\n */\n calloutProps?: ChartPopoverProps;\n\n /**\n * Custom text to the chart (right side of the chart)\n * IChartProps will be available as props to the method prop.\n * If this method not given, default values (IHorizontalDataPoint \\{x,y\\})\n * will be used to display the data/text based on given chartModeData prop.\n */\n // barChartCustomData?: IRenderFunction<IChartProps>; ToDo - Need to use slots here.\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n\n /**\n * Prop to define the variant of HorizontalBarChart to render\n * @default HorizontalBarChartVariant.PartToWhole\n */\n variant?: HorizontalBarChartVariant;\n\n /**\n * Prop to hide the bar labels\n * @default false\n */\n hideLabels?: boolean;\n\n /**\n * line color for callout\n */\n color?: string;\n\n /**\n * prop to check if benchmark data is provided\n */\n showTriangle?: boolean;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n legendsOverflowText?: any;\n\n /*\n * props for the legends in the chart\n */\n legendProps?: Partial<LegendsProps>;\n\n /**\n * prop to render the custom callout\n */\n onRenderCalloutPerHorizontalBar?: (props: ChartDataPoint) => JSX.Element | undefined;\n\n /**\n * Define a custom callout props override\n */\n calloutPropsPerDataPoint?: (dataPointCalloutProps: ChartDataPoint) => ChartPopoverProps;\n}\n\n/**\n * Horizontal Bar Chart styles\n * {@docCategory HorizontalBarChart}\n */\nexport interface HorizontalBarChartStyles {\n /**\n * Styling for the root container\n */\n root: string;\n\n /**\n * Styling for each item in the container\n */\n items: string;\n\n /**\n * Style for the chart.\n */\n chart: string;\n\n /**\n * Style for the chart Title.\n */\n chartTitle: string;\n\n /**\n * Style for the bars.\n */\n barWrapper: string;\n\n /**\n * Style for left side text of the chart title\n */\n chartTitleLeft: string;\n\n /**\n * Style for right side text of the chart title\n */\n chartTitleRight: string;\n\n /**\n * Style for the chart data text denominator.\n */\n chartDataTextDenominator: string;\n\n /**\n * Style for the benchmark container\n */\n benchmarkContainer: string;\n\n /**\n * Style for the benchmark triangle\n */\n triangle: string;\n\n /**\n * Style for the bar labels\n */\n barLabel: string;\n\n /**\n * Style for the div containing the chart\n */\n chartWrapper: string;\n\n /**\n * Style for the legend container.\n */\n legendContainer: string;\n}\n\n/**\n * Chart data mode for chart data text\n * default: show the datapoint.x value\n * fraction: show the fraction of datapoint.x/datapoint.y\n * percentage: show the percentage of (datapoint.x/datapoint.y)%\n * {@docCategory HorizontalBarChart}\n */\nexport type ChartDataMode = 'default' | 'fraction' | 'percentage';\n\n/**\n * {@docCategory HorizontalBarChart}\n */\nexport enum HorizontalBarChartVariant {\n PartToWhole = 'part-to-whole',\n AbsoluteScale = 'absolute-scale',\n}\n"],"names":["HorizontalBarChartVariant"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;iEAAuB;;UA0MXA,yBAAAA;;;GAAAA,6BAAAA,CAAAA,4BAAAA,CAAAA,CAAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./HorizontalBarChart"), exports);
|
|
7
|
+
_export_star._(require("./HorizontalBarChart.types"), exports);
|
|
8
|
+
_export_star._(require("../../types/index"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './HorizontalBarChart';\nexport * from './HorizontalBarChart.types';\nexport * from '../../types/index';\n"],"names":[],"rangeMappings":";;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA"}
|