@fluentui/react-charts 9.3.1 → 9.3.3

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +42 -2
  2. package/dist/index.d.ts +147 -1
  3. package/lib/components/AreaChart/AreaChart.js +20 -24
  4. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  5. package/lib/components/CommonComponents/ChartPopover.js +2 -1
  6. package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
  7. package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
  8. package/lib/components/DeclarativeChart/DeclarativeChart.js +16 -7
  9. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  10. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +63 -18
  11. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  12. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +394 -173
  13. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  14. package/lib/components/DonutChart/Arc/Arc.js +8 -7
  15. package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
  16. package/lib/components/DonutChart/DonutChart.js +16 -32
  17. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  18. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  19. package/lib/components/DonutChart/Pie/Pie.js +4 -4
  20. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  21. package/lib/components/FunnelChart/FunnelChart.js +23 -45
  22. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  23. package/lib/components/GaugeChart/GaugeChart.js +21 -46
  24. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  25. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +332 -114
  26. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  27. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
  28. package/lib/components/Legends/Legends.js +1 -1
  29. package/lib/components/Legends/Legends.js.map +1 -1
  30. package/lib/components/LineChart/LineChart.js +145 -97
  31. package/lib/components/LineChart/LineChart.js.map +1 -1
  32. package/lib/components/ScatterChart/ScatterChart.js +7 -11
  33. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  34. package/lib/types/DataPoint.js +1 -3
  35. package/lib/types/DataPoint.js.map +1 -1
  36. package/lib/utilities/utilities.js +14 -8
  37. package/lib/utilities/utilities.js.map +1 -1
  38. package/lib-commonjs/components/AreaChart/AreaChart.js +19 -23
  39. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  40. package/lib-commonjs/components/CommonComponents/ChartPopover.js +2 -1
  41. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
  42. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -1
  43. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +16 -7
  44. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  45. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +65 -18
  46. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  47. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +393 -172
  48. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  49. package/lib-commonjs/components/DonutChart/Arc/Arc.js +8 -7
  50. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  51. package/lib-commonjs/components/DonutChart/DonutChart.js +16 -32
  52. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  53. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  54. package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -4
  55. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  56. package/lib-commonjs/components/FunnelChart/FunnelChart.js +23 -45
  57. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  58. package/lib-commonjs/components/GaugeChart/GaugeChart.js +21 -46
  59. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  60. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +329 -112
  61. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  62. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
  63. package/lib-commonjs/components/Legends/Legends.js +1 -1
  64. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  65. package/lib-commonjs/components/LineChart/LineChart.js +144 -96
  66. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  67. package/lib-commonjs/components/ScatterChart/ScatterChart.js +6 -10
  68. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  69. package/lib-commonjs/types/DataPoint.js +1 -3
  70. package/lib-commonjs/types/DataPoint.js.map +1 -1
  71. package/lib-commonjs/utilities/utilities.js +17 -8
  72. package/lib-commonjs/utilities/utilities.js.map +1 -1
  73. package/package.json +9 -9
package/CHANGELOG.md CHANGED
@@ -1,12 +1,52 @@
1
1
  # Change Log - @fluentui/react-charts
2
2
 
