@fluentui/react-charting 5.24.39 → 5.25.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.
Files changed (111) hide show
  1. package/CHANGELOG.json +75 -1
  2. package/CHANGELOG.md +30 -2
  3. package/dist/react-charting.d.ts +127 -0
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +74 -0
  7. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
  8. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +496 -0
  9. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  10. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
  11. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +111 -0
  12. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
  13. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
  14. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +2 -0
  15. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  16. package/lib/components/CommonComponents/CartesianChart.base.js +38 -46
  17. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  18. package/lib/components/CommonComponents/CartesianChart.styles.js +9 -1
  19. package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  20. package/lib/components/CommonComponents/CartesianChart.types.d.ts +17 -1
  21. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  22. package/lib/components/CommonComponents/index.d.ts +2 -0
  23. package/lib/components/CommonComponents/index.js +2 -0
  24. package/lib/components/CommonComponents/index.js.map +1 -1
  25. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +650 -76
  26. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  27. package/lib/index.d.ts +1 -1
  28. package/lib/index.js.map +1 -1
  29. package/lib/types/IChartAnnotation.d.ts +99 -0
  30. package/lib/types/IChartAnnotation.js +2 -0
  31. package/lib/types/IChartAnnotation.js.map +1 -0
  32. package/lib/types/IDataPoint.d.ts +4 -0
  33. package/lib/types/IDataPoint.js.map +1 -1
  34. package/lib/types/index.d.ts +1 -0
  35. package/lib/types/index.js +1 -0
  36. package/lib/types/index.js.map +1 -1
  37. package/lib/utilities/image-export-utils.js +55 -0
  38. package/lib/utilities/image-export-utils.js.map +1 -1
  39. package/lib/utilities/utilities.js +72 -20
  40. package/lib/utilities/utilities.js.map +1 -1
  41. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
  42. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js +497 -0
  43. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  44. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
  45. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +119 -0
  46. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
  47. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
  48. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +5 -0
  49. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  50. package/lib-amd/components/CommonComponents/CartesianChart.base.js +38 -47
  51. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  52. package/lib-amd/components/CommonComponents/CartesianChart.styles.js +9 -1
  53. package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  54. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +17 -1
  55. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  56. package/lib-amd/components/CommonComponents/index.d.ts +2 -0
  57. package/lib-amd/components/CommonComponents/index.js +3 -1
  58. package/lib-amd/components/CommonComponents/index.js.map +1 -1
  59. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +650 -76
  60. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  61. package/lib-amd/index.d.ts +1 -1
  62. package/lib-amd/index.js.map +1 -1
  63. package/lib-amd/types/IChartAnnotation.d.ts +99 -0
  64. package/lib-amd/types/IChartAnnotation.js +5 -0
  65. package/lib-amd/types/IChartAnnotation.js.map +1 -0
  66. package/lib-amd/types/IDataPoint.d.ts +4 -0
  67. package/lib-amd/types/IDataPoint.js.map +1 -1
  68. package/lib-amd/types/index.d.ts +1 -0
  69. package/lib-amd/types/index.js +2 -1
  70. package/lib-amd/types/index.js.map +1 -1
  71. package/lib-amd/utilities/image-export-utils.js +55 -0
  72. package/lib-amd/utilities/image-export-utils.js.map +1 -1
  73. package/lib-amd/utilities/utilities.js +72 -20
  74. package/lib-amd/utilities/utilities.js.map +1 -1
  75. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
  76. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +499 -0
  77. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  78. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
  79. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +118 -0
  80. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
  81. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
  82. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +3 -0
  83. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  84. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +38 -46
  85. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  86. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +9 -1
  87. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  88. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +17 -1
  89. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  90. package/lib-commonjs/components/CommonComponents/index.d.ts +2 -0
  91. package/lib-commonjs/components/CommonComponents/index.js +2 -0
  92. package/lib-commonjs/components/CommonComponents/index.js.map +1 -1
  93. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +650 -76
  94. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  95. package/lib-commonjs/index.d.ts +1 -1
  96. package/lib-commonjs/index.js.map +1 -1
  97. package/lib-commonjs/types/IChartAnnotation.d.ts +99 -0
  98. package/lib-commonjs/types/IChartAnnotation.js +3 -0
  99. package/lib-commonjs/types/IChartAnnotation.js.map +1 -0
  100. package/lib-commonjs/types/IDataPoint.d.ts +4 -0
  101. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  102. package/lib-commonjs/types/index.d.ts +1 -0
  103. package/lib-commonjs/types/index.js +1 -0
  104. package/lib-commonjs/types/index.js.map +1 -1
  105. package/lib-commonjs/utilities/image-export-utils.js +55 -0
  106. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  107. package/lib-commonjs/utilities/utilities.js +72 -20
  108. package/lib-commonjs/utilities/utilities.js.map +1 -1
  109. package/package.json +9 -9
  110. package/src/components/CommonComponents/Annotations/ChartAnnotationLayer.types.ts +58 -0
  111. package/src/components/CommonComponents/CartesianChart.types.ts +21 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-charting",
3
- "version": "5.24.39",
3
+ "version": "5.25.1",
4
4
  "description": "React web charting controls for Microsoft fluentui system.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -36,9 +36,9 @@
36
36
  "jest-canvas-mock": "2.4.0"
37
37
  },
