@fluentui/react-charts 0.0.0-nightly-20250423-0405.1 → 0.0.0-nightly-20250423-1415.1
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 +16 -16
- package/dist/index.d.ts +3337 -0
- package/lib/AreaChart.js +1 -0
- package/lib/AreaChart.js.map +1 -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/GaugeChart.js +1 -0
- package/lib/GaugeChart.js.map +1 -0
- package/lib/GroupedVerticalBarChart.js +1 -0
- package/lib/GroupedVerticalBarChart.js.map +1 -0
- package/lib/HeatMapChart.js +1 -0
- package/lib/HeatMapChart.js.map +1 -0
- package/lib/HorizontalBarChart.js +1 -0
- package/lib/HorizontalBarChart.js.map +1 -0
- package/lib/HorizontalBarChartWithAxis.js +1 -0
- package/lib/HorizontalBarChartWithAxis.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/SankeyChart.js +1 -0
- package/lib/SankeyChart.js.map +1 -0
- package/lib/ScatterChart.js +1 -0
- package/lib/ScatterChart.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/VerticalStackedBarChart.js +1 -0
- package/lib/VerticalStackedBarChart.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.js +775 -0
- package/lib/components/AreaChart/AreaChart.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.types.js +4 -0
- package/lib/components/AreaChart/AreaChart.types.js.map +1 -0
- package/lib/components/AreaChart/index.js +3 -0
- package/lib/components/AreaChart/index.js.map +1 -0
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +64 -0
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.js +478 -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 +197 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +811 -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/GaugeChart/GaugeChart.js +592 -0
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -0
- package/lib/components/GaugeChart/GaugeChart.types.js +4 -0
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -0
- package/lib/components/GaugeChart/index.js +3 -0
- package/lib/components/GaugeChart/index.js.map +1 -0
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +174 -0
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +501 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +4 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/index.js +3 -0
- package/lib/components/GroupedVerticalBarChart/index.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +90 -0
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -0
- package/lib/components/HeatMapChart/HeatMapChart.js +588 -0
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -0
- package/lib/components/HeatMapChart/HeatMapChart.types.js +4 -0
- package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
- package/lib/components/HeatMapChart/index.js +3 -0
- package/lib/components/HeatMapChart/index.js.map +1 -0
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +46 -0
- package/lib/components/HeatMapChart/useHeatMapChartStyles.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/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +571 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +4 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/index.js +3 -0
- package/lib/components/HorizontalBarChartWithAxis/index.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +76 -0
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
- package/lib/components/Legends/Legends.js +303 -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 +1034 -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/SankeyChart/SankeyChart.js +1022 -0
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -0
- package/lib/components/SankeyChart/SankeyChart.types.js +3 -0
- package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -0
- package/lib/components/SankeyChart/index.js +3 -0
- package/lib/components/SankeyChart/index.js.map +1 -0
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +109 -0
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
- package/lib/components/ScatterChart/ScatterChart.js +465 -0
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -0
- package/lib/components/ScatterChart/ScatterChart.types.js +4 -0
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -0
- package/lib/components/ScatterChart/index.js +3 -0
- package/lib/components/ScatterChart/index.js.map +1 -0
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +65 -0
- package/lib/components/ScatterChart/useScatterChartStyles.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 +926 -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/components/VerticalStackedBarChart/VerticalStackedBarChart.js +904 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +1 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/index.js +3 -0
- package/lib/components/VerticalStackedBarChart/index.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +73 -0
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
- package/lib/index.js +20 -0
- package/lib/index.js.map +1 -0
- package/lib/types/DataPoint.js +1 -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 -0
- package/lib/types/index.js.map +1 -0
- 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 +183 -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 +269 -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/string.js +32 -0
- package/lib/utilities/string.js.map +1 -0
- package/lib/utilities/test-data.js +329 -0
- package/lib/utilities/test-data.js.map +1 -0
- package/lib/utilities/utilities.js +1405 -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/AreaChart.js +6 -0
- package/lib-commonjs/AreaChart.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/GaugeChart.js +6 -0
- package/lib-commonjs/GaugeChart.js.map +1 -0
- package/lib-commonjs/GroupedVerticalBarChart.js +6 -0
- package/lib-commonjs/GroupedVerticalBarChart.js.map +1 -0
- package/lib-commonjs/HeatMapChart.js +6 -0
- package/lib-commonjs/HeatMapChart.js.map +1 -0
- package/lib-commonjs/HorizontalBarChart.js +6 -0
- package/lib-commonjs/HorizontalBarChart.js.map +1 -0
- package/lib-commonjs/HorizontalBarChartWithAxis.js +6 -0
- package/lib-commonjs/HorizontalBarChartWithAxis.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/SankeyChart.js +6 -0
- package/lib-commonjs/SankeyChart.js.map +1 -0
- package/lib-commonjs/ScatterChart.js +6 -0
- package/lib-commonjs/ScatterChart.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/VerticalStackedBarChart.js +6 -0
- package/lib-commonjs/VerticalStackedBarChart.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js +781 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.types.js +7 -0
- package/lib-commonjs/components/AreaChart/AreaChart.types.js.map +1 -0
- package/lib-commonjs/components/AreaChart/index.js +8 -0
- package/lib-commonjs/components/AreaChart/index.js.map +1 -0
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +104 -0
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +484 -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 +205 -0
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +859 -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/GaugeChart/GaugeChart.js +621 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js +7 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/index.js +8 -0
- package/lib-commonjs/components/GaugeChart/index.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +252 -0
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +507 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +7 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/index.js +8 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/index.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +139 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +599 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js +7 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/index.js +8 -0
- package/lib-commonjs/components/HeatMapChart/index.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +68 -0
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.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/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +580 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +7 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js +8 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +116 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.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 +1040 -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/SankeyChart/SankeyChart.js +1038 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js +6 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/index.js +8 -0
- package/lib-commonjs/components/SankeyChart/index.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +179 -0
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +471 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js +7 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/index.js +8 -0
- package/lib-commonjs/components/ScatterChart/index.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +96 -0
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.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 +928 -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/components/VerticalStackedBarChart/VerticalStackedBarChart.js +915 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +6 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/index.js +8 -0
- package/lib-commonjs/components/VerticalStackedBarChart/index.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +120 -0
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/index.js +25 -0
- package/lib-commonjs/index.js.map +1 -0
- package/lib-commonjs/types/DataPoint.js +4 -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 +193 -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 +293 -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/string.js +29 -0
- package/lib-commonjs/utilities/string.js.map +1 -0
- package/lib-commonjs/utilities/test-data.js +383 -0
- package/lib-commonjs/utilities/test-data.js.map +1 -0
- package/lib-commonjs/utilities/utilities.js +1371 -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 +13 -13
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","shorthands","tokens","typographyStyles","donutArcClassNames","root","focusRing","arcLabel","useStyles","Bceei9c","Bpd4iqm","ojy3ng","B4ncu3z","zxy5zd","bkw2yb","Bjksbd0","Be5yapy","Bkfmm31","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","d","useArcStyles","props","_props_styles","_props_styles1","_props_styles2","className","baseStyles","styles"],"sources":["useArcStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\n/**\n * @internal\n */ export const donutArcClassNames = {\n root: 'fui-donut-arc__root',\n focusRing: 'fui-donut-arc__focusRing',\n arcLabel: 'fui-donut-arc__arcLabel'\n};\n/**\n * Base Styles\n */ const useStyles = makeStyles({\n root: {\n cursor: 'default',\n ...shorthands.outline('transparent'),\n stroke: tokens.colorNeutralBackground1,\n '& selectors': {\n '::-moz-focus-inner': {\n ...shorthands.border('0')\n }\n }\n },\n focusRing: {\n stroke: tokens.colorStrokeFocus2,\n strokeWidth: tokens.strokeWidthThickest,\n fill: 'transparent'\n },\n arcLabel: {\n ...typographyStyles.caption1Strong,\n fill: tokens.colorNeutralForeground1\n }\n});\n/**\n * Apply styling to the Arc components\n */ export const useArcStyles = (props)=>{\n var _props_styles, _props_styles1, _props_styles2;\n const { className } = props;\n const baseStyles = useStyles();\n return {\n root: mergeClasses(donutArcClassNames.root, baseStyles.root, className, (_props_styles = props.styles) === null || _props_styles === void 0 ? void 0 : _props_styles.root),\n focusRing: mergeClasses(donutArcClassNames.focusRing, baseStyles.focusRing, (_props_styles1 = props.styles) === null || _props_styles1 === void 0 ? void 0 : _props_styles1.focusRing),\n arcLabel: mergeClasses(donutArcClassNames.arcLabel, baseStyles.arcLabel, (_props_styles2 = props.styles) === null || _props_styles2 === void 0 ? void 0 : _props_styles2.arcLabel)\n };\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACrE,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,uBAAuB;AAChE;AACA;AACA;AAAI,OAAO,MAAMC,kBAAkB,GAAG;EAClCC,IAAI,EAAE,qBAAqB;EAC3BC,SAAS,EAAE,0BAA0B;EACrCC,QAAQ,EAAE;AACd,CAAC;AACD;AACA;AACA;AAAI,MAAMC,SAAS,gBAAGT,QAAA;EAAAM,IAAA;IAAAI,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAT,SAAA;IAAAK,MAAA;IAAAK,OAAA;IAAAC,OAAA;EAAA;EAAAV,QAAA;IAAAW,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAJ,OAAA;EAAA;AAAA;EAAAK,CAAA;AAAA,CAoBrB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,YAAY,GAAIC,KAAK,IAAG;EACrC,IAAIC,aAAa,EAAEC,cAAc,EAAEC,cAAc;EACjD,MAAM;IAAEC;EAAU,CAAC,GAAGJ,KAAK;EAC3B,MAAMK,UAAU,GAAGrB,SAAS,CAAC,CAAC;EAC9B,OAAO;IACHH,IAAI,EAAEL,YAAY,CAACI,kBAAkB,CAACC,IAAI,EAAEwB,UAAU,CAACxB,IAAI,EAAEuB,SAAS,EAAE,CAACH,aAAa,GAAGD,KAAK,CAACM,MAAM,MAAM,IAAI,IAAIL,aAAa,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,aAAa,CAACpB,IAAI,CAAC;IAC1KC,SAAS,EAAEN,YAAY,CAACI,kBAAkB,CAACE,SAAS,EAAEuB,UAAU,CAACvB,SAAS,EAAE,CAACoB,cAAc,GAAGF,KAAK,CAACM,MAAM,MAAM,IAAI,IAAIJ,cAAc,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,cAAc,CAACpB,SAAS,CAAC;IACtLC,QAAQ,EAAEP,YAAY,CAACI,kBAAkB,CAACG,QAAQ,EAAEsB,UAAU,CAACtB,QAAQ,EAAE,CAACoB,cAAc,GAAGH,KAAK,CAACM,MAAM,MAAM,IAAI,IAAIH,cAAc,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,cAAc,CAACpB,QAAQ;EACrL,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-no-bind */ import * as React from 'react';
|
|
2
|
+
import { Pie } from './Pie/index';
|
|
3
|
+
import { useDonutChartStyles } from './useDonutChartStyles.styles';
|
|
4
|
+
import { convertToLocaleString } from '../../utilities/locale-util';
|
|
5
|
+
import { getColorFromToken, getNextColor } from '../../utilities/index';
|
|
6
|
+
import { Legends } from '../../index';
|
|
7
|
+
import { useId } from '@fluentui/react-utilities';
|
|
8
|
+
import { useFocusableGroup } from '@fluentui/react-tabster';
|
|
9
|
+
import { ChartPopover } from '../CommonComponents/ChartPopover';
|
|
10
|
+
const MIN_LEGEND_CONTAINER_HEIGHT = 40;
|
|
11
|
+
// Create a DonutChart variant which uses these default styles and this styled subcomponent.
|
|
12
|
+
/**
|
|
13
|
+
* Donutchart component.
|
|
14
|
+
* {@docCategory DonutChart}
|
|
15
|
+
*/ export const DonutChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
16
|
+
const _rootElem = React.useRef(null);
|
|
17
|
+
const _uniqText = useId('_Pie_');
|
|
18
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */ let _calloutAnchorPoint;
|
|
19
|
+
let _emptyChartId;
|
|
20
|
+
const legendContainer = React.useRef(null);
|
|
21
|
+
const prevSize = React.useRef({});
|
|
22
|
+
const [value, setValue] = React.useState('');
|
|
23
|
+
const [legend, setLegend] = React.useState('');
|
|
24
|
+
const [_width, setWidth] = React.useState(props.width || 200);
|
|
25
|
+
const [_height, setHeight] = React.useState(props.height || 200);
|
|
26
|
+
const [activeLegend, setActiveLegend] = React.useState('');
|
|
27
|
+
const [color, setColor] = React.useState('');
|
|
28
|
+
const [xCalloutValue, setXCalloutValue] = React.useState('');
|
|
29
|
+
const [yCalloutValue, setYCalloutValue] = React.useState('');
|
|
30
|
+
const [selectedLegend, setSelectedLegend] = React.useState('');
|
|
31
|
+
const [focusedArcId, setFocusedArcId] = React.useState('');
|
|
32
|
+
const [dataPointCalloutProps, setDataPointCalloutProps] = React.useState();
|
|
33
|
+
const [clickPosition, setClickPosition] = React.useState({
|
|
34
|
+
x: 0,
|
|
35
|
+
y: 0
|
|
36
|
+
});
|
|
37
|
+
const [isPopoverOpen, setPopoverOpen] = React.useState(false);
|
|
38
|
+
React.useEffect(()=>{
|
|
39
|
+
_fitParentContainer();
|
|
40
|
+
}, []);
|
|
41
|
+
React.useEffect(()=>{
|
|
42
|
+
if (prevSize.current.height !== props.height || prevSize.current.width !== props.width) {
|
|
43
|
+
_fitParentContainer();
|
|
44
|
+
}
|
|
45
|
+
prevSize.current.height = props.height;
|
|
46
|
+
prevSize.current.width = props.width;
|
|
47
|
+
}, [
|
|
48
|
+
props.width,
|
|
49
|
+
props.height
|
|
50
|
+
]);
|
|
51
|
+
React.useImperativeHandle(props.componentRef, ()=>({
|
|
52
|
+
chartContainer: _rootElem.current
|
|
53
|
+
}), []);
|
|
54
|
+
function _elevateToMinimums(data) {
|
|
55
|
+
let sumOfData = 0;
|
|
56
|
+
const minPercent = 0.01;
|
|
57
|
+
const elevatedData = [];
|
|
58
|
+
data.forEach((item)=>{
|
|
59
|
+
sumOfData += item.data;
|
|
60
|
+
});
|
|
61
|
+
data.forEach((item)=>{
|
|
62
|
+
elevatedData.push(minPercent * sumOfData > item.data && item.data > 0 ? {
|
|
63
|
+
...item,
|
|
64
|
+
data: minPercent * sumOfData,
|
|
65
|
+
yAxisCalloutData: item.yAxisCalloutData === undefined ? item.data.toLocaleString() : item.yAxisCalloutData
|
|
66
|
+
} : item);
|
|
67
|
+
});
|
|
68
|
+
return elevatedData;
|
|
69
|
+
}
|
|
70
|
+
function _createLegends(chartData) {
|
|
71
|
+
const legendDataItems = chartData.map((point, index)=>{
|
|
72
|
+
const color = point.color;
|
|
73
|
+
// mapping data to the format Legends component needs
|
|
74
|
+
const legend = {
|
|
75
|
+
title: point.legend,
|
|
76
|
+
color,
|
|
77
|
+
action: ()=>{
|
|
78
|
+
if (selectedLegend === point.legend) {
|
|
79
|
+
setSelectedLegend('');
|
|
80
|
+
} else {
|
|
81
|
+
setSelectedLegend(point.legend);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
hoverAction: ()=>{
|
|
85
|
+
_handleChartMouseLeave();
|
|
86
|
+
setActiveLegend(point.legend);
|
|
87
|
+
},
|
|
88
|
+
onMouseOutAction: ()=>{
|
|
89
|
+
setActiveLegend('');
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
return legend;
|
|
93
|
+
});
|
|
94
|
+
const legends = /*#__PURE__*/ React.createElement(Legends, {
|
|
95
|
+
legends: legendDataItems,
|
|
96
|
+
centerLegends: true,
|
|
97
|
+
overflowText: props.legendsOverflowText,
|
|
98
|
+
...props.legendProps
|
|
99
|
+
});
|
|
100
|
+
return legends;
|
|
101
|
+
}
|
|
102
|
+
function _focusCallback(data, id, element) {
|
|
103
|
+
setPopoverOpen(selectedLegend === '' || selectedLegend === data.legend);
|
|
104
|
+
setValue(data.data.toString());
|
|
105
|
+
setLegend(data.legend);
|
|
106
|
+
setColor(data.color);
|
|
107
|
+
setXCalloutValue(data.xAxisCalloutData);
|
|
108
|
+
setYCalloutValue(data.yAxisCalloutData);
|
|
109
|
+
setFocusedArcId(id);
|
|
110
|
+
setDataPointCalloutProps(data);
|
|
111
|
+
}
|
|
112
|
+
function _hoverCallback(data, e) {
|
|
113
|
+
if (_calloutAnchorPoint !== data) {
|
|
114
|
+
_calloutAnchorPoint = data;
|
|
115
|
+
setPopoverOpen(selectedLegend === '' || selectedLegend === data.legend);
|
|
116
|
+
setValue(data.data.toString());
|
|
117
|
+
setLegend(data.legend);
|
|
118
|
+
setColor(data.color);
|
|
119
|
+
setXCalloutValue(data.xAxisCalloutData);
|
|
120
|
+
setYCalloutValue(data.yAxisCalloutData);
|
|
121
|
+
setDataPointCalloutProps(data);
|
|
122
|
+
updatePosition(e.clientX, e.clientY);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function _onBlur() {
|
|
126
|
+
setFocusedArcId('');
|
|
127
|
+
}
|
|
128
|
+
function _hoverLeave() {
|
|
129
|
+
/**/ }
|
|
130
|
+
function _handleChartMouseLeave() {
|
|
131
|
+
_calloutAnchorPoint = null;
|
|
132
|
+
setPopoverOpen(false);
|
|
133
|
+
}
|
|
134
|
+
function _valueInsideDonut(valueInsideDonut, data) {
|
|
135
|
+
const highlightedLegend = _getHighlightedLegend();
|
|
136
|
+
if (valueInsideDonut !== undefined && (highlightedLegend !== '' || isPopoverOpen)) {
|
|
137
|
+
let legendValue = valueInsideDonut;
|
|
138
|
+
data.map((point, index)=>{
|
|
139
|
+
if (point.legend === highlightedLegend || isPopoverOpen && point.legend === legend) {
|
|
140
|
+
legendValue = point.yAxisCalloutData ? point.yAxisCalloutData : point.data;
|
|
141
|
+
}
|
|
142
|
+
return;
|
|
143
|
+
});
|
|
144
|
+
return legendValue;
|
|
145
|
+
} else {
|
|
146
|
+
return valueInsideDonut;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function _toLocaleString(data) {
|
|
150
|
+
const localeString = convertToLocaleString(data, props.culture);
|
|
151
|
+
if (!localeString) {
|
|
152
|
+
return data;
|
|
153
|
+
}
|
|
154
|
+
return localeString === null || localeString === void 0 ? void 0 : localeString.toString();
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* This function returns
|
|
158
|
+
* the selected legend if there is one
|
|
159
|
+
* or the hovered legend if none of the legends is selected.
|
|
160
|
+
* Note: This won't work in case of multiple legends selection.
|
|
161
|
+
*/ function _getHighlightedLegend() {
|
|
162
|
+
return selectedLegend || activeLegend;
|
|
163
|
+
}
|
|
164
|
+
function _isChartEmpty() {
|
|
165
|
+
return !(props.data && props.data.chartData && props.data.chartData.filter((d)=>d.data > 0).length > 0);
|
|
166
|
+
}
|
|
167
|
+
function _addDefaultColors(donutChartDataPoint) {
|
|
168
|
+
return donutChartDataPoint ? donutChartDataPoint.map((item, index)=>{
|
|
169
|
+
let defaultColor;
|
|
170
|
+
if (typeof item.color === 'undefined') {
|
|
171
|
+
defaultColor = getNextColor(index, 0);
|
|
172
|
+
} else {
|
|
173
|
+
defaultColor = getColorFromToken(item.color);
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
...item,
|
|
177
|
+
defaultColor
|
|
178
|
+
};
|
|
179
|
+
}) : [];
|
|
180
|
+
}
|
|
181
|
+
function updatePosition(newX, newY) {
|
|
182
|
+
const threshold = 1; // Set a threshold for movement
|
|
183
|
+
const { x, y } = clickPosition;
|
|
184
|
+
// Calculate the distance moved
|
|
185
|
+
const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));
|
|
186
|
+
// Update the position only if the distance moved is greater than the threshold
|
|
187
|
+
if (distance > threshold) {
|
|
188
|
+
setClickPosition({
|
|
189
|
+
x: newX,
|
|
190
|
+
y: newY
|
|
191
|
+
});
|
|
192
|
+
setPopoverOpen(true);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* When screen resizes, along with screen, chart also auto adjusted.
|
|
197
|
+
* This method used to adjust height and width of the charts.
|
|
198
|
+
*/ function _fitParentContainer() {
|
|
199
|
+
//_reqID = requestAnimationFrame(() => {
|
|
200
|
+
let legendContainerHeight;
|
|
201
|
+
if (props.hideLegend) {
|
|
202
|
+
// If there is no legend, need not to allocate some space from total chart space.
|
|
203
|
+
legendContainerHeight = 0;
|
|
204
|
+
} else {
|
|
205
|
+
const legendContainerComputedStyles = legendContainer.current && getComputedStyle(legendContainer.current);
|
|
206
|
+
legendContainerHeight = (legendContainer.current && legendContainer.current.getBoundingClientRect().height || MIN_LEGEND_CONTAINER_HEIGHT) + parseFloat(legendContainerComputedStyles && legendContainerComputedStyles.marginTop || '0') + parseFloat(legendContainerComputedStyles && legendContainerComputedStyles.marginBottom || '0');
|
|
207
|
+
}
|
|
208
|
+
if (props.parentRef || _rootElem.current) {
|
|
209
|
+
const container = props.parentRef ? props.parentRef : _rootElem.current;
|
|
210
|
+
const currentContainerWidth = container.getBoundingClientRect().width;
|
|
211
|
+
const currentContainerHeight = container.getBoundingClientRect().height > legendContainerHeight ? container.getBoundingClientRect().height : 200;
|
|
212
|
+
const shouldResize = _width !== currentContainerWidth || _height !== currentContainerHeight - legendContainerHeight;
|
|
213
|
+
if (shouldResize) {
|
|
214
|
+
setWidth(currentContainerWidth);
|
|
215
|
+
setHeight(currentContainerHeight - legendContainerHeight);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
//});
|
|
219
|
+
}
|
|
220
|
+
const { data, hideLegend = false } = props;
|
|
221
|
+
const points = _addDefaultColors(data === null || data === void 0 ? void 0 : data.chartData);
|
|
222
|
+
const classes = useDonutChartStyles(props);
|
|
223
|
+
const legendBars = _createLegends(points);
|
|
224
|
+
const donutMarginHorizontal = props.hideLabels ? 0 : 80;
|
|
225
|
+
const donutMarginVertical = props.hideLabels ? 0 : 40;
|
|
226
|
+
const outerRadius = Math.min(_width - donutMarginHorizontal, _height - donutMarginVertical) / 2;
|
|
227
|
+
const chartData = _elevateToMinimums(points.filter((d)=>d.data >= 0));
|
|
228
|
+
const valueInsideDonut = props.innerRadius !== 0 ? _valueInsideDonut(props.valueInsideDonut, chartData) : '';
|
|
229
|
+
const focusAttributes = useFocusableGroup();
|
|
230
|
+
var _props_culture;
|
|
231
|
+
return !_isChartEmpty() ? /*#__PURE__*/ React.createElement("div", {
|
|
232
|
+
className: classes.root,
|
|
233
|
+
ref: (rootElem)=>_rootElem.current = rootElem,
|
|
234
|
+
onMouseLeave: _handleChartMouseLeave
|
|
235
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
236
|
+
className: classes.chartWrapper,
|
|
237
|
+
...focusAttributes
|
|
238
|
+
}, /*#__PURE__*/ React.createElement("svg", {
|
|
239
|
+
className: classes.chart,
|
|
240
|
+
"aria-label": data === null || data === void 0 ? void 0 : data.chartTitle,
|
|
241
|
+
width: _width,
|
|
242
|
+
height: _height
|
|
243
|
+
}, /*#__PURE__*/ React.createElement(Pie, {
|
|
244
|
+
width: _width,
|
|
245
|
+
height: _height,
|
|
246
|
+
outerRadius: outerRadius,
|
|
247
|
+
innerRadius: props.innerRadius,
|
|
248
|
+
data: chartData,
|
|
249
|
+
onFocusCallback: _focusCallback,
|
|
250
|
+
hoverOnCallback: _hoverCallback,
|
|
251
|
+
hoverLeaveCallback: _hoverLeave,
|
|
252
|
+
uniqText: _uniqText,
|
|
253
|
+
onBlurCallback: _onBlur,
|
|
254
|
+
activeArc: _getHighlightedLegend(),
|
|
255
|
+
focusedArcId: focusedArcId || '',
|
|
256
|
+
href: props.href,
|
|
257
|
+
valueInsideDonut: _toLocaleString(valueInsideDonut),
|
|
258
|
+
showLabelsInPercent: props.showLabelsInPercent,
|
|
259
|
+
hideLabels: props.hideLabels
|
|
260
|
+
}))), /*#__PURE__*/ React.createElement(ChartPopover, {
|
|
261
|
+
xCalloutValue: xCalloutValue,
|
|
262
|
+
yCalloutValue: yCalloutValue,
|
|
263
|
+
culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
|
|
264
|
+
clickPosition: clickPosition,
|
|
265
|
+
isPopoverOpen: !props.hideTooltip && isPopoverOpen,
|
|
266
|
+
legend: legend,
|
|
267
|
+
YValue: value,
|
|
268
|
+
color: color,
|
|
269
|
+
isCalloutForStack: false,
|
|
270
|
+
customCallout: {
|
|
271
|
+
customizedCallout: props.onRenderCalloutPerDataPoint ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps) : undefined,
|
|
272
|
+
customCalloutProps: props.calloutPropsPerDataPoint ? props.calloutPropsPerDataPoint(dataPointCalloutProps) : undefined
|
|
273
|
+
},
|
|
274
|
+
isCartesian: false
|
|
275
|
+
}), !hideLegend && /*#__PURE__*/ React.createElement("div", {
|
|
276
|
+
ref: (e)=>legendContainer.current = e,
|
|
277
|
+
className: classes.legendContainer
|
|
278
|
+
}, legendBars)) : /*#__PURE__*/ React.createElement("div", {
|
|
279
|
+
id: _emptyChartId,
|
|
280
|
+
role: 'alert',
|
|
281
|
+
style: {
|
|
282
|
+
opacity: '0'
|
|
283
|
+
},
|
|
284
|
+
"aria-label": 'Graph has no data to display'
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
DonutChart.displayName = 'DonutChart';
|
|
288
|
+
DonutChart.defaultProps = {
|
|
289
|
+
innerRadius: 0,
|
|
290
|
+
hideLabels: true
|
|
291
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["DonutChart.tsx"],"sourcesContent":["/* eslint-disable react/jsx-no-bind */\nimport * as React from 'react';\nimport { Pie } from './Pie/index';\nimport { DonutChartProps } from './DonutChart.types';\nimport { useDonutChartStyles } from './useDonutChartStyles.styles';\nimport { ChartDataPoint } from '../../DonutChart';\nimport { convertToLocaleString } from '../../utilities/locale-util';\nimport { getColorFromToken, getNextColor } from '../../utilities/index';\nimport { Legend, Legends } from '../../index';\nimport { useId } from '@fluentui/react-utilities';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\n\nconst MIN_LEGEND_CONTAINER_HEIGHT = 40;\n\n// Create a DonutChart variant which uses these default styles and this styled subcomponent.\n/**\n * Donutchart component.\n * {@docCategory DonutChart}\n */\nexport const DonutChart: React.FunctionComponent<DonutChartProps> = React.forwardRef<HTMLDivElement, DonutChartProps>(\n (props, forwardedRef) => {\n const _rootElem = React.useRef<HTMLDivElement | null>(null);\n const _uniqText: string = useId('_Pie_');\n /* eslint-disable @typescript-eslint/no-explicit-any */\n let _calloutAnchorPoint: ChartDataPoint | null;\n let _emptyChartId: string | null;\n const legendContainer = React.useRef<HTMLDivElement | null>(null);\n const prevSize = React.useRef<{ width?: number; height?: number }>({});\n\n const [value, setValue] = React.useState<string | undefined>('');\n const [legend, setLegend] = React.useState<string | undefined>('');\n const [_width, setWidth] = React.useState<number | undefined>(props.width || 200);\n const [_height, setHeight] = React.useState<number | undefined>(props.height || 200);\n const [activeLegend, setActiveLegend] = React.useState<string>('');\n const [color, setColor] = React.useState<string | undefined>('');\n const [xCalloutValue, setXCalloutValue] = React.useState<string>('');\n const [yCalloutValue, setYCalloutValue] = React.useState<string>('');\n const [selectedLegend, setSelectedLegend] = React.useState<string>('');\n const [focusedArcId, setFocusedArcId] = React.useState<string>('');\n const [dataPointCalloutProps, setDataPointCalloutProps] = React.useState<ChartDataPoint | undefined>();\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n\n React.useEffect(() => {\n _fitParentContainer();\n }, []);\n\n React.useEffect(() => {\n if (prevSize.current.height !== props.height || prevSize.current.width !== props.width) {\n _fitParentContainer();\n }\n prevSize.current.height = props.height;\n prevSize.current.width = props.width;\n }, [props.width, props.height]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: _rootElem.current,\n }),\n [],\n );\n\n function _elevateToMinimums(data: ChartDataPoint[]) {\n let sumOfData = 0;\n const minPercent = 0.01;\n const elevatedData: ChartDataPoint[] = [];\n data.forEach(item => {\n sumOfData += item.data!;\n });\n data.forEach(item => {\n elevatedData.push(\n minPercent * sumOfData > item.data! && item.data! > 0\n ? {\n ...item,\n data: minPercent * sumOfData,\n yAxisCalloutData:\n item.yAxisCalloutData === undefined ? item.data!.toLocaleString() : item.yAxisCalloutData,\n }\n : item,\n );\n });\n return elevatedData;\n }\n function _createLegends(chartData: ChartDataPoint[]): JSX.Element {\n const legendDataItems = chartData.map((point: ChartDataPoint, index: number) => {\n const color: string = point.color!;\n // mapping data to the format Legends component needs\n const legend: Legend = {\n title: point.legend!,\n color,\n action: () => {\n if (selectedLegend === point.legend) {\n setSelectedLegend('');\n } else {\n setSelectedLegend(point.legend!);\n }\n },\n hoverAction: () => {\n _handleChartMouseLeave();\n setActiveLegend(point.legend!);\n },\n onMouseOutAction: () => {\n setActiveLegend('');\n },\n };\n return legend;\n });\n const legends = (\n <Legends\n legends={legendDataItems}\n centerLegends\n overflowText={props.legendsOverflowText}\n {...props.legendProps}\n />\n );\n return legends;\n }\n\n function _focusCallback(data: ChartDataPoint, id: string, element: SVGPathElement): void {\n setPopoverOpen(selectedLegend === '' || selectedLegend === data.legend);\n setValue(data.data!.toString());\n setLegend(data.legend);\n setColor(data.color!);\n setXCalloutValue(data.xAxisCalloutData!);\n setYCalloutValue(data.yAxisCalloutData!);\n setFocusedArcId(id);\n setDataPointCalloutProps(data);\n }\n\n function _hoverCallback(data: ChartDataPoint, e: React.MouseEvent<SVGPathElement>): void {\n if (_calloutAnchorPoint !== data) {\n _calloutAnchorPoint = data;\n setPopoverOpen(selectedLegend === '' || selectedLegend === data.legend);\n setValue(data.data!.toString());\n setLegend(data.legend);\n setColor(data.color!);\n setXCalloutValue(data.xAxisCalloutData!);\n setYCalloutValue(data.yAxisCalloutData!);\n setDataPointCalloutProps(data);\n updatePosition(e.clientX, e.clientY);\n }\n }\n function _onBlur(): void {\n setFocusedArcId('');\n }\n\n function _hoverLeave(): void {\n /**/\n }\n\n function _handleChartMouseLeave() {\n _calloutAnchorPoint = null;\n setPopoverOpen(false);\n }\n\n function _valueInsideDonut(valueInsideDonut: string | number | undefined, data: ChartDataPoint[]) {\n const highlightedLegend = _getHighlightedLegend();\n if (valueInsideDonut !== undefined && (highlightedLegend !== '' || isPopoverOpen)) {\n let legendValue = valueInsideDonut;\n data!.map((point: ChartDataPoint, index: number) => {\n if (point.legend === highlightedLegend || (isPopoverOpen && point.legend === legend)) {\n legendValue = point.yAxisCalloutData ? point.yAxisCalloutData : point.data!;\n }\n return;\n });\n return legendValue;\n } else {\n return valueInsideDonut;\n }\n }\n\n function _toLocaleString(data: string | number | undefined) {\n const localeString = convertToLocaleString(data, props.culture);\n if (!localeString) {\n return data;\n }\n return localeString?.toString();\n }\n\n /**\n * This function returns\n * the selected legend if there is one\n * or the hovered legend if none of the legends is selected.\n * Note: This won't work in case of multiple legends selection.\n */\n function _getHighlightedLegend() {\n return selectedLegend || activeLegend;\n }\n\n function _isChartEmpty(): boolean {\n return !(\n props.data &&\n props.data.chartData &&\n props.data.chartData!.filter((d: ChartDataPoint) => d.data! > 0).length > 0\n );\n }\n\n function _addDefaultColors(donutChartDataPoint?: ChartDataPoint[]): ChartDataPoint[] {\n return donutChartDataPoint\n ? donutChartDataPoint.map((item, index) => {\n let defaultColor: string;\n if (typeof item.color === 'undefined') {\n defaultColor = getNextColor(index, 0);\n } else {\n defaultColor = getColorFromToken(item.color);\n }\n return { ...item, defaultColor };\n })\n : [];\n }\n\n function updatePosition(newX: number, newY: number) {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\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 /**\n * When screen resizes, along with screen, chart also auto adjusted.\n * This method used to adjust height and width of the charts.\n */\n function _fitParentContainer(): void {\n //_reqID = requestAnimationFrame(() => {\n let legendContainerHeight;\n if (props.hideLegend) {\n // If there is no legend, need not to allocate some space from total chart space.\n legendContainerHeight = 0;\n } else {\n const legendContainerComputedStyles = legendContainer.current && getComputedStyle(legendContainer.current);\n legendContainerHeight =\n ((legendContainer.current && legendContainer.current.getBoundingClientRect().height) ||\n MIN_LEGEND_CONTAINER_HEIGHT) +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginTop) || '0') +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginBottom) || '0');\n }\n if (props.parentRef || _rootElem.current) {\n const container = props.parentRef ? props.parentRef : _rootElem.current!;\n const currentContainerWidth = container.getBoundingClientRect().width;\n const currentContainerHeight =\n container.getBoundingClientRect().height > legendContainerHeight\n ? container.getBoundingClientRect().height\n : 200;\n const shouldResize =\n _width !== currentContainerWidth || _height !== currentContainerHeight - legendContainerHeight;\n if (shouldResize) {\n setWidth(currentContainerWidth);\n setHeight(currentContainerHeight - legendContainerHeight);\n }\n }\n //});\n }\n\n const { data, hideLegend = false } = props;\n const points = _addDefaultColors(data?.chartData);\n\n const classes = useDonutChartStyles(props);\n\n const legendBars = _createLegends(points);\n const donutMarginHorizontal = props.hideLabels ? 0 : 80;\n const donutMarginVertical = props.hideLabels ? 0 : 40;\n const outerRadius = Math.min(_width! - donutMarginHorizontal, _height! - donutMarginVertical) / 2;\n const chartData = _elevateToMinimums(points.filter((d: ChartDataPoint) => d.data! >= 0));\n const valueInsideDonut = props.innerRadius !== 0 ? _valueInsideDonut(props.valueInsideDonut!, chartData!) : '';\n const focusAttributes = useFocusableGroup();\n return !_isChartEmpty() ? (\n <div\n className={classes.root}\n ref={(rootElem: HTMLDivElement | null) => (_rootElem.current = rootElem)}\n onMouseLeave={_handleChartMouseLeave}\n >\n <div className={classes.chartWrapper} {...focusAttributes}>\n <svg className={classes.chart} aria-label={data?.chartTitle} width={_width} height={_height}>\n <Pie\n width={_width!}\n height={_height!}\n outerRadius={outerRadius}\n innerRadius={props.innerRadius!}\n data={chartData!}\n onFocusCallback={_focusCallback}\n hoverOnCallback={_hoverCallback}\n hoverLeaveCallback={_hoverLeave}\n uniqText={_uniqText}\n onBlurCallback={_onBlur}\n activeArc={_getHighlightedLegend()}\n focusedArcId={focusedArcId || ''}\n href={props.href!}\n valueInsideDonut={_toLocaleString(valueInsideDonut)}\n showLabelsInPercent={props.showLabelsInPercent}\n hideLabels={props.hideLabels}\n />\n </svg>\n </div>\n <ChartPopover\n xCalloutValue={xCalloutValue}\n yCalloutValue={yCalloutValue}\n culture={props.culture ?? 'en-us'}\n clickPosition={clickPosition}\n isPopoverOpen={!props.hideTooltip && isPopoverOpen}\n legend={legend!}\n YValue={value!}\n color={color}\n isCalloutForStack={false}\n customCallout={{\n customizedCallout: props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps!)\n : undefined,\n customCalloutProps: props.calloutPropsPerDataPoint\n ? props.calloutPropsPerDataPoint(dataPointCalloutProps!)\n : undefined,\n }}\n isCartesian={false}\n />\n {!hideLegend && (\n <div ref={(e: HTMLDivElement) => (legendContainer.current = e)} className={classes.legendContainer}>\n {legendBars}\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 },\n);\n\nDonutChart.displayName = 'DonutChart';\nDonutChart.defaultProps = {\n innerRadius: 0,\n hideLabels: true,\n};\n"],"names":["React","Pie","useDonutChartStyles","convertToLocaleString","getColorFromToken","getNextColor","Legends","useId","useFocusableGroup","ChartPopover","MIN_LEGEND_CONTAINER_HEIGHT","DonutChart","forwardRef","props","forwardedRef","_rootElem","useRef","_uniqText","_calloutAnchorPoint","_emptyChartId","legendContainer","prevSize","value","setValue","useState","legend","setLegend","_width","setWidth","width","_height","setHeight","height","activeLegend","setActiveLegend","color","setColor","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","selectedLegend","setSelectedLegend","focusedArcId","setFocusedArcId","dataPointCalloutProps","setDataPointCalloutProps","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","useEffect","_fitParentContainer","current","useImperativeHandle","componentRef","chartContainer","_elevateToMinimums","data","sumOfData","minPercent","elevatedData","forEach","item","push","yAxisCalloutData","undefined","toLocaleString","_createLegends","chartData","legendDataItems","map","point","index","title","action","hoverAction","_handleChartMouseLeave","onMouseOutAction","legends","centerLegends","overflowText","legendsOverflowText","legendProps","_focusCallback","id","element","toString","xAxisCalloutData","_hoverCallback","e","updatePosition","clientX","clientY","_onBlur","_hoverLeave","_valueInsideDonut","valueInsideDonut","highlightedLegend","_getHighlightedLegend","legendValue","_toLocaleString","localeString","culture","_isChartEmpty","filter","d","length","_addDefaultColors","donutChartDataPoint","defaultColor","newX","newY","threshold","distance","Math","sqrt","pow","legendContainerHeight","hideLegend","legendContainerComputedStyles","getComputedStyle","getBoundingClientRect","parseFloat","marginTop","marginBottom","parentRef","container","currentContainerWidth","currentContainerHeight","shouldResize","points","classes","legendBars","donutMarginHorizontal","hideLabels","donutMarginVertical","outerRadius","min","innerRadius","focusAttributes","div","className","root","ref","rootElem","onMouseLeave","chartWrapper","svg","chart","aria-label","chartTitle","onFocusCallback","hoverOnCallback","hoverLeaveCallback","uniqText","onBlurCallback","activeArc","href","showLabelsInPercent","hideTooltip","YValue","isCalloutForStack","customCallout","customizedCallout","onRenderCalloutPerDataPoint","customCalloutProps","calloutPropsPerDataPoint","isCartesian","role","style","opacity","displayName","defaultProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,"sources":["DonutChart.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { CartesianChartStyleProps } from '../CommonComponents/index';\nimport { ChartProps, ChartDataPoint, Chart } from './index';\nimport { ChartPopoverProps } from '../CommonComponents/ChartPopover.types';\nimport { LegendsProps } from '../Legends/index';\n\n/**\n * Donut Chart properties.\n * {@docCategory DonutChart}\n */\nexport interface DonutChartProps {\n /**\n * Data to render in the chart.\n */\n data?: ChartProps;\n\n /**\n * inner radius for donut size\n */\n innerRadius?: number;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: DonutChartStyles;\n\n /**\n * props for inside donut value\n */\n valueInsideDonut?: string | number;\n\n /**\n * Define a custom callout renderer for a data point\n */\n onRenderCalloutPerDataPoint?: (dataPointCalloutProps: ChartDataPoint) => JSX.Element | undefined;\n\n /**\n * Define a custom callout props override\n */\n calloutPropsPerDataPoint?: (dataPointCalloutProps: ChartDataPoint) => ChartPopoverProps;\n\n /**\n * props for the callout in the chart\n */\n calloutProps?: ChartPopoverProps;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n\n /**\n * Prop to show the arc labels in percentage format\n * @default false\n */\n showLabelsInPercent?: boolean;\n\n /**\n * Prop to hide the arc labels\n * @default true\n */\n hideLabels?: boolean;\n\n /**\n * Below height used for resizing of the chart\n * Wrap chart in your container and send the updated height and width to these props.\n * These values decide wheather chart re render or not. Please check examples for reference\n */\n height?: number;\n\n /**\n * Below width used for resizing of the chart\n * Wrap chart in your container and send the updated height and width to these props.\n * These values decide wheather chart re render or not. Please check examples for reference\n */\n width?: number;\n\n /**\n * this prop takes its parent as a HTML element to define the width and height of the chart\n */\n parentRef?: HTMLElement | null;\n\n /**\n * Additional CSS class(es) to apply to the Chart.\n */\n className?: string;\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 /** decides wether to show/hide legends\n * @defaultvalue false\n */\n hideLegend?: boolean;\n\n /**\n * Url that the data-viz needs to redirect to upon clicking on it\n */\n href?: string;\n\n /**\n * Do not show tooltips in chart\n * @default false\n */\n hideTooltip?: boolean;\n\n /**\n * Optional callback to access the Chart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<Chart>;\n}\n\n/**\n * Donut Chart style properties\n * {@docCategory DonutChart}\n */\nexport interface DonutChartStyleProps extends CartesianChartStyleProps {}\n\n/**\n * Donut Chart styles\n * {@docCategory DonutChart}\n */\nexport interface DonutChartStyles {\n /**\n * Style for the root element.\n */\n root?: string;\n\n /**\n * Style for the chart.\n */\n chart?: string;\n /**\n * Style for the legend container.\n */\n legendContainer: string;\n\n /**\n * Styles for the chart wrapper div\n */\n chartWrapper?: string;\n}\n"],"names":["React"],"rangeMappings":"","mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/exhaustive-deps */ /* eslint-disable react/jsx-no-bind */ /* eslint-disable @typescript-eslint/no-explicit-any */ import * as React from 'react';
|
|
2
|
+
import { pie as d3Pie } from 'd3-shape';
|
|
3
|
+
import { Arc } from '../Arc/index';
|
|
4
|
+
import { usePieStyles } from './usePieStyles.styles';
|
|
5
|
+
import { wrapTextInsideDonut } from '../../../utilities/index';
|
|
6
|
+
const TEXT_PADDING = 5;
|
|
7
|
+
// Create a Pie within Donut Chart variant which uses these default styles and this styled subcomponent.
|
|
8
|
+
/**
|
|
9
|
+
* Pie component within Donut Chart.
|
|
10
|
+
* {@docCategory PieDonutChart}
|
|
11
|
+
*/ export const Pie = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
12
|
+
React.useEffect(()=>{
|
|
13
|
+
wrapTextInsideDonut(classes.insideDonutString, props.innerRadius * 2 - TEXT_PADDING);
|
|
14
|
+
}, []);
|
|
15
|
+
let _totalValue;
|
|
16
|
+
const classes = usePieStyles(props);
|
|
17
|
+
const pieForFocusRing = d3Pie().sort(null)// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
+
.value((d)=>d.data).padAngle(0);
|
|
19
|
+
function _focusCallback(data, id, e) {
|
|
20
|
+
props.onFocusCallback(data, id, e);
|
|
21
|
+
}
|
|
22
|
+
function _hoverCallback(data, e) {
|
|
23
|
+
props.hoverOnCallback(data, e);
|
|
24
|
+
}
|
|
25
|
+
function _computeTotalValue() {
|
|
26
|
+
let totalValue = 0;
|
|
27
|
+
props.data.forEach((arc)=>{
|
|
28
|
+
totalValue += arc.data;
|
|
29
|
+
});
|
|
30
|
+
return totalValue;
|
|
31
|
+
}
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
+
function arcGenerator(d, i, focusData, href) {
|
|
34
|
+
const color = d && d.data && d.data.color;
|
|
35
|
+
return /*#__PURE__*/ React.createElement(Arc, {
|
|
36
|
+
key: i,
|
|
37
|
+
data: d,
|
|
38
|
+
focusData: focusData,
|
|
39
|
+
innerRadius: props.innerRadius,
|
|
40
|
+
outerRadius: props.outerRadius,
|
|
41
|
+
color: color,
|
|
42
|
+
onFocusCallback: _focusCallback,
|
|
43
|
+
hoverOnCallback: _hoverCallback,
|
|
44
|
+
onBlurCallback: props.onBlurCallback,
|
|
45
|
+
hoverLeaveCallback: props.hoverLeaveCallback,
|
|
46
|
+
uniqText: props.uniqText,
|
|
47
|
+
activeArc: props.activeArc,
|
|
48
|
+
href: href,
|
|
49
|
+
calloutId: props.calloutId,
|
|
50
|
+
valueInsideDonut: props.valueInsideDonut,
|
|
51
|
+
focusedArcId: props.focusedArcId,
|
|
52
|
+
showLabelsInPercent: props.showLabelsInPercent,
|
|
53
|
+
totalValue: _totalValue,
|
|
54
|
+
hideLabels: props.hideLabels
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const { data } = props;
|
|
58
|
+
const focusData = pieForFocusRing(data.map((d)=>d.data));
|
|
59
|
+
const piechart = d3Pie().sort(null)// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
|
+
.value((d)=>d.data).padAngle(0.02)(data);
|
|
61
|
+
const translate = `translate(${props.width / 2}, ${props.height / 2})`;
|
|
62
|
+
_totalValue = _computeTotalValue();
|
|
63
|
+
return /*#__PURE__*/ React.createElement("g", {
|
|
64
|
+
transform: translate
|
|
65
|
+
}, piechart.map((d, i)=>arcGenerator(d, i, focusData[i], props.href)), props.valueInsideDonut && /*#__PURE__*/ React.createElement("text", {
|
|
66
|
+
y: 5,
|
|
67
|
+
textAnchor: "middle",
|
|
68
|
+
dominantBaseline: "middle",
|
|
69
|
+
className: classes.insideDonutString
|
|
70
|
+
}, props.valueInsideDonut));
|
|
71
|
+
});
|
|
72
|
+
Pie.displayName = 'Pie';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Pie.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\n/* eslint-disable react/jsx-no-bind */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport { pie as d3Pie } from 'd3-shape';\nimport { PieProps } from './index';\nimport { Arc } from '../Arc/index';\nimport { ChartDataPoint } from '../index';\nimport { usePieStyles } from './usePieStyles.styles';\nimport { wrapTextInsideDonut } from '../../../utilities/index';\nconst TEXT_PADDING: number = 5;\n\n// Create a Pie within Donut Chart variant which uses these default styles and this styled subcomponent.\n/**\n * Pie component within Donut Chart.\n * {@docCategory PieDonutChart}\n */\nexport const Pie: React.FunctionComponent<PieProps> = React.forwardRef<HTMLDivElement, PieProps>(\n (props, forwardedRef) => {\n React.useEffect(() => {\n wrapTextInsideDonut(classes.insideDonutString, props.innerRadius! * 2 - TEXT_PADDING);\n }, []);\n\n let _totalValue: number;\n const classes = usePieStyles(props);\n const pieForFocusRing = d3Pie()\n .sort(null)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .value((d: any) => d.data)\n .padAngle(0);\n\n function _focusCallback(data: ChartDataPoint, id: string, e: SVGPathElement): void {\n props.onFocusCallback!(data, id, e);\n }\n\n function _hoverCallback(data: ChartDataPoint, e: React.MouseEvent<SVGPathElement>): void {\n props.hoverOnCallback!(data, e);\n }\n\n function _computeTotalValue() {\n let totalValue = 0;\n props.data.forEach((arc: ChartDataPoint) => {\n totalValue += arc.data!;\n });\n return totalValue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function arcGenerator(d: any, i: number, focusData: any, href?: string): JSX.Element {\n const color = d && d.data && d.data.color;\n return (\n <Arc\n key={i}\n data={d}\n focusData={focusData}\n innerRadius={props.innerRadius}\n outerRadius={props.outerRadius}\n color={color!}\n onFocusCallback={_focusCallback}\n hoverOnCallback={_hoverCallback}\n onBlurCallback={props.onBlurCallback}\n hoverLeaveCallback={props.hoverLeaveCallback}\n uniqText={props.uniqText}\n activeArc={props.activeArc}\n href={href}\n calloutId={props.calloutId}\n valueInsideDonut={props.valueInsideDonut}\n focusedArcId={props.focusedArcId}\n showLabelsInPercent={props.showLabelsInPercent}\n totalValue={_totalValue}\n hideLabels={props.hideLabels}\n />\n );\n }\n\n const { data } = props;\n const focusData = pieForFocusRing(data.map(d => d.data!));\n\n const piechart = d3Pie<ChartDataPoint>()\n .sort(null)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .value((d: any) => d.data)\n .padAngle(0.02)(data);\n const translate = `translate(${props.width / 2}, ${props.height / 2})`;\n\n _totalValue = _computeTotalValue();\n\n return (\n <g transform={translate}>\n {piechart.map((d: any, i: number) => arcGenerator(d, i, focusData[i], props.href))}\n {props.valueInsideDonut && (\n <text y={5} textAnchor=\"middle\" dominantBaseline=\"middle\" className={classes.insideDonutString}>\n {props.valueInsideDonut}\n </text>\n )}\n </g>\n );\n },\n);\nPie.displayName = 'Pie';\n"],"names":["React","pie","d3Pie","Arc","usePieStyles","wrapTextInsideDonut","TEXT_PADDING","Pie","forwardRef","props","forwardedRef","useEffect","classes","insideDonutString","innerRadius","_totalValue","pieForFocusRing","sort","value","d","data","padAngle","_focusCallback","id","e","onFocusCallback","_hoverCallback","hoverOnCallback","_computeTotalValue","totalValue","forEach","arc","arcGenerator","i","focusData","href","color","key","outerRadius","onBlurCallback","hoverLeaveCallback","uniqText","activeArc","calloutId","valueInsideDonut","focusedArcId","showLabelsInPercent","hideLabels","map","piechart","translate","width","height","g","transform","text","y","textAnchor","dominantBaseline","className","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,8CAA8C,GAC9C,oCAAoC,GACpC,qDAAqD,GACrD,YAAYA,WAAW,QAAQ;AAC/B,SAASC,OAAOC,KAAK,QAAQ,WAAW;AAExC,SAASC,GAAG,QAAQ,eAAe;AAEnC,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,mBAAmB,QAAQ,2BAA2B;AAC/D,MAAMC,eAAuB;AAE7B,wGAAwG;AACxG;;;CAGC,GACD,OAAO,MAAMC,oBAAyCP,MAAMQ,UAAU,CACpE,CAACC,OAAOC;IACNV,MAAMW,SAAS,CAAC;QACdN,oBAAoBO,QAAQC,iBAAiB,EAAEJ,MAAMK,WAAW,GAAI,IAAIR;IAC1E,GAAG,EAAE;IAEL,IAAIS;IACJ,MAAMH,UAAUR,aAAaK;IAC7B,MAAMO,kBAAkBd,QACrBe,IAAI,CAAC,KACN,8DAA8D;KAC7DC,KAAK,CAAC,CAACC,IAAWA,EAAEC,IAAI,EACxBC,QAAQ,CAAC;IAEZ,SAASC,eAAeF,IAAoB,EAAEG,EAAU,EAAEC,CAAiB;QACzEf,MAAMgB,eAAe,CAAEL,MAAMG,IAAIC;IACnC;IAEA,SAASE,eAAeN,IAAoB,EAAEI,CAAmC;QAC/Ef,MAAMkB,eAAe,CAAEP,MAAMI;IAC/B;IAEA,SAASI;QACP,IAAIC,aAAa;QACjBpB,MAAMW,IAAI,CAACU,OAAO,CAAC,CAACC;YAClBF,cAAcE,IAAIX,IAAI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AgB,kBACrB,oBAACW;QAAKC,GAAG;QAAGC,YAAW;QAASC,kBAAiB;QAASC,WAAW/C,QAAQC,iBAAiB;OAC3FJ,MAAMmC,gBAAgB;AAKjC,GACA;AACFrC,IAAIqD,WAAW,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Pie.types.ts"],"sourcesContent":["import { ChartDataPoint } from '../index';\n\nexport interface PieProps {\n /**\n * Width of the Pie.\n */\n width: number;\n /**\n * Height of the Pie.\n */\n height: number;\n /**\n * outerRadius of the Pie.\n */\n outerRadius: number;\n /**\n * innerRadius of the Pie.\n */\n innerRadius: number;\n /**\n * Data to render in the Pie.\n */\n data: ChartDataPoint[];\n /**\n * shape for pie.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n pie?: any;\n\n pieForFocusRing?: any;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n hoverOnCallback?: Function;\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n onFocusCallback?: Function;\n /**\n * Defines the function that is executed upon hovering Leave the legend\n */\n onBlurCallback?: Function;\n /**\n * Defines the function that is executed upon hovering Leave the legend\n */\n hoverLeaveCallback?: Function;\n /**\n * Uniq string for chart\n */\n uniqText?: string;\n /**\n * Active Arc for chart\n */\n activeArc?: string;\n\n /**\n * string for callout id\n */\n calloutId?: string;\n\n /**\n * internal prop for href\n */\n href?: string;\n\n /**\n * props for inside donut value\n */\n valueInsideDonut?: string | number;\n\n /**\n * id of the focused arc\n */\n focusedArcId?: string;\n\n /**\n * Prop to show the arc labels in percentage format\n */\n showLabelsInPercent?: boolean;\n\n /**\n * Prop to hide the arc labels\n */\n hideLabels?: boolean;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: PieStyles;\n\n /**\n * Additional CSS class(es) to apply to the Chart.\n */\n className?: string;\n}\n\nexport interface PieStyles {\n /**\n * Style set for the card header component root\n */\n root: string;\n\n /**\n * Style set for the inside donut string\n */\n insideDonutString: string;\n}\n"],"names":[],"rangeMappings":"","mappings":"AAiGA,WAUC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Pie';\nexport * from './Pie.types';\n"],"names":[],"rangeMappings":";","mappings":"AAAA,cAAc,QAAQ;AACtB,cAAc,cAAc"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { tokens, typographyStyles } from '@fluentui/react-theme';
|
|
2
|
+
import { HighContrastSelectorBlack } from '../../../utilities/index';
|
|
3
|
+
import { __styles, mergeClasses } from '@griffel/react';
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export const donutPieClassNames = {
|
|
8
|
+
root: 'fui-donut-pie__root',
|
|
9
|
+
insideDonutString: 'fui-donut-pie__insideDonutString'
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Base Styles
|
|
13
|
+
*/
|
|
14
|
+
const useStyles = /*#__PURE__*/__styles({
|
|
15
|
+
root: {},
|
|
16
|
+
insideDonutString: {
|
|
17
|
+
Bahqtrf: "fk6fouc",
|
|
18
|
+
Be2twd7: "fojgt09",
|
|
19
|
+
Bhrd7zp: "fl43uef",
|
|
20
|
+
Bg96gwp: "fcen8rp",
|
|
21
|
+
Bkfmm31: "fhuob2q",
|
|
22
|
+
Bcjfw9x: "fy323tu"
|
|
23
|
+
}
|
|
24
|
+
}, {
|
|
25
|
+
d: [".fk6fouc{font-family:var(--fontFamilyBase);}", ".fojgt09{font-size:var(--fontSizeHero700);}", ".fl43uef{font-weight:var(--fontWeightSemibold);}", ".fcen8rp{line-height:var(--lineHeightHero700);}", ".fhuob2q{fill:var(--colorNeutralForeground1);}"],
|
|
26
|
+
m: [["@media screen and (-ms-high-contrast: white-on-black),screen and (forced-colors: active) and (prefers-color-scheme: dark){.fy323tu{fill:rgb(179, 179, 179);}}", {
|
|
27
|
+
m: "screen and (-ms-high-contrast: white-on-black), screen and (forced-colors: active) and (prefers-color-scheme: dark)"
|
|
28
|
+
}]]
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Apply styling to the Pie inside donut chart component
|
|
32
|
+
*/
|
|
33
|
+
export const usePieStyles = props => {
|
|
34
|
+
var _props_styles, _props_styles1;
|
|
35
|
+
const {
|
|
36
|
+
className
|
|
37
|
+
} = props;
|
|
38
|
+
const baseStyles = useStyles();
|
|
39
|
+
return {
|
|
40
|
+
root: mergeClasses(donutPieClassNames.root, baseStyles.root, className, (_props_styles = props.styles) === null || _props_styles === void 0 ? void 0 : _props_styles.root),
|
|
41
|
+
insideDonutString: mergeClasses(donutPieClassNames.insideDonutString, baseStyles.insideDonutString, className, (_props_styles1 = props.styles) === null || _props_styles1 === void 0 ? void 0 : _props_styles1.insideDonutString)
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=usePieStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["tokens","typographyStyles","HighContrastSelectorBlack","__styles","mergeClasses","donutPieClassNames","root","insideDonutString","useStyles","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","Bkfmm31","Bcjfw9x","d","m","usePieStyles","props","_props_styles","_props_styles1","className","baseStyles","styles"],"sources":["usePieStyles.styles.js"],"sourcesContent":["import { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { HighContrastSelectorBlack } from '../../../utilities/index';\nimport { makeStyles, mergeClasses } from '@griffel/react';\n/**\n * @internal\n */ export const donutPieClassNames = {\n root: 'fui-donut-pie__root',\n insideDonutString: 'fui-donut-pie__insideDonutString'\n};\n/**\n * Base Styles\n */ const useStyles = makeStyles({\n root: {},\n insideDonutString: {\n ...typographyStyles.title2,\n fill: tokens.colorNeutralForeground1,\n [HighContrastSelectorBlack]: {\n fill: 'rgb(179, 179, 179)'\n }\n }\n});\n/**\n * Apply styling to the Pie inside donut chart component\n */ export const usePieStyles = (props)=>{\n var _props_styles, _props_styles1;\n const { className } = props;\n const baseStyles = useStyles();\n return {\n root: mergeClasses(donutPieClassNames.root, baseStyles.root, className, (_props_styles = props.styles) === null || _props_styles === void 0 ? void 0 : _props_styles.root),\n insideDonutString: mergeClasses(donutPieClassNames.insideDonutString, baseStyles.insideDonutString, className, (_props_styles1 = props.styles) === null || _props_styles1 === void 0 ? void 0 : _props_styles1.insideDonutString)\n };\n};\n"],"mappings":"AAAA,SAASA,MAAM,EAAEC,gBAAgB,QAAQ,uBAAuB;AAChE,SAASC,yBAAyB,QAAQ,0BAA0B;AACpE,SAAAC,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD;AACA;AACA;AAAI,OAAO,MAAMC,kBAAkB,GAAG;EAClCC,IAAI,EAAE,qBAAqB;EAC3BC,iBAAiB,EAAE;AACvB,CAAC;AACD;AACA;AACA;AAAI,MAAMC,SAAS,gBAAGL,QAAA;EAAAG,IAAA;EAAAC,iBAAA;IAAAE,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;EAAAC,CAAA;IAAAA,CAAA;EAAA;AAAA,CASrB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,YAAY,GAAIC,KAAK,IAAG;EACrC,IAAIC,aAAa,EAAEC,cAAc;EACjC,MAAM;IAAEC;EAAU,CAAC,GAAGH,KAAK;EAC3B,MAAMI,UAAU,GAAGd,SAAS,CAAC,CAAC;EAC9B,OAAO;IACHF,IAAI,EAAEF,YAAY,CAACC,kBAAkB,CAACC,IAAI,EAAEgB,UAAU,CAAChB,IAAI,EAAEe,SAAS,EAAE,CAACF,aAAa,GAAGD,KAAK,CAACK,MAAM,MAAM,IAAI,IAAIJ,aAAa,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,aAAa,CAACb,IAAI,CAAC;IAC1KC,iBAAiB,EAAEH,YAAY,CAACC,kBAAkB,CAACE,iBAAiB,EAAEe,UAAU,CAACf,iBAAiB,EAAEc,SAAS,EAAE,CAACD,cAAc,GAAGF,KAAK,CAACK,MAAM,MAAM,IAAI,IAAIH,cAAc,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,cAAc,CAACb,iBAAiB;EACpO,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './DonutChart';\nexport * from './DonutChart.types';\nexport * from '../../types/index';\n"],"names":[],"rangeMappings":";;","mappings":"AAAA,cAAc,eAAe;AAC7B,cAAc,qBAAqB;AACnC,cAAc,oBAAoB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { __styles, mergeClasses } from '@griffel/react';
|
|
2
|
+
import { tokens, typographyStyles } from '@fluentui/react-theme';
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export const donutClassNames = {
|
|
7
|
+
root: 'fui-donut__root',
|
|
8
|
+
chart: 'fui-donut__chart',
|
|
9
|
+
legendContainer: 'fui-donut__legendContainer',
|
|
10
|
+
chartWrapper: 'fui-donut__chartWrapper'
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Base Styles
|
|
14
|
+
*/
|
|
15
|
+
const useStyles = /*#__PURE__*/__styles({
|
|
16
|
+
root: {
|
|
17
|
+
Bahqtrf: "fk6fouc",
|
|
18
|
+
Be2twd7: "fkhj508",
|
|
19
|
+
Bhrd7zp: "figsok6",
|
|
20
|
+
Bg96gwp: "f1i3iumi",
|
|
21
|
+
mc9l5x: "f22iagw",
|
|
22
|
+
Beiy3e4: "f1vx9l62",
|
|
23
|
+
a9b677: "fly5x3f",
|
|
24
|
+
Bqenvij: "f1l02sjl"
|
|
25
|
+
},
|
|
26
|
+
chart: {
|
|
27
|
+
B7ck84d: "f1e4lqlz",
|
|
28
|
+
ek0pe7: "fzm18in",
|
|
29
|
+
mc9l5x: "ftgm304",
|
|
30
|
+
B68tc82: 0,
|
|
31
|
+
Bmxbyg5: 0,
|
|
32
|
+
Bpg54ce: "f1gl81tg"
|
|
33
|
+
},
|
|
34
|
+
legendContainer: {
|
|
35
|
+
z8tnut: "fikn0iw"
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
d: [".fk6fouc{font-family:var(--fontFamilyBase);}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".f22iagw{display:flex;}", ".f1vx9l62{flex-direction:column;}", ".fly5x3f{width:100%;}", ".f1l02sjl{height:100%;}", ".f1e4lqlz{box-sizing:content-box;}", ".fzm18in{alignment-adjust:center;}", ".ftgm304{display:block;}", [".f1gl81tg{overflow:visible;}", {
|
|
39
|
+
p: -1
|
|
40
|
+
}], ".fikn0iw{padding-top:var(--spacingVerticalL);}"]
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* Apply styling to the DonutChart component
|
|
44
|
+
*/
|
|
45
|
+
export const useDonutChartStyles = props => {
|
|
46
|
+
var _props_styles, _props_styles1, _props_styles2;
|
|
47
|
+
const {
|
|
48
|
+
className
|
|
49
|
+
} = props;
|
|
50
|
+
const baseStyles = useStyles();
|
|
51
|
+
return {
|
|
52
|
+
root: mergeClasses(donutClassNames.root, baseStyles.root, className, (_props_styles = props.styles) === null || _props_styles === void 0 ? void 0 : _props_styles.root),
|
|
53
|
+
chart: mergeClasses(donutClassNames.chart, baseStyles.chart, (_props_styles1 = props.styles) === null || _props_styles1 === void 0 ? void 0 : _props_styles1.chart),
|
|
54
|
+
legendContainer: mergeClasses(donutClassNames.legendContainer, baseStyles.legendContainer, (_props_styles2 = props.styles) === null || _props_styles2 === void 0 ? void 0 : _props_styles2.legendContainer),
|
|
55
|
+
chartWrapper: donutClassNames.chartWrapper
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=useDonutChartStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","tokens","typographyStyles","donutClassNames","root","chart","legendContainer","chartWrapper","useStyles","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","mc9l5x","Beiy3e4","a9b677","Bqenvij","B7ck84d","ek0pe7","B68tc82","Bmxbyg5","Bpg54ce","z8tnut","d","p","useDonutChartStyles","props","_props_styles","_props_styles1","_props_styles2","className","baseStyles","styles"],"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"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,Y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