3
- This log was last generated on Mon, 06 Oct 2025 15:01:29 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 21 Oct 2025 14:13:08 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.3.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.3.3)
8
+
9
+ Tue, 21 Oct 2025 14:13:08 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.3.2..@fluentui/react-charts_v9.3.3)
11
+
12
+ ### Patches
13
+
14
+ - fix: callout not appearing on scatter chart ([PR #35310](https://github.com/microsoft/fluentui/pull/35310) by kumarkshitij@microsoft.com)
15
+ - fix place value formatting bug in donut chart ([PR #35315](https://github.com/microsoft/fluentui/pull/35315) by anushgupta@microsoft.com)
16
+ - add missing code in v9 ([PR #35318](https://github.com/microsoft/fluentui/pull/35318) by anushgupta@microsoft.com)
17
+ - fix: resolve data points based on axis type + replace invalid values with 0 for valid coordinates ([PR #35323](https://github.com/microsoft/fluentui/pull/35323) by kumarkshitij@microsoft.com)
18
+ - support reference lines in line chart and VBC ([PR #35330](https://github.com/microsoft/fluentui/pull/35330) by anushgupta@microsoft.com)
19
+ - fix legend shape bug ([PR #35335](https://github.com/microsoft/fluentui/pull/35335) by anushgupta@microsoft.com)
20
+ - feat: add support for lines in GVBC ([PR #35321](https://github.com/microsoft/fluentui/pull/35321) by kumarkshitij@microsoft.com)
21
+ - fix donut colors and segment orders ([PR #35316](https://github.com/microsoft/fluentui/pull/35316) by anushgupta@microsoft.com)
22
+ - add fill for scatter polar chart ([PR #35317](https://github.com/microsoft/fluentui/pull/35317) by anushgupta@microsoft.com)
23
+ - fix(react-charts): Show markers only when mode has markers for large data ([PR #35311](https://github.com/microsoft/fluentui/pull/35311) by 120183316+srmukher@users.noreply.github.com)
24
+ - fix popover positioning issue ([PR #35289](https://github.com/microsoft/fluentui/pull/35289) by anushgupta@microsoft.com)
25
+ - fix chart exception issue ([PR #35342](https://github.com/microsoft/fluentui/pull/35342) by anushgupta@microsoft.com)
26
+ - Bump @fluentui/react-button to v9.6.9 ([PR #35307](https://github.com/microsoft/fluentui/pull/35307) by beachball)
27
+ - Bump @fluentui/react-jsx-runtime to v9.3.0 ([PR #35307](https://github.com/microsoft/fluentui/pull/35307) by beachball)
28
+ - Bump @fluentui/react-overflow to v9.6.2 ([PR #35307](https://github.com/microsoft/fluentui/pull/35307) by beachball)
29
+ - Bump @fluentui/react-popover to v9.12.9 ([PR #35307](https://github.com/microsoft/fluentui/pull/35307) by beachball)
30
+ - Bump @fluentui/react-tooltip to v9.8.8 ([PR #35307](https://github.com/microsoft/fluentui/pull/35307) by beachball)
31
+
32
+ ## [9.3.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.3.2)
33
+
34
+ Wed, 08 Oct 2025 12:04:53 GMT
35
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.3.1..@fluentui/react-charts_v9.3.2)
36
+
37
+ ### Patches
38
+
39
+ - Bump @fluentui/react-button to v9.6.8 ([PR #35294](https://github.com/microsoft/fluentui/pull/35294) by beachball)
40
+ - Bump @fluentui/react-jsx-runtime to v9.2.2 ([PR #35294](https://github.com/microsoft/fluentui/pull/35294) by beachball)
41
+ - Bump @fluentui/react-overflow to v9.6.1 ([PR #35294](https://github.com/microsoft/fluentui/pull/35294) by beachball)
42
+ - Bump @fluentui/react-popover to v9.12.8 ([PR #35294](https://github.com/microsoft/fluentui/pull/35294) by beachball)
43
+ - Bump @fluentui/react-tabster to v9.26.7 ([PR #35294](https://github.com/microsoft/fluentui/pull/35294) by beachball)
44
+ - Bump @fluentui/react-tooltip to v9.8.7 ([PR #35294](https://github.com/microsoft/fluentui/pull/35294) by beachball)
45
+ - Bump @fluentui/react-utilities to v9.25.1 ([PR #35294](https://github.com/microsoft/fluentui/pull/35294) by beachball)
46
+
7
47
  ## [9.3.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.3.1)
8
48
 
9
- Mon, 06 Oct 2025 15:01:29 GMT
49
+ Mon, 06 Oct 2025 15:01:58 GMT
10
50
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.3.0..@fluentui/react-charts_v9.3.1)
11
51
 
12
52
  ### Patches
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { CurveFactory } from 'd3-shape';
2
2
  import type { JSXElement } from '@fluentui/react-utilities';
3
+ import { PositioningShorthand } from '@fluentui/react-positioning';
3
4
  import * as React_2 from 'react';
4
5
  import { RefObject } from 'react';
5
6
  import { SankeyGraph } from 'd3-sankey';
@@ -173,6 +174,24 @@ export declare type AxisProps = {
173
174
  */
174
175
  export declare type AxisScaleType = 'default' | 'log';
175
176
 
177
+ /**
178
+ * Represents a bar series.
179
+ */
180
+ export declare interface BarSeries<X extends string | number | Date, Y extends string | number | Date> extends DataSeries {
181
+ /**
182
+ * Type discriminator: always 'bar' for this series.
183
+ */
184
+ type: 'bar';
185
+ /**
186
+ * Array of data points for the series.
187
+ */
188
+ data: DataPointV2<X, Y>[];
189
+ /**
190
+ * Optional group identifier for the series.
191
+ */
192
+ key?: string;
193
+ }
194
+
176
195
  /**
177
196
  * {@docCategory ChartData}
178
197
  */
@@ -736,6 +755,7 @@ export declare interface ChartPopoverProps {
736
755
  ratio?: [number, number];
737
756
  isCartesian?: boolean;
738
757
  styles?: Partial<PopoverComponentStyles>;
758
+ positioning?: PositioningShorthand;
739
759
  }
740
760
 
741
761
  /**
@@ -927,6 +947,82 @@ export declare interface DataPoint {
927
947
  onClick?: VoidFunction;
928
948
  }
929
949
 
950
+ /**
951
+ * Represents a single data point in a series.
952
+ */
953
+ export declare interface DataPointV2<X extends string | number | Date, Y extends string | number | Date> {
954
+ /**
955
+ * X-axis value of the data point.
956
+ */
957
+ x: X;
958
+ /**
959
+ * Y-axis value of the data point.
960
+ */
961
+ y: Y;
962
+ /**
963
+ * Optional click handler for the data point.
964
+ */
965
+ onClick?: () => void;
966
+ /**
967
+ * Custom text to show in the callout in place of the x-axis value.
968
+ */
969
+ xAxisCalloutData?: string;
970
+ /**
971
+ * Custom text to show in the callout in place of the y-axis value.
972
+ */
973
+ yAxisCalloutData?: string;
974
+ /**
975
+ * Accessibility properties for the data point.
976
+ */
977
+ callOutAccessibilityData?: AccessibilityProps;
978
+ /**
979
+ * Custom marker size for the data point.
980
+ */
981
+ markerSize?: number;
982
+ /**
983
+ * Optional text to annotate or label the data point.
984
+ */
985
+ text?: string;
986
+ /**
987
+ * Color of the data point. If not provided, it will inherit the series color.
988
+ */
989
+ color?: string;
990
+ }
991
+
992
+ /**
993
+ * Base interface for a series.
994
+ */
995
+ export declare interface DataSeries {
996
+ /**
997
+ * Name of the series to be displayed in the legend.
998
+ */
999
+ legend: string;
1000
+ /**
1001
+ * Shape used in the legend (e.g., circle, square).
1002
+ */
1003
+ legendShape?: LegendShape;
1004
+ /**
1005
+ * Color of the series.
1006
+ */
1007
+ color?: string;
1008
+ /**
1009
+ * Opacity of the series.
1010
+ */
1011
+ opacity?: number;
1012
+ /**
1013
+ * Gradient fill for the series (start and end colors).
1014
+ */
1015
+ gradient?: [string, string];
1016
+ /**
1017
+ * Whether this series should be plotted against a secondary Y-axis.
1018
+ */
1019
+ useSecondaryYScale?: boolean;
1020
+ /**
1021
+ * Callback invoked when the legend item is clicked.
1022
+ */
1023
+ onLegendClick?: (selectedLegend: string | null | string[]) => void;
1024
+ }
1025
+
930
1026
  export declare const DataVizPalette: {
931
1027
  color1: string;
932
1028
  color2: string;
@@ -1109,6 +1205,13 @@ export declare interface DonutChartProps extends CartesianChartProps {
1109
1205
  * @default false
1110
1206
  */
1111
1207
  roundCorners?: boolean;
1208
+ /**
1209
+ * Rendering order of the legend
1210
+ * @default 'default'
1211
+ * 'default' - as per data provided
1212
+ * 'sorted' - in descending order of value
1213
+ */
1214
+ order?: 'default' | 'sorted';
1112
1215
  }
1113
1216
 
1114
1217
  /**
@@ -1760,6 +1863,11 @@ export declare interface GroupedVerticalBarChartProps extends CartesianChartProp
1760
1863
  * The prop used to enable rounded corners for the chart.
1761
1864
  */
1762
1865
  roundCorners?: boolean;
1866
+ /**
1867
+ * New flexible data prop - supports both bar and line series.
1868
+ * Use `dataV2` instead of `data` when line series are included.
1869
+ */
1870
+ dataV2?: (BarSeries<string, number> | LineSeries<string, number>)[];
1763
1871
  }
1764
1872
 
1765
1873
  /**
@@ -1800,7 +1908,7 @@ export declare interface GVBarChartSeriesPoint {
1800
1908
  /**
1801
1909
  * Color for the legend in the chart
1802
1910
  */
1803
- color: string;
1911
+ color?: string;
1804
1912
  /**
1805
1913
  * Legend text in the chart
1806
1914
  */
@@ -2716,6 +2824,10 @@ export declare interface LineChartDataPoint extends BaseDataPoint {
2716
2824
  * text labels of marker points
2717
2825
  */
2718
2826
  text?: string;
2827
+ /**
2828
+ * Per-point marker color (overrides series color when present)
2829
+ */
2830
+ markerColor?: string;
2719
2831
  }
2720
2832
 
2721
2833
  /**
@@ -2956,6 +3068,36 @@ export declare interface LineDataInVerticalStackedBarChart {
2956
3068
  lineOptions?: LineChartLineOptions;
2957
3069
  }
2958
3070
 
3071
+ /**
3072
+ * Represents a line series.
3073
+ */
3074
+ export declare interface LineSeries<X extends string | number | Date, Y extends string | number | Date> extends DataSeries {
3075
+ /**
3076
+ * Type discriminator: always 'line' for this series.
3077
+ */
3078
+ type: 'line';
3079
+ /**
3080
+ * Array of data points for the series.
3081
+ */
3082
+ data: DataPointV2<X, Y>[];
3083
+ /**
3084
+ * Optional gaps to render in the line.
3085
+ */
3086
+ gaps?: LineChartGap[];
3087
+ /**
3088
+ * Additional line rendering options (e.g., stroke width, curve type).
3089
+ */
3090
+ lineOptions?: LineChartLineOptions;
3091
+ /**
3092
+ * If true, hides dots for inactive (unfocused/unhovered) data points.
3093
+ */
3094
+ hideInactiveDots?: boolean;
3095
+ /**
3096
+ * Callback invoked when the line itself is clicked.
3097
+ */
3098
+ onLineClick?: () => void;
3099
+ }
3100
+
2959
3101
  export declare interface MapXToDataSet {
2960
3102
  [key: string]: LineChartDataPoint[];
2961
3103
  [key: number]: LineChartDataPoint[];
@@ -3440,6 +3582,10 @@ export declare interface ScatterChartDataPoint extends BaseDataPoint {
3440
3582
  * text labels of marker points
3441
3583
  */
3442
3584
  text?: string;
3585
+ /**
3586
+ * Per-point marker color (overrides series color when present)
3587
+ */
3588
+ markerColor?: string;
3443
3589
  }
3444
3590
 
3445
3591
  /**
@@ -7,7 +7,7 @@ import { select as d3Select } from 'd3-selection';
7
7
  import { tokens } from '@fluentui/react-theme';
8
8
  import { area as d3Area, stack as d3Stack, curveMonotoneX as d3CurveBasis, line as d3Line } from 'd3-shape';
9
9
  import { CartesianChart } from '../../index';
10
- import { calloutData, getXAxisType, ChartTypes, XAxisTypes, getTypeOfAxis, tooltipOfAxislabels, getNextColor, getColorFromToken, getSecureProps, areArraysEqual, getCurveFactory, find, findNumericMinMaxOfY, createNumericYAxis, domainRangeOfNumericForAreaLineScatterCharts, domainRangeOfDateForAreaLineScatterVerticalBarCharts, createStringYAxis, useRtl } from '../../utilities/index';
10
+ import { calloutData, getXAxisType, ChartTypes, XAxisTypes, getTypeOfAxis, tooltipOfAxislabels, getNextColor, getColorFromToken, getSecureProps, areArraysEqual, getCurveFactory, findNumericMinMaxOfY, createNumericYAxis, domainRangeOfNumericForAreaLineScatterCharts, domainRangeOfDateForAreaLineScatterVerticalBarCharts, createStringYAxis, useRtl, findCalloutPoints } from '../../utilities/index';
11
11
  import { useId } from '@fluentui/react-utilities';
12
12
  import { Legends } from '../Legends/index';
13
13
  import { toImage } from '../../utilities/image-export-utils';
@@ -161,11 +161,7 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
161
161
  // eslint-disable-next-line @typescript-eslint/no-shadow
162
162
  const { xAxisCalloutData, xAxisCalloutAccessibilityData } = lineChartData[0].data[index];
163
163
  const formattedDate = pointToHighlight instanceof Date ? formatDateToLocaleString(pointToHighlight, props.culture, props.useUTC) : pointToHighlight;
164
- const modifiedXVal = pointToHighlight instanceof Date ? pointToHighlight.getTime() : pointToHighlight;
165
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
166
- const found = find(_calloutPoints, (element)=>{
167
- return element.x === modifiedXVal;
168
- });
164
+ const found = findCalloutPoints(_calloutPoints, pointToHighlight);
169
165
  // eslint-disable-next-line @typescript-eslint/no-shadow
170
166
  const _nearestCircleToHighlight = axisType === XAxisTypes.DateAxis ? pointToHighlight.getTime() : pointToHighlight;
171
167
  // if no points need to be called out then don't show vertical line and callout card
@@ -695,24 +691,24 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
695
691
  _updatePosition(cx, cy);
696
692
  const { x, y, xAxisCalloutData } = props.data.lineChartData[lineIndex].data[pointIndex];
697
693
  const formattedDate = x instanceof Date ? formatDateToLocaleString(x, props.culture, props.useUTC) : x;
698
- const modifiedXVal = x instanceof Date ? x.getTime() : x;
699
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
700
- const found = _calloutPoints.find((e)=>e.x === modifiedXVal);
701
- // Show details in the callout for the focused point only
702
- found.values = found.values.filter((e)=>e.y === y);
703
- const filteredValues = _getFilteredLegendValues(found.values);
704
- setPopoverOpen(true);
705
- setHoverXValue(xAxisCalloutData ? xAxisCalloutData : formattedDate);
706
- setYValueHover(filteredValues);
707
- setStackCalloutProps({
708
- ...found,
709
- values: filteredValues
710
- });
711
- setDataPointCalloutProps({
712
- ...found,
713
- values: filteredValues
714
- });
715
- setActivePoint(circleId);
694
+ const found = findCalloutPoints(_calloutPoints, x);
695
+ if (found) {
696
+ // Show details in the callout for the focused point only
697
+ found.values = found.values.filter((e)=>e.y === y);
698
+ const filteredValues = _getFilteredLegendValues(found.values);
699
+ setPopoverOpen(true);
700
+ setHoverXValue(xAxisCalloutData ? xAxisCalloutData : formattedDate);
701
+ setYValueHover(filteredValues);
702
+ setStackCalloutProps({
703
+ ...found,
704
+ values: filteredValues
705
+ });
706
+ setDataPointCalloutProps({
707
+ ...found,
708
+ values: filteredValues
709
+ });
710
+ setActivePoint(circleId);
711
+ }
716
712
  }
717
713
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
718
714
  function _getFilteredLegendValues(values) {