38
38
  "dependencies": {
39
- "@fluentui/chart-utilities": "^1.1.34",
40
- "@fluentui/react-focus": "^8.9.29",
41
- "@fluentui/theme-samples": "^8.7.218",
39
+ "@fluentui/chart-utilities": "^1.1.35",
40
+ "@fluentui/react-focus": "^8.10.0",
41
+ "@fluentui/theme-samples": "^8.7.219",
42
42
  "@microsoft/load-themed-styles": "^1.10.26",
43
43
  "@types/d3-array": "^3.0.0",
44
44
  "@types/d3-axis": "^3.0.0",
@@ -66,11 +66,11 @@
66
66
  "tslib": "^2.1.0"
67
67
  },
68
68
  "peerDependencies": {
69
- "@fluentui/react": "^8.124.2",
70
- "@types/react": ">=16.8.0 <19.0.0",
71
- "@types/react-dom": ">=16.8.0 <19.0.0",
72
- "react": ">=16.8.0 <19.0.0",
73
- "react-dom": ">=16.8.0 <19.0.0"
69
+ "@fluentui/react": "^8.125.0",
70
+ "@types/react": ">=16.8.0 <20.0.0",
71
+ "@types/react-dom": ">=16.8.0 <20.0.0",
72
+ "react": ">=16.8.0 <20.0.0",
73
+ "react-dom": ">=16.8.0 <20.0.0"
74
74
  },
75
75
  "exports": {
76
76
  ".": {
@@ -0,0 +1,58 @@
1
+ import { ITheme } from '@fluentui/react/lib/Styling';
2
+ import { IChartAnnotation, ChartAnnotationArrowHead } from '../../../types/IChartAnnotation';
3
+
4
+ export interface IAnnotationPoint {
5
+ x: number;
6
+ y: number;
7
+ }
8
+
9
+ export interface IAnnotationPlotRect {
10
+ x: number;
11
+ y: number;
12
+ width: number;
13
+ height: number;
14
+ }
15
+
16
+ export interface IChartAnnotationContext {
17
+ /** Rectangle describing the drawable area of the chart (without margins) */
18
+ plotRect: IAnnotationPlotRect;
19
+ /** Size of the owning SVG element */
20
+ svgRect: { width: number; height: number };
21
+ /** Indicates if layout should be mirrored */
22
+ isRtl?: boolean;
23
+ /** Primary x scale mapping data domain to pixels */
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
+ xScale?: (value: any) => number;
26
+ /** Primary y scale mapping data domain to pixels */
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
+ yScalePrimary?: (value: any) => number;
29
+ /** Secondary y scale when present */
30
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
+ yScaleSecondary?: (value: any) => number;
32
+ }
33
+
34
+ export interface IChartAnnotationLayerProps {
35
+ annotations?: IChartAnnotation[];
36
+ context: IChartAnnotationContext;
37
+ theme: ITheme;
38
+ className?: string;
39
+ }
40
+
41
+ export interface IResolvedAnnotationPosition {
42
+ /** Final absolute position after applying layout and offsets */
43
+ point: IAnnotationPoint;
44
+ /** Raw anchor position before offsets (used for connectors) */
45
+ anchor: IAnnotationPoint;
46
+ }
47
+
48
+ export type ConnectorRenderData = {
49
+ key: string;
50
+ start: IAnnotationPoint;
51
+ end: IAnnotationPoint;
52
+ strokeColor: string;
53
+ strokeWidth: number;
54
+ dashArray?: string;
55
+ arrow: ChartAnnotationArrowHead;
56
+ markerSize: number;
57
+ markerStrokeWidth: number;
58
+ };
@@ -11,6 +11,7 @@ import {
11
11
  AxisScaleType,
12
12
  IAccessibilityProps,
13
13
  IChart,
14
+ IChartAnnotation,
14
15
  IDataPoint,
15
16
  IGanttChartDataPoint,
16
17
  IGroupedVerticalBarChartData,
@@ -194,11 +195,21 @@ export interface ICartesianChartStyles {
194
195
  */
195
196
  chartWrapper?: IStyle;
196
197
 
198
+ /**
199
+ * Styles for the element wrapping the svg and overlays for annotation
200
+ */
201
+ plotContainer?: IStyle;
202
+
197
203
  /**
198
204
  * Styles for the svg tooltip
199
205
  */
200
206
  svgTooltip?: IStyle;
201
207
 
208
+ /**
209
+ * Styles applied to the annotation layer root element
210
+ */
211
+ annotationLayer?: IStyle;
212
+
202
213
  /**
203
214
  * Styles for the chart svg element
204
215
  */
@@ -336,6 +347,11 @@ export interface ICartesianChartProps {
336
347
  */
337
348
  xAxistickSize?: number;
338
349
 
350
+ /**
351
+ * Text annotations rendered on top of the chart area
352
+ */
353
+ annotations?: IChartAnnotation[];
354
+
339
355
  /**
340
356
  * defines the space between the tick line and the data label
341
357
  * @default 10
@@ -709,6 +725,11 @@ export interface IModifiedCartesianChartProps extends ICartesianChartProps {
709
725
  */
710
726
  svgFocusZoneProps?: IFocusZoneProps;
711
727
 
728
+ /**
729
+ * Annotations to render on top of the chart area.
730
+ */
731
+ annotations?: IChartAnnotation[];
732
+
712
733
  /**
713
734
  * The prop used to define the culture to localize the numbers and date
714
735
  */