@fluentui/react-charts 9.3.6 → 9.3.8
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 +46 -2
- package/dist/index.d.ts +70 -17
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -16
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -1
- package/lib/components/AreaChart/AreaChart.js +3 -43
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +1 -2
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +8 -11
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +107 -67
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +52 -32
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.js +1 -2
- package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +9 -7
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +8 -5
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -2
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +48 -25
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +309 -209
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +9 -15
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.js +4 -2
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +8 -13
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.js +4 -17
- package/lib/components/GanttChart/GanttChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +8 -13
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +24 -36
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +1 -2
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +3 -16
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +5 -25
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/Legends/Legends.js +3 -4
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/Legends/Legends.types.js.map +1 -1
- package/lib/components/Legends/OverflowMenu.js.map +1 -1
- package/lib/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +68 -75
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.js +1 -1
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +3 -4
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +1 -2
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.js +4 -10
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +1 -2
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +41 -49
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +1 -2
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/Sparkline/Sparkline.js +11 -7
- package/lib/components/Sparkline/Sparkline.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +15 -92
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +1 -2
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +28 -49
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +1 -2
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/types/ChartAnnotation.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/Common.styles.js +0 -1
- package/lib/utilities/Common.styles.js.map +1 -1
- package/lib/utilities/Common.styles.raw.js +0 -1
- package/lib/utilities/Common.styles.raw.js.map +1 -1
- package/lib/utilities/FocusableTooltipText.js +1 -1
- package/lib/utilities/FocusableTooltipText.js.map +1 -1
- package/lib/utilities/getWindow.js +0 -1
- package/lib/utilities/getWindow.js.map +1 -1
- package/lib/utilities/hooks.js +34 -0
- package/lib/utilities/hooks.js.map +1 -0
- package/lib/utilities/image-export-utils.js +118 -78
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib/utilities/utilities.js +243 -102
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -16
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +2 -41
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +0 -2
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +9 -11
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +107 -67
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +51 -31
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.js +1 -2
- package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +7 -6
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +7 -4
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -2
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +48 -25
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +309 -208
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +7 -13
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -2
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +7 -12
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.js +3 -16
- package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +7 -12
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +22 -34
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -2
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +2 -15
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +4 -23
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.js +3 -4
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
- package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +67 -74
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +2 -2
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +0 -2
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +4 -10
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +0 -2
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +38 -46
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +0 -2
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Sparkline/Sparkline.js +11 -7
- package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +14 -91
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +0 -2
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +26 -47
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +0 -2
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/types/ChartAnnotation.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.js +0 -1
- package/lib-commonjs/utilities/Common.styles.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.raw.js +0 -1
- package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/getWindow.js +0 -1
- package/lib-commonjs/utilities/getWindow.js.map +1 -1
- package/lib-commonjs/utilities/hooks.js +45 -0
- package/lib-commonjs/utilities/hooks.js.map +1 -0
- package/lib-commonjs/utilities/image-export-utils.js +119 -79
- package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +253 -101
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +9 -9
- package/lib/components/DeclarativeChart/imageExporter.js +0 -223
- package/lib/components/DeclarativeChart/imageExporter.js.map +0 -1
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js +0 -233
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,56 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-charts
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 17 Dec 2025 18:05:59 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.3.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.3.8)
|
|
8
|
+
|
|
9
|
+
Wed, 17 Dec 2025 18:05:59 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.3.7..@fluentui/react-charts_v9.3.8)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- fix(react-charts): Mixed coordinate annotations ([PR #35532](https://github.com/microsoft/fluentui/pull/35532) by 120183316+srmukher@users.noreply.github.com)
|
|
15
|
+
- add missing aria-labels in v9 cartesian charts ([PR #35560](https://github.com/microsoft/fluentui/pull/35560) by 74965306+Anush2303@users.noreply.github.com)
|
|
16
|
+
- fix label percentage issue in donut, VBC, VSBC and heatmap chart ([PR #35538](https://github.com/microsoft/fluentui/pull/35538) by anushgupta@microsoft.com)
|
|
17
|
+
- fix a11y bugs in line chart ([PR #35550](https://github.com/microsoft/fluentui/pull/35550) by anushgupta@microsoft.com)
|
|
18
|
+
- fix a11y issues ([PR #35573](https://github.com/microsoft/fluentui/pull/35573) by anushgupta@microsoft.com)
|
|
19
|
+
- feat: improve x-axis tick label layout with automatic wrapping, truncation, or multi-level rendering based on available space ([PR #35522](https://github.com/microsoft/fluentui/pull/35522) by kumarkshitij@microsoft.com)
|
|
20
|
+
- fix: resolve minor gantt chart bugs ([PR #35543](https://github.com/microsoft/fluentui/pull/35543) by kumarkshitij@microsoft.com)
|
|
21
|
+
- fix(react-charts):Fixing annotations opacity issue ([PR #35564](https://github.com/microsoft/fluentui/pull/35564) by 120183316+srmukher@users.noreply.github.com)
|
|
22
|
+
- enable custom callout in scatter chart ([PR #35565](https://github.com/microsoft/fluentui/pull/35565) by anushgupta@microsoft.com)
|
|
23
|
+
- fix double padding issue in scatter chart ([PR #35498](https://github.com/microsoft/fluentui/pull/35498) by anushgupta@microsoft.com)
|
|
24
|
+
- Bump @fluentui/react-button to v9.7.1 ([PR #35582](https://github.com/microsoft/fluentui/pull/35582) by beachball)
|
|
25
|
+
- Bump @fluentui/react-jsx-runtime to v9.3.4 ([PR #35582](https://github.com/microsoft/fluentui/pull/35582) by beachball)
|
|
26
|
+
- Bump @fluentui/react-overflow to v9.6.6 ([PR #35582](https://github.com/microsoft/fluentui/pull/35582) by beachball)
|
|
27
|
+
- Bump @fluentui/react-popover to v9.12.13 ([PR #35582](https://github.com/microsoft/fluentui/pull/35582) by beachball)
|
|
28
|
+
- Bump @fluentui/react-tabster to v9.26.11 ([PR #35582](https://github.com/microsoft/fluentui/pull/35582) by beachball)
|
|
29
|
+
- Bump @fluentui/react-tooltip to v9.8.12 ([PR #35582](https://github.com/microsoft/fluentui/pull/35582) by beachball)
|
|
30
|
+
- Bump @fluentui/react-utilities to v9.26.0 ([PR #35582](https://github.com/microsoft/fluentui/pull/35582) by beachball)
|
|
31
|
+
|
|
32
|
+
## [9.3.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.3.7)
|
|
33
|
+
|
|
34
|
+
Fri, 05 Dec 2025 22:38:46 GMT
|
|
35
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.3.6..@fluentui/react-charts_v9.3.7)
|
|
36
|
+
|
|
37
|
+
### Patches
|
|
38
|
+
|
|
39
|
+
- fix: handle frequent uncaught exceptions ([PR #35495](https://github.com/microsoft/fluentui/pull/35495) by kumarkshitij@microsoft.com)
|
|
40
|
+
- remove redundant styles ([PR #35476](https://github.com/microsoft/fluentui/pull/35476) by anushgupta@microsoft.com)
|
|
41
|
+
- fix incomplete donut and VSBC bug ([PR #35484](https://github.com/microsoft/fluentui/pull/35484) by anushgupta@microsoft.com)
|
|
42
|
+
- fix width and height props not being applied to SVG path dimensions ([PR #35479](https://github.com/microsoft/fluentui/pull/35479) by 120502241+jepagan_microsoft@users.noreply.github.com)
|
|
43
|
+
- add support for x rounded tick values ([PR #35490](https://github.com/microsoft/fluentui/pull/35490) by anushgupta@microsoft.com)
|
|
44
|
+
- fix popover issue ([PR #35501](https://github.com/microsoft/fluentui/pull/35501) by anushgupta@microsoft.com)
|
|
45
|
+
- set reference line legends after the main chart legends ([PR #35481](https://github.com/microsoft/fluentui/pull/35481) by anushgupta@microsoft.com)
|
|
46
|
+
- fix duplicate points issue in scatter polar chart ([PR #35516](https://github.com/microsoft/fluentui/pull/35516) by anushgupta@microsoft.com)
|
|
47
|
+
- feat: enable multiplot image export ([PR #35483](https://github.com/microsoft/fluentui/pull/35483) by kumarkshitij@microsoft.com)
|
|
48
|
+
- fix(react-charts): Ensuring annotation keeps tied with chart always ([PR #35486](https://github.com/microsoft/fluentui/pull/35486) by 120183316+srmukher@users.noreply.github.com)
|
|
49
|
+
- Bump @fluentui/react-button to v9.7.0 ([PR #35537](https://github.com/microsoft/fluentui/pull/35537) by beachball)
|
|
50
|
+
|
|
7
51
|
## [9.3.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.3.6)
|
|
8
52
|
|
|
9
|
-
Tue, 11 Nov 2025 19:
|
|
53
|
+
Tue, 11 Nov 2025 19:18:18 GMT
|
|
10
54
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.3.5..@fluentui/react-charts_v9.3.6)
|
|
11
55
|
|
|
12
56
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { JSXElement } from '@fluentui/react-utilities';
|
|
|
3
3
|
import type { Margin } from '@fluentui/chart-utilities';
|
|
4
4
|
import { PositioningShorthand } from '@fluentui/react-positioning';
|
|
5
5
|
import * as React_2 from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import { Ref } from 'react';
|
|
7
7
|
import { SankeyGraph } from 'd3-sankey';
|
|
8
8
|
import { SankeyLayout } from 'd3-sankey';
|
|
9
9
|
import { SankeyLink } from 'd3-sankey';
|
|
@@ -67,7 +67,7 @@ export declare interface AnnotationOnlyChartProps {
|
|
|
67
67
|
/** Layout margin converted to padding for the outer wrapper. */
|
|
68
68
|
margin?: Partial<Margin>;
|
|
69
69
|
/** Component ref propagated by the DeclarativeChart surface. */
|
|
70
|
-
componentRef?: React_2.
|
|
70
|
+
componentRef?: React_2.Ref<Chart>;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
export declare interface AnnotationPlotRect {
|
|
@@ -402,6 +402,10 @@ export declare interface CartesianChartProps {
|
|
|
402
402
|
* maximum data value point in y-axis
|
|
403
403
|
*/
|
|
404
404
|
yMaxValue?: number;
|
|
405
|
+
/**
|
|
406
|
+
* minimum data value point in x-axis (for numeric x-axis)
|
|
407
|
+
*/
|
|
408
|
+
xMinValue?: number;
|
|
405
409
|
/**
|
|
406
410
|
* maximum data value point in x-axis
|
|
407
411
|
*/
|
|
@@ -546,7 +550,7 @@ export declare interface CartesianChartProps {
|
|
|
546
550
|
* Optional callback to access the Chart interface. Use this instead of ref for accessing
|
|
547
551
|
* the public methods and properties of the component.
|
|
548
552
|
*/
|
|
549
|
-
componentRef?: React_2.
|
|
553
|
+
componentRef?: React_2.Ref<Chart>;
|
|
550
554
|
/**
|
|
551
555
|
* Prop to set the x axis annotation. Used to display additional information on the x-axis.
|
|
552
556
|
* This is shown on the top of the chart.
|
|
@@ -593,7 +597,17 @@ export declare interface CartesianChartProps {
|
|
|
593
597
|
* Configuration for the x-axis.
|
|
594
598
|
* Use this to control `tickStep`, `tick0`, etc.
|
|
595
599
|
*/
|
|
596
|
-
xAxis?: AxisProps
|
|
600
|
+
xAxis?: AxisProps & {
|
|
601
|
+
/**
|
|
602
|
+
* Controls how x-axis tick labels are laid out.
|
|
603
|
+
*
|
|
604
|
+
* - `'auto'`: Tick labels are automatically wrapped, truncated, and staggered
|
|
605
|
+
* across alternating levels based on the available space to prevent overlap.
|
|
606
|
+
*
|
|
607
|
+
* @default 'default'
|
|
608
|
+
*/
|
|
609
|
+
tickLayout?: 'default' | 'auto';
|
|
610
|
+
};
|
|
597
611
|
/**
|
|
598
612
|
* Configuration for the y-axis.
|
|
599
613
|
* Use this to control `tickStep`, `tick0`, etc.
|
|
@@ -805,17 +819,37 @@ export declare interface ChartAnnotationContext {
|
|
|
805
819
|
}
|
|
806
820
|
|
|
807
821
|
export declare type ChartAnnotationCoordinate = {
|
|
808
|
-
/** Cartesian data coordinates mapped through the chart scales
|
|
809
|
-
|
|
810
|
-
* Absolute pixel position relative to the chart's SVG origin
|
|
811
|
-
*/
|
|
812
|
-
type: 'data' | 'relative' | 'pixel';
|
|
822
|
+
/** Cartesian data coordinates mapped through the chart scales */
|
|
823
|
+
type: 'data';
|
|
813
824
|
/** x-axis value in the data domain */
|
|
814
825
|
x: number | string | Date;
|
|
815
826
|
/** y-axis value in the data domain */
|
|
816
827
|
y: number | string | Date;
|
|
817
828
|
/** Use the secondary y scale when available */
|
|
818
829
|
yAxis?: 'primary' | 'secondary';
|
|
830
|
+
} | {
|
|
831
|
+
/** Normalised coordinates within the plot area (0-1) */
|
|
832
|
+
type: 'relative';
|
|
833
|
+
/** Fractional x-position inside the plot area */
|
|
834
|
+
x: number;
|
|
835
|
+
/** Fractional y-position inside the plot area */
|
|
836
|
+
y: number;
|
|
837
|
+
} | {
|
|
838
|
+
/** Absolute pixel position relative to the chart's plot origin */
|
|
839
|
+
type: 'pixel';
|
|
840
|
+
/** Horizontal pixel offset from the plot origin */
|
|
841
|
+
x: number;
|
|
842
|
+
/** Vertical pixel offset from the plot origin */
|
|
843
|
+
y: number;
|
|
844
|
+
} | {
|
|
845
|
+
/** Mixed coordinate systems per axis (e.g., data X + relative Y) */
|
|
846
|
+
type: 'mixed';
|
|
847
|
+
xCoordinateType: 'data' | 'relative' | 'pixel';
|
|
848
|
+
yCoordinateType: 'data' | 'relative' | 'pixel';
|
|
849
|
+
x: number | string | Date;
|
|
850
|
+
y: number | string | Date;
|
|
851
|
+
/** Use the secondary y scale when the Y coordinate maps to data */
|
|
852
|
+
yAxis?: 'primary' | 'secondary';
|
|
819
853
|
};
|
|
820
854
|
|
|
821
855
|
export declare type ChartAnnotationHorizontalAlign = 'start' | 'center' | 'end';
|
|
@@ -1048,7 +1082,7 @@ export declare interface ChartTableProps {
|
|
|
1048
1082
|
* Optional callback to access the Chart interface. Use this instead of ref for accessing
|
|
1049
1083
|
* the public methods and properties of the component.
|
|
1050
1084
|
*/
|
|
1051
|
-
componentRef?: React_2.
|
|
1085
|
+
componentRef?: React_2.Ref<Chart>;
|
|
1052
1086
|
}
|
|
1053
1087
|
|
|
1054
1088
|
/**
|
|
@@ -1313,7 +1347,7 @@ export declare interface DeclarativeChartProps extends React_2.RefAttributes<HTM
|
|
|
1313
1347
|
* Optional callback to access the IDeclarativeChart interface. Use this instead of ref for accessing
|
|
1314
1348
|
* the public methods and properties of the component.
|
|
1315
1349
|
*/
|
|
1316
|
-
componentRef?: React_2.
|
|
1350
|
+
componentRef?: React_2.Ref<IDeclarativeChart>;
|
|
1317
1351
|
/**
|
|
1318
1352
|
* Optional prop to specify the colorway type of the chart.
|
|
1319
1353
|
* - 'default': Use Fluent UI color palette aligning with plotly colorway.
|
|
@@ -1416,7 +1450,7 @@ export declare interface DonutChartProps extends CartesianChartProps {
|
|
|
1416
1450
|
* Optional callback to access the Chart interface. Use this instead of ref for accessing
|
|
1417
1451
|
* the public methods and properties of the component.
|
|
1418
1452
|
*/
|
|
1419
|
-
componentRef?: React_2.
|
|
1453
|
+
componentRef?: React_2.Ref<Chart>;
|
|
1420
1454
|
/**
|
|
1421
1455
|
* Prop to enable the round corners in the chart
|
|
1422
1456
|
* @default false
|
|
@@ -1572,7 +1606,7 @@ export declare interface FunnelChartProps {
|
|
|
1572
1606
|
/**
|
|
1573
1607
|
* Reference to the chart component
|
|
1574
1608
|
*/
|
|
1575
|
-
componentRef?: React_2.
|
|
1609
|
+
componentRef?: React_2.Ref<Chart>;
|
|
1576
1610
|
/**
|
|
1577
1611
|
* Additional CSS class(es) to apply to the chart
|
|
1578
1612
|
*/
|
|
@@ -1833,7 +1867,7 @@ export declare interface GaugeChartProps {
|
|
|
1833
1867
|
* Optional callback to access the Chart interface. Use this instead of ref for accessing
|
|
1834
1868
|
* the public methods and properties of the component.
|
|
1835
1869
|
*/
|
|
1836
|
-
componentRef?: React.
|
|
1870
|
+
componentRef?: React.Ref<Chart>;
|
|
1837
1871
|
}
|
|
1838
1872
|
|
|
1839
1873
|
/**
|
|
@@ -2142,6 +2176,10 @@ export declare interface GVBarChartSeriesPoint {
|
|
|
2142
2176
|
* False by default.
|
|
2143
2177
|
*/
|
|
2144
2178
|
useSecondaryYScale?: boolean;
|
|
2179
|
+
/**
|
|
2180
|
+
* Label to display on the bar
|
|
2181
|
+
*/
|
|
2182
|
+
barLabel?: string;
|
|
2145
2183
|
}
|
|
2146
2184
|
|
|
2147
2185
|
export declare interface GVDataPoint {
|
|
@@ -2789,7 +2827,7 @@ export declare interface Legend {
|
|
|
2789
2827
|
*/
|
|
2790
2828
|
export declare interface LegendContainer {
|
|
2791
2829
|
toSVG: (svgWidth: number, isRTL?: boolean) => {
|
|
2792
|
-
node:
|
|
2830
|
+
node: SVGSVGElement | null;
|
|
2793
2831
|
width: number;
|
|
2794
2832
|
height: number;
|
|
2795
2833
|
};
|
|
@@ -2922,7 +2960,7 @@ export declare interface LegendsProps {
|
|
|
2922
2960
|
/**
|
|
2923
2961
|
* Callback to access the public methods and properties of the component.
|
|
2924
2962
|
*/
|
|
2925
|
-
legendRef?: React_2.
|
|
2963
|
+
legendRef?: React_2.Ref<LegendContainer>;
|
|
2926
2964
|
}
|
|
2927
2965
|
|
|
2928
2966
|
/**
|
|
@@ -3681,7 +3719,7 @@ export declare interface SankeyChartProps {
|
|
|
3681
3719
|
* Optional callback to access the Chart interface. Use this instead of ref for accessing
|
|
3682
3720
|
* the public methods and properties of the component.
|
|
3683
3721
|
*/
|
|
3684
|
-
componentRef?:
|
|
3722
|
+
componentRef?: Ref<Chart>;
|
|
3685
3723
|
/**
|
|
3686
3724
|
* props for the callout in the chart
|
|
3687
3725
|
*/
|
|
@@ -3841,6 +3879,10 @@ export declare interface ScatterChartProps extends CartesianChartProps {
|
|
|
3841
3879
|
* Define a custom callout renderer for a data point
|
|
3842
3880
|
*/
|
|
3843
3881
|
onRenderCalloutPerDataPoint?: RenderFunction<CustomizedCalloutData>;
|
|
3882
|
+
/**
|
|
3883
|
+
* Define a custom callout renderer for a stack; default is to render per data point
|
|
3884
|
+
*/
|
|
3885
|
+
onRenderCalloutPerStack?: RenderFunction<CustomizedCalloutData>;
|
|
3844
3886
|
/**
|
|
3845
3887
|
* Callback for getting callout description message
|
|
3846
3888
|
*/
|
|
@@ -3906,6 +3948,7 @@ declare interface SLinkExtra {
|
|
|
3906
3948
|
*/
|
|
3907
3949
|
value: number;
|
|
3908
3950
|
unnormalizedValue?: number;
|
|
3951
|
+
color?: string;
|
|
3909
3952
|
}
|
|
3910
3953
|
|
|
3911
3954
|
export declare type SNode = SankeyNode<SNodeExtra, SLinkExtra>;
|
|
@@ -4050,6 +4093,11 @@ export declare interface VerticalBarChartDataPoint {
|
|
|
4050
4093
|
* Accessibility data for callout
|
|
4051
4094
|
*/
|
|
4052
4095
|
callOutAccessibilityData?: AccessibilityProps;
|
|
4096
|
+
/**
|
|
4097
|
+
* Label to display on the bar
|
|
4098
|
+
* This is an optional prop that can be used to show custom text on bars
|
|
4099
|
+
*/
|
|
4100
|
+
barLabel?: string;
|
|
4053
4101
|
}
|
|
4054
4102
|
|
|
4055
4103
|
/**
|
|
@@ -4393,6 +4441,11 @@ export declare interface VSChartDataPoint {
|
|
|
4393
4441
|
* The prop used to define the culture to localized the numbers
|
|
4394
4442
|
*/
|
|
4395
4443
|
culture?: string;
|
|
4444
|
+
/**
|
|
4445
|
+
* Label to display on the bar
|
|
4446
|
+
* This is an optional prop that can be used to show custom text on bars
|
|
4447
|
+
*/
|
|
4448
|
+
barLabel?: string;
|
|
4396
4449
|
}
|
|
4397
4450
|
|
|
4398
4451
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ChartAnnotationLayer } from '../CommonComponents/Annotations/ChartAnnotationLayer';
|
|
4
|
-
import { toImage as exportToImage } from '../../utilities/image-export-utils';
|
|
5
4
|
import { useRtl } from '../../utilities';
|
|
6
5
|
import { useAnnotationOnlyChartStyles } from './useAnnotationOnlyChartStyles.styles';
|
|
6
|
+
import { useImageExport } from '../../utilities/hooks';
|
|
7
7
|
const DEFAULT_HEIGHT = 650;
|
|
8
8
|
const FALLBACK_WIDTH = 400;
|
|
9
9
|
const buildPadding = (margin)=>{
|
|
@@ -27,7 +27,7 @@ export const AnnotationOnlyChart = (props)=>{
|
|
|
27
27
|
const { annotations, chartTitle, description, width, height, paperBackgroundColor, plotBackgroundColor, fontColor, fontFamily, margin, componentRef } = props;
|
|
28
28
|
const isRtl = useRtl();
|
|
29
29
|
const classes = useAnnotationOnlyChartStyles();
|
|
30
|
-
const containerRef =
|
|
30
|
+
const { chartContainerRef: containerRef } = useImageExport(componentRef, true, false);
|
|
31
31
|
const contentRef = React.useRef(null);
|
|
32
32
|
const [measuredWidth, setMeasuredWidth] = React.useState(width !== null && width !== void 0 ? width : 0);
|
|
33
33
|
const [contentHeight, setContentHeight] = React.useState(height !== null && height !== void 0 ? height : DEFAULT_HEIGHT);
|
|
@@ -154,20 +154,6 @@ export const AnnotationOnlyChart = (props)=>{
|
|
|
154
154
|
const resolvedAnnotations = annotations !== null && annotations !== void 0 ? annotations : [];
|
|
155
155
|
const hasAnnotations = resolvedAnnotations.length > 0;
|
|
156
156
|
const ariaLabel = hasAnnotations ? description !== null && description !== void 0 ? description : chartTitle : undefined;
|
|
157
|
-
React.useImperativeHandle(componentRef, ()=>{
|
|
158
|
-
const chartHandle = {
|
|
159
|
-
chartContainer: containerRef.current,
|
|
160
|
-
toImage: (opts)=>{
|
|
161
|
-
if (!containerRef.current) {
|
|
162
|
-
return Promise.reject(new Error('Chart container is not defined'));
|
|
163
|
-
}
|
|
164
|
-
return exportToImage(containerRef.current, undefined, isRtl, opts);
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
return chartHandle;
|
|
168
|
-
}, [
|
|
169
|
-
isRtl
|
|
170
|
-
]);
|
|
171
157
|
return /*#__PURE__*/ React.createElement("div", {
|
|
172
158
|
ref: containerRef,
|
|
173
159
|
"data-chart-annotation-container": "true"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AnnotationOnlyChart/AnnotationOnlyChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChartAnnotationLayer } from '../CommonComponents/Annotations/ChartAnnotationLayer';\nimport { toImage as exportToImage } from '../../utilities/image-export-utils';\nimport { useRtl } from '../../utilities';\nimport { useAnnotationOnlyChartStyles } from './useAnnotationOnlyChartStyles.styles';\nimport type { AnnotationOnlyChartProps } from './AnnotationOnlyChart.types';\nimport type { Chart, ImageExportOptions } from '../../types/index';\nimport type { ChartAnnotationContext } from '../CommonComponents/Annotations/ChartAnnotationLayer.types';\n\nconst DEFAULT_HEIGHT = 650;\nconst FALLBACK_WIDTH = 400;\n\nconst buildPadding = (margin: AnnotationOnlyChartProps['margin']): string | undefined => {\n if (!margin) {\n return undefined;\n }\n\n const top = margin.t ?? 0;\n const right = margin.r ?? 0;\n const bottom = margin.b ?? 0;\n const left = margin.l ?? 0;\n\n if (top === 0 && right === 0 && bottom === 0 && left === 0) {\n return undefined;\n }\n\n return `${top}px ${right}px ${bottom}px ${left}px`;\n};\n\nexport const AnnotationOnlyChart: React.FC<AnnotationOnlyChartProps> = props => {\n const {\n annotations,\n chartTitle,\n description,\n width,\n height,\n paperBackgroundColor,\n plotBackgroundColor,\n fontColor,\n fontFamily,\n margin,\n componentRef,\n } = props;\n\n const isRtl = useRtl();\n const classes = useAnnotationOnlyChartStyles();\n const containerRef = React.useRef<HTMLDivElement | null>(null);\n const contentRef = React.useRef<HTMLDivElement | null>(null);\n const [measuredWidth, setMeasuredWidth] = React.useState<number>(width ?? 0);\n const [contentHeight, setContentHeight] = React.useState<number>(height ?? DEFAULT_HEIGHT);\n\n React.useEffect(() => {\n if (typeof width === 'number' && width > 0) {\n setMeasuredWidth(width);\n return;\n }\n\n const node = containerRef.current;\n if (!node || typeof ResizeObserver === 'undefined') {\n const rect = node?.getBoundingClientRect();\n if (rect && rect.width > 0) {\n setMeasuredWidth(rect.width);\n } else {\n setMeasuredWidth(prev => (prev > 0 ? prev : FALLBACK_WIDTH));\n }\n return;\n }\n\n const observer = new ResizeObserver(entries => {\n const entry = entries[0];\n if (!entry) {\n return;\n }\n const newWidth = entry.contentRect.width;\n if (newWidth > 0 && Math.abs(newWidth - measuredWidth) > 0.5) {\n setMeasuredWidth(newWidth);\n }\n });\n\n const rect = node.getBoundingClientRect();\n if (rect.width > 0) {\n setMeasuredWidth(rect.width);\n }\n\n observer.observe(node);\n return () => observer.disconnect();\n }, [width, measuredWidth]);\n\n const resolvedWidth = Math.max(measuredWidth || FALLBACK_WIDTH, 1);\n const resolvedHeight = Math.max(height ?? DEFAULT_HEIGHT, 1);\n\n React.useEffect(() => {\n const node = contentRef.current;\n if (!node) {\n setContentHeight(prev => (prev > 0 ? prev : resolvedHeight));\n return;\n }\n\n if (typeof ResizeObserver === 'undefined') {\n const rect = node.getBoundingClientRect();\n setContentHeight(prev => (rect.height > 0 ? rect.height : prev > 0 ? prev : resolvedHeight));\n return;\n }\n\n const observer = new ResizeObserver(entries => {\n const entry = entries[0];\n if (!entry) {\n return;\n }\n\n const newHeight = entry.contentRect.height;\n if (newHeight > 0) {\n setContentHeight(prev => (Math.abs(prev - newHeight) > 0.5 ? newHeight : prev));\n }\n });\n\n const rect = node.getBoundingClientRect();\n setContentHeight(prev => (rect.height > 0 ? rect.height : prev > 0 ? prev : resolvedHeight));\n\n observer.observe(node);\n return () => observer.disconnect();\n }, [\n resolvedHeight,\n resolvedWidth,\n annotations,\n chartTitle,\n description,\n margin,\n plotBackgroundColor,\n paperBackgroundColor,\n fontColor,\n fontFamily,\n ]);\n\n const svgHeight = Math.max(Math.ceil(contentHeight || 0), resolvedHeight);\n\n const context: ChartAnnotationContext = {\n plotRect: { x: 0, y: 0, width: resolvedWidth, height: resolvedHeight },\n svgRect: { width: resolvedWidth, height: resolvedHeight },\n isRtl,\n };\n\n const padding = buildPadding(margin);\n\n // Inline styles for dynamic values that can't be in makeStyles\n const rootStyle: React.CSSProperties = React.useMemo(\n () => ({\n width: width ? `${width}px` : '100%',\n minHeight: resolvedHeight,\n ...(paperBackgroundColor && { backgroundColor: paperBackgroundColor }),\n ...(fontColor && { color: fontColor }),\n ...(fontFamily && { fontFamily }),\n ...(padding && { padding }),\n }),\n [fontColor, fontFamily, paperBackgroundColor, padding, resolvedHeight, width],\n );\n\n const contentStyle: React.CSSProperties = React.useMemo(\n () => ({\n ...(plotBackgroundColor && { backgroundColor: plotBackgroundColor }),\n }),\n [plotBackgroundColor],\n );\n\n const resolvedAnnotations = annotations ?? [];\n const hasAnnotations = resolvedAnnotations.length > 0;\n const ariaLabel = hasAnnotations ? description ?? chartTitle : undefined;\n\n React.useImperativeHandle(\n componentRef,\n () => {\n const chartHandle: Chart = {\n chartContainer: containerRef.current,\n toImage: (opts?: ImageExportOptions) => {\n if (!containerRef.current) {\n return Promise.reject(new Error('Chart container is not defined'));\n }\n\n return exportToImage(containerRef.current, undefined, isRtl, opts);\n },\n };\n\n return chartHandle;\n },\n [isRtl],\n );\n\n return (\n <div ref={containerRef} data-chart-annotation-container=\"true\">\n <svg\n width={resolvedWidth}\n height={svgHeight}\n viewBox={`0 0 ${resolvedWidth} ${svgHeight}`}\n style={{ width: width ? `${width}px` : '100%', height: `${svgHeight}px`, display: 'block' }}\n role={ariaLabel ? 'img' : undefined}\n aria-label={ariaLabel}\n >\n <foreignObject x={0} y={0} width={resolvedWidth} height={svgHeight}>\n <div\n ref={contentRef}\n className={classes.root}\n style={rootStyle}\n data-chart-annotation-only=\"true\"\n aria-label={ariaLabel}\n >\n {chartTitle && (\n <span className={classes.title} aria-hidden=\"true\">\n {chartTitle}\n </span>\n )}\n <div className={classes.content} style={contentStyle} role=\"presentation\">\n {hasAnnotations ? <ChartAnnotationLayer annotations={resolvedAnnotations} context={context} /> : null}\n </div>\n </div>\n </foreignObject>\n </svg>\n </div>\n );\n};\n\nAnnotationOnlyChart.displayName = 'AnnotationOnlyChart';\n"],"names":["React","ChartAnnotationLayer","toImage","exportToImage","useRtl","useAnnotationOnlyChartStyles","DEFAULT_HEIGHT","FALLBACK_WIDTH","buildPadding","margin","undefined","top","t","right","r","bottom","b","left","l","AnnotationOnlyChart","props","annotations","chartTitle","description","width","height","paperBackgroundColor","plotBackgroundColor","fontColor","fontFamily","componentRef","isRtl","classes","containerRef","useRef","contentRef","measuredWidth","setMeasuredWidth","useState","contentHeight","setContentHeight","useEffect","node","current","ResizeObserver","rect","getBoundingClientRect","prev","observer","entries","entry","newWidth","contentRect","Math","abs","observe","disconnect","resolvedWidth","max","resolvedHeight","newHeight","svgHeight","ceil","context","plotRect","x","y","svgRect","padding","rootStyle","useMemo","minHeight","backgroundColor","color","contentStyle","resolvedAnnotations","hasAnnotations","length","ariaLabel","useImperativeHandle","chartHandle","chartContainer","opts","Promise","reject","Error","div","ref","data-chart-annotation-container","svg","viewBox","style","display","role","aria-label","foreignObject","className","root","data-chart-annotation-only","span","title","aria-hidden","content","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,oBAAoB,QAAQ,uDAAuD;AAC5F,SAASC,WAAWC,aAAa,QAAQ,qCAAqC;AAC9E,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,4BAA4B,QAAQ,wCAAwC;AAKrF,MAAMC,iBAAiB;AACvB,MAAMC,iBAAiB;AAEvB,MAAMC,eAAe,CAACC;IACpB,IAAI,CAACA,QAAQ;QACX,OAAOC;IACT;QAEYD;IAAZ,MAAME,MAAMF,CAAAA,YAAAA,OAAOG,CAAC,cAARH,uBAAAA,YAAY;QACVA;IAAd,MAAMI,QAAQJ,CAAAA,YAAAA,OAAOK,CAAC,cAARL,uBAAAA,YAAY;QACXA;IAAf,MAAMM,SAASN,CAAAA,YAAAA,OAAOO,CAAC,cAARP,uBAAAA,YAAY;QACdA;IAAb,MAAMQ,OAAOR,CAAAA,YAAAA,OAAOS,CAAC,cAART,uBAAAA,YAAY;IAEzB,IAAIE,QAAQ,KAAKE,UAAU,KAAKE,WAAW,KAAKE,SAAS,GAAG;QAC1D,OAAOP;IACT;IAEA,OAAO,GAAGC,IAAI,GAAG,EAAEE,MAAM,GAAG,EAAEE,OAAO,GAAG,EAAEE,KAAK,EAAE,CAAC;AACpD;AAEA,OAAO,MAAME,sBAA0DC,CAAAA;IACrE,MAAM,EACJC,WAAW,EACXC,UAAU,EACVC,WAAW,EACXC,KAAK,EACLC,MAAM,EACNC,oBAAoB,EACpBC,mBAAmB,EACnBC,SAAS,EACTC,UAAU,EACVpB,MAAM,EACNqB,YAAY,EACb,GAAGV;IAEJ,MAAMW,QAAQ3B;IACd,MAAM4B,UAAU3B;IAChB,MAAM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,GAAGoC,UAAU,EAAE,CAAC;YAAE+B,SAAS;QAAQ;QAC1FC,MAAMf,YAAY,QAAQpE;QAC1BoF,cAAYhB;qBAEZ,oBAACiB;QAAc9B,GAAG;QAAGC,GAAG;QAAG1C,OAAOiC;QAAehC,QAAQoC;qBACvD,oBAACyB;QACCC,KAAKpD;QACL6D,WAAWhE,QAAQiE,IAAI;QACvBN,OAAOtB;QACP6B,8BAA2B;QAC3BJ,cAAYhB;OAEXxD,4BACC,oBAAC6E;QAAKH,WAAWhE,QAAQoE,KAAK;QAAEC,eAAY;OACzC/E,2BAGL,oBAACgE;QAAIU,WAAWhE,QAAQsE,OAAO;QAAEX,OAAOjB;QAAcmB,MAAK;OACxDjB,+BAAiB,oBAAC3E;QAAqBoB,aAAasD;QAAqBZ,SAASA;SAAc;AAO/G,EAAE;AAEF5C,oBAAoBoF,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../src/components/AnnotationOnlyChart/AnnotationOnlyChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChartAnnotationLayer } from '../CommonComponents/Annotations/ChartAnnotationLayer';\nimport { useRtl } from '../../utilities';\nimport { useAnnotationOnlyChartStyles } from './useAnnotationOnlyChartStyles.styles';\nimport type { AnnotationOnlyChartProps } from './AnnotationOnlyChart.types';\nimport type { ChartAnnotationContext } from '../CommonComponents/Annotations/ChartAnnotationLayer.types';\nimport { useImageExport } from '../../utilities/hooks';\n\nconst DEFAULT_HEIGHT = 650;\nconst FALLBACK_WIDTH = 400;\n\nconst buildPadding = (margin: AnnotationOnlyChartProps['margin']): string | undefined => {\n if (!margin) {\n return undefined;\n }\n\n const top = margin.t ?? 0;\n const right = margin.r ?? 0;\n const bottom = margin.b ?? 0;\n const left = margin.l ?? 0;\n\n if (top === 0 && right === 0 && bottom === 0 && left === 0) {\n return undefined;\n }\n\n return `${top}px ${right}px ${bottom}px ${left}px`;\n};\n\nexport const AnnotationOnlyChart: React.FC<AnnotationOnlyChartProps> = props => {\n const {\n annotations,\n chartTitle,\n description,\n width,\n height,\n paperBackgroundColor,\n plotBackgroundColor,\n fontColor,\n fontFamily,\n margin,\n componentRef,\n } = props;\n\n const isRtl = useRtl();\n const classes = useAnnotationOnlyChartStyles();\n const { chartContainerRef: containerRef } = useImageExport(componentRef, true, false);\n const contentRef = React.useRef<HTMLDivElement | null>(null);\n const [measuredWidth, setMeasuredWidth] = React.useState<number>(width ?? 0);\n const [contentHeight, setContentHeight] = React.useState<number>(height ?? DEFAULT_HEIGHT);\n\n React.useEffect(() => {\n if (typeof width === 'number' && width > 0) {\n setMeasuredWidth(width);\n return;\n }\n\n const node = containerRef.current;\n if (!node || typeof ResizeObserver === 'undefined') {\n const rect = node?.getBoundingClientRect();\n if (rect && rect.width > 0) {\n setMeasuredWidth(rect.width);\n } else {\n setMeasuredWidth(prev => (prev > 0 ? prev : FALLBACK_WIDTH));\n }\n return;\n }\n\n const observer = new ResizeObserver(entries => {\n const entry = entries[0];\n if (!entry) {\n return;\n }\n const newWidth = entry.contentRect.width;\n if (newWidth > 0 && Math.abs(newWidth - measuredWidth) > 0.5) {\n setMeasuredWidth(newWidth);\n }\n });\n\n const rect = node.getBoundingClientRect();\n if (rect.width > 0) {\n setMeasuredWidth(rect.width);\n }\n\n observer.observe(node);\n return () => observer.disconnect();\n }, [width, measuredWidth]);\n\n const resolvedWidth = Math.max(measuredWidth || FALLBACK_WIDTH, 1);\n const resolvedHeight = Math.max(height ?? DEFAULT_HEIGHT, 1);\n\n React.useEffect(() => {\n const node = contentRef.current;\n if (!node) {\n setContentHeight(prev => (prev > 0 ? prev : resolvedHeight));\n return;\n }\n\n if (typeof ResizeObserver === 'undefined') {\n const rect = node.getBoundingClientRect();\n setContentHeight(prev => (rect.height > 0 ? rect.height : prev > 0 ? prev : resolvedHeight));\n return;\n }\n\n const observer = new ResizeObserver(entries => {\n const entry = entries[0];\n if (!entry) {\n return;\n }\n\n const newHeight = entry.contentRect.height;\n if (newHeight > 0) {\n setContentHeight(prev => (Math.abs(prev - newHeight) > 0.5 ? newHeight : prev));\n }\n });\n\n const rect = node.getBoundingClientRect();\n setContentHeight(prev => (rect.height > 0 ? rect.height : prev > 0 ? prev : resolvedHeight));\n\n observer.observe(node);\n return () => observer.disconnect();\n }, [\n resolvedHeight,\n resolvedWidth,\n annotations,\n chartTitle,\n description,\n margin,\n plotBackgroundColor,\n paperBackgroundColor,\n fontColor,\n fontFamily,\n ]);\n\n const svgHeight = Math.max(Math.ceil(contentHeight || 0), resolvedHeight);\n\n const context: ChartAnnotationContext = {\n plotRect: { x: 0, y: 0, width: resolvedWidth, height: resolvedHeight },\n svgRect: { width: resolvedWidth, height: resolvedHeight },\n isRtl,\n };\n\n const padding = buildPadding(margin);\n\n // Inline styles for dynamic values that can't be in makeStyles\n const rootStyle: React.CSSProperties = React.useMemo(\n () => ({\n width: width ? `${width}px` : '100%',\n minHeight: resolvedHeight,\n ...(paperBackgroundColor && { backgroundColor: paperBackgroundColor }),\n ...(fontColor && { color: fontColor }),\n ...(fontFamily && { fontFamily }),\n ...(padding && { padding }),\n }),\n [fontColor, fontFamily, paperBackgroundColor, padding, resolvedHeight, width],\n );\n\n const contentStyle: React.CSSProperties = React.useMemo(\n () => ({\n ...(plotBackgroundColor && { backgroundColor: plotBackgroundColor }),\n }),\n [plotBackgroundColor],\n );\n\n const resolvedAnnotations = annotations ?? [];\n const hasAnnotations = resolvedAnnotations.length > 0;\n const ariaLabel = hasAnnotations ? description ?? chartTitle : undefined;\n\n return (\n <div ref={containerRef} data-chart-annotation-container=\"true\">\n <svg\n width={resolvedWidth}\n height={svgHeight}\n viewBox={`0 0 ${resolvedWidth} ${svgHeight}`}\n style={{ width: width ? `${width}px` : '100%', height: `${svgHeight}px`, display: 'block' }}\n role={ariaLabel ? 'img' : undefined}\n aria-label={ariaLabel}\n >\n <foreignObject x={0} y={0} width={resolvedWidth} height={svgHeight}>\n <div\n ref={contentRef}\n className={classes.root}\n style={rootStyle}\n data-chart-annotation-only=\"true\"\n aria-label={ariaLabel}\n >\n {chartTitle && (\n <span className={classes.title} aria-hidden=\"true\">\n {chartTitle}\n </span>\n )}\n <div className={classes.content} style={contentStyle} role=\"presentation\">\n {hasAnnotations ? <ChartAnnotationLayer annotations={resolvedAnnotations} context={context} /> : null}\n </div>\n </div>\n </foreignObject>\n </svg>\n </div>\n );\n};\n\nAnnotationOnlyChart.displayName = 'AnnotationOnlyChart';\n"],"names":["React","ChartAnnotationLayer","useRtl","useAnnotationOnlyChartStyles","useImageExport","DEFAULT_HEIGHT","FALLBACK_WIDTH","buildPadding","margin","undefined","top","t","right","r","bottom","b","left","l","AnnotationOnlyChart","props","annotations","chartTitle","description","width","height","paperBackgroundColor","plotBackgroundColor","fontColor","fontFamily","componentRef","isRtl","classes","chartContainerRef","containerRef","contentRef","useRef","measuredWidth","setMeasuredWidth","useState","contentHeight","setContentHeight","useEffect","node","current","ResizeObserver","rect","getBoundingClientRect","prev","observer","entries","entry","newWidth","contentRect","Math","abs","observe","disconnect","resolvedWidth","max","resolvedHeight","newHeight","svgHeight","ceil","context","plotRect","x","y","svgRect","padding","rootStyle","useMemo","minHeight","backgroundColor","color","contentStyle","resolvedAnnotations","hasAnnotations","length","ariaLabel","div","ref","data-chart-annotation-container","svg","viewBox","style","display","role","aria-label","foreignObject","className","root","data-chart-annotation-only","span","title","aria-hidden","content","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,oBAAoB,QAAQ,uDAAuD;AAC5F,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,4BAA4B,QAAQ,wCAAwC;AAGrF,SAASC,cAAc,QAAQ,wBAAwB;AAEvD,MAAMC,iBAAiB;AACvB,MAAMC,iBAAiB;AAEvB,MAAMC,eAAe,CAACC;IACpB,IAAI,CAACA,QAAQ;QACX,OAAOC;IACT;QAEYD;IAAZ,MAAME,MAAMF,CAAAA,YAAAA,OAAOG,CAAC,cAARH,uBAAAA,YAAY;QACVA;IAAd,M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AAAA,cAAe,EAAE;IAC7C,MAAMwD,iBAAiBD,oBAAoBE,MAAM,GAAG;IACpD,MAAMC,YAAYF,iBAAiBtD,wBAAAA,yBAAAA,cAAeD,aAAaZ;IAE/D,qBACE,oBAACsE;QAAIC,KAAK/C;QAAcgD,mCAAgC;qBACtD,oBAACC;QACC3D,OAAOkC;QACPjC,QAAQqC;QACRsB,SAAS,CAAC,IAAI,EAAE1B,cAAc,CAAC,EAAEI,WAAW;QAC5CuB,OAAO;YAAE7D,OAAOA,QAAQ,GAAGA,MAAM,EAAE,CAAC,GAAG;YAAQC,QAAQ,GAAGqC,UAAU,EAAE,CAAC;YAAEwB,SAAS;QAAQ;QAC1FC,MAAMR,YAAY,QAAQrE;QAC1B8E,cAAYT;qBAEZ,oBAACU;QAAcvB,GAAG;QAAGC,GAAG;QAAG3C,OAAOkC;QAAejC,QAAQqC;qBACvD,oBAACkB;QACCC,KAAK9C;QACLuD,WAAW1D,QAAQ2D,IAAI;QACvBN,OAAOf;QACPsB,8BAA2B;QAC3BJ,cAAYT;OAEXzD,4BACC,oBAACuE;QAAKH,WAAW1D,QAAQ8D,KAAK;QAAEC,eAAY;OACzCzE,2BAGL,oBAAC0D;QAAIU,WAAW1D,QAAQgE,OAAO;QAAEX,OAAOV;QAAcY,MAAK;OACxDV,+BAAiB,oBAAC3E;QAAqBmB,aAAauD;QAAqBZ,SAASA;SAAc;AAO/G,EAAE;AAEF7C,oBAAoB8E,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AnnotationOnlyChart/AnnotationOnlyChart.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ChartAnnotation } from '../../types/ChartAnnotation';\nimport type { Chart } from '../../types/index';\nimport type { Margin } from '@fluentui/chart-utilities';\n\n/**\n * Props for the annotation-only chart renderer.\n */\nexport interface AnnotationOnlyChartProps {\n /**\n * Collection of annotations to render.\n */\n annotations: ChartAnnotation[];\n /** Optional layout title extracted from the Plotly schema. */\n chartTitle?: string;\n /** Optional descriptive text for accessibility. */\n description?: string;\n /** Desired width in pixels (if absent the chart will grow to fit the container). */\n width?: number;\n /** Desired height in pixels. */\n height?: number;\n /** Paper/background colour specified in the Plotly layout. */\n paperBackgroundColor?: string;\n /** Plot area background colour specified in the Plotly layout. */\n plotBackgroundColor?: string;\n /** Global layout font colour. */\n fontColor?: string;\n /** Global layout font family. */\n fontFamily?: string;\n /** Layout margin converted to padding for the outer wrapper. */\n margin?: Partial<Margin>;\n /** Component ref propagated by the DeclarativeChart surface. */\n componentRef?: React.
|
|
1
|
+
{"version":3,"sources":["../src/components/AnnotationOnlyChart/AnnotationOnlyChart.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ChartAnnotation } from '../../types/ChartAnnotation';\nimport type { Chart } from '../../types/index';\nimport type { Margin } from '@fluentui/chart-utilities';\n\n/**\n * Props for the annotation-only chart renderer.\n */\nexport interface AnnotationOnlyChartProps {\n /**\n * Collection of annotations to render.\n */\n annotations: ChartAnnotation[];\n /** Optional layout title extracted from the Plotly schema. */\n chartTitle?: string;\n /** Optional descriptive text for accessibility. */\n description?: string;\n /** Desired width in pixels (if absent the chart will grow to fit the container). */\n width?: number;\n /** Desired height in pixels. */\n height?: number;\n /** Paper/background colour specified in the Plotly layout. */\n paperBackgroundColor?: string;\n /** Plot area background colour specified in the Plotly layout. */\n plotBackgroundColor?: string;\n /** Global layout font colour. */\n fontColor?: string;\n /** Global layout font family. */\n fontFamily?: string;\n /** Layout margin converted to padding for the outer wrapper. */\n margin?: Partial<Margin>;\n /** Component ref propagated by the DeclarativeChart surface. */\n componentRef?: React.Ref<Chart>;\n}\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useAreaChartStyles } from './useAreaChartStyles.styles';
|
|
4
3
|
import { max as d3Max, bisector } from 'd3-array';
|
|
5
4
|
import { pointer } from 'd3-selection';
|
|
6
|
-
import { select as d3Select } from 'd3-selection';
|
|
7
5
|
import { tokens } from '@fluentui/react-theme';
|
|
8
6
|
import { area as d3Area, stack as d3Stack, curveMonotoneX as d3CurveBasis, line as d3Line } from 'd3-shape';
|
|
9
7
|
import { CartesianChart } from '../../index';
|
|
10
|
-
import { calloutData, getXAxisType, ChartTypes, XAxisTypes, getTypeOfAxis,
|
|
8
|
+
import { calloutData, getXAxisType, ChartTypes, XAxisTypes, getTypeOfAxis, getNextColor, getColorFromToken, getSecureProps, areArraysEqual, getCurveFactory, findNumericMinMaxOfY, createNumericYAxis, domainRangeOfNumericForAreaLineScatterCharts, domainRangeOfDateForAreaLineScatterVerticalBarCharts, createStringYAxis, findCalloutPoints } from '../../utilities/index';
|
|
11
9
|
import { useId } from '@fluentui/react-utilities';
|
|
12
10
|
import { Legends } from '../Legends/index';
|
|
13
|
-
import { toImage } from '../../utilities/image-export-utils';
|
|
14
11
|
import { formatDateToLocaleString } from '@fluentui/chart-utilities';
|
|
12
|
+
import { useImageExport } from '../../utilities/hooks';
|
|
15
13
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
14
|
const bisect = bisector((d)=>d.x).left;
|
|
17
15
|
var InterceptVisibility = /*#__PURE__*/ function(InterceptVisibility) {
|
|
@@ -26,7 +24,6 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
26
24
|
const _verticalLineId = useId('verticalLine_');
|
|
27
25
|
const _circleId = useId('circle');
|
|
28
26
|
const _rectId = useId('rectangle');
|
|
29
|
-
const _tooltipId = useId('AreaChartTooltipID');
|
|
30
27
|
//enableComputationOptimization is used for optimized code to group data points by x value
|
|
31
28
|
//from O(n^2) to O(n) using a map.
|
|
32
29
|
const _enableComputationOptimization = true;
|
|
@@ -48,9 +45,7 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
48
45
|
let _xAxisRectScale;
|
|
49
46
|
// determines if the given area chart has multiple stacked bar charts
|
|
50
47
|
let _isMultiStackChart;
|
|
51
|
-
const cartesianChartRef =
|
|
52
|
-
const _legendsRef = React.useRef(null);
|
|
53
|
-
const _isRTL = useRtl();
|
|
48
|
+
const { cartesianChartRef, legendsRef: _legendsRef } = useImageExport(props.componentRef, props.hideLegend);
|
|
54
49
|
const [selectedLegends, setSelectedLegends] = React.useState(((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.selectedLegends) || []);
|
|
55
50
|
const [activeLegend, setActiveLegend] = React.useState(undefined);
|
|
56
51
|
const [hoverXValue, setHoverXValue] = React.useState('');
|
|
@@ -83,18 +78,6 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
83
78
|
}, [
|
|
84
79
|
props
|
|
85
80
|
]);
|
|
86
|
-
React.useImperativeHandle(props.componentRef, ()=>{
|
|
87
|
-
var _cartesianChartRef_current;
|
|
88
|
-
var _cartesianChartRef_current_chartContainer;
|
|
89
|
-
return {
|
|
90
|
-
chartContainer: (_cartesianChartRef_current_chartContainer = (_cartesianChartRef_current = cartesianChartRef.current) === null || _cartesianChartRef_current === void 0 ? void 0 : _cartesianChartRef_current.chartContainer) !== null && _cartesianChartRef_current_chartContainer !== void 0 ? _cartesianChartRef_current_chartContainer : null,
|
|
91
|
-
toImage: (opts)=>{
|
|
92
|
-
var _cartesianChartRef_current, _legendsRef_current;
|
|
93
|
-
return toImage((_cartesianChartRef_current = cartesianChartRef.current) === null || _cartesianChartRef_current === void 0 ? void 0 : _cartesianChartRef_current.chartContainer, (_legendsRef_current = _legendsRef.current) === null || _legendsRef_current === void 0 ? void 0 : _legendsRef_current.toSVG, _isRTL, opts);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
}, []);
|
|
97
|
-
const classes = useAreaChartStyles(props);
|
|
98
81
|
function _getMinMaxOfYAxis(points, yAxisType, useSecondaryYScale) {
|
|
99
82
|
return findNumericMinMaxOfY(points, yAxisType, useSecondaryYScale);
|
|
100
83
|
}
|
|
@@ -679,29 +662,6 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
679
662
|
visibility: displayOfLine,
|
|
680
663
|
...getSecureProps(pointLineOptions)
|
|
681
664
|
}));
|
|
682
|
-
// Removing un wanted tooltip div from DOM, when prop not provided.
|
|
683
|
-
if (!props.showXAxisLablesTooltip) {
|
|
684
|
-
try {
|
|
685
|
-
// eslint-disable-next-line @nx/workspace-no-restricted-globals
|
|
686
|
-
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
687
|
-
// eslint-disable-next-line no-empty
|
|
688
|
-
} catch (e) {}
|
|
689
|
-
}
|
|
690
|
-
// Used to display tooltip at x axis labels.
|
|
691
|
-
if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
|
|
692
|
-
const xAxisElement = d3Select(xElement).call(xScale);
|
|
693
|
-
try {
|
|
694
|
-
// eslint-disable-next-line @nx/workspace-no-restricted-globals
|
|
695
|
-
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
696
|
-
// eslint-disable-next-line no-empty
|
|
697
|
-
} catch (e) {}
|
|
698
|
-
const tooltipProps = {
|
|
699
|
-
tooltipCls: classes.tooltip,
|
|
700
|
-
id: _tooltipId,
|
|
701
|
-
axis: xAxisElement
|
|
702
|
-
};
|
|
703
|
-
xAxisElement && tooltipOfAxislabels(tooltipProps);
|
|
704
|
-
}
|
|
705
665
|
return graph;
|
|
706
666
|
}
|
|
707
667
|
function _getOnClickHandler(points, index, pointIndex) {
|