@fluentui/react-charts 9.0.2 → 9.0.4

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 (229) hide show
  1. package/CHANGELOG.md +64 -7
  2. package/dist/index.d.ts +829 -94
  3. package/lib/AreaChart.js +1 -0
  4. package/lib/AreaChart.js.map +1 -0
  5. package/lib/HeatMapChart.js +1 -0
  6. package/lib/HeatMapChart.js.map +1 -0
  7. package/lib/HorizontalBarChartWithAxis.js +1 -0
  8. package/lib/HorizontalBarChartWithAxis.js.map +1 -0
  9. package/lib/SankeyChart.js +1 -0
  10. package/lib/SankeyChart.js.map +1 -0
  11. package/lib/VerticalStackedBarChart.js +1 -0
  12. package/lib/VerticalStackedBarChart.js.map +1 -0
  13. package/lib/components/AreaChart/AreaChart.js +775 -0
  14. package/lib/components/AreaChart/AreaChart.js.map +1 -0
  15. package/lib/components/AreaChart/AreaChart.types.js +4 -0
  16. package/lib/components/AreaChart/AreaChart.types.js.map +1 -0
  17. package/lib/components/AreaChart/index.js +3 -0
  18. package/lib/components/AreaChart/index.js.map +1 -0
  19. package/lib/components/AreaChart/useAreaChartStyles.styles.js +55 -0
  20. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
  21. package/lib/components/CommonComponents/CartesianChart.js +30 -14
  22. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  23. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  24. package/lib/components/CommonComponents/ChartPopover.js +2 -2
  25. package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
  26. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +7 -123
  27. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  28. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +11 -22
  29. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  30. package/lib/components/DeclarativeChart/DeclarativeChart.js +112 -65
  31. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  32. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +570 -159
  33. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  34. package/lib/components/DonutChart/Arc/Arc.js +1 -1
  35. package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
  36. package/lib/components/DonutChart/DonutChart.js +1 -1
  37. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  38. package/lib/components/DonutChart/Pie/usePieStyles.styles.js +2 -6
  39. package/lib/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -1
  40. package/lib/components/GaugeChart/GaugeChart.js +4 -1
  41. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  42. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  43. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +13 -9
  44. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  45. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +9 -0
  46. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  47. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -9
  48. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  49. package/lib/components/HeatMapChart/HeatMapChart.js +588 -0
  50. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -0
  51. package/lib/components/HeatMapChart/HeatMapChart.types.js +4 -0
  52. package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
  53. package/lib/components/HeatMapChart/index.js +3 -0
  54. package/lib/components/HeatMapChart/index.js.map +1 -0
  55. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +37 -0
  56. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
  57. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +2 -9
  58. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  59. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +571 -0
  60. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
  61. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +4 -0
  62. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
  63. package/lib/components/HorizontalBarChartWithAxis/index.js +3 -0
  64. package/lib/components/HorizontalBarChartWithAxis/index.js.map +1 -0
  65. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +67 -0
  66. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
  67. package/lib/components/Legends/Legends.js +38 -37
  68. package/lib/components/Legends/Legends.js.map +1 -1
  69. package/lib/components/Legends/useLegendsStyles.styles.js +2 -3
  70. package/lib/components/Legends/useLegendsStyles.styles.js.map +1 -1
  71. package/lib/components/LineChart/LineChart.js +43 -35
  72. package/lib/components/LineChart/LineChart.js.map +1 -1
  73. package/lib/components/LineChart/useLineChartStyles.styles.js +1 -10
  74. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  75. package/lib/components/SankeyChart/SankeyChart.js +1023 -0
  76. package/lib/components/SankeyChart/SankeyChart.js.map +1 -0
  77. package/lib/components/SankeyChart/SankeyChart.types.js +3 -0
  78. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -0
  79. package/lib/components/SankeyChart/index.js +3 -0
  80. package/lib/components/SankeyChart/index.js.map +1 -0
  81. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +109 -0
  82. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
  83. package/lib/components/ScatterChart/ScatterChart.js +46 -59
  84. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  85. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +1 -10
  86. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  87. package/lib/components/VerticalBarChart/VerticalBarChart.js +165 -88
  88. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  89. package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
  90. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +3 -11
  91. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  92. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +904 -0
  93. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
  94. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +1 -0
  95. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
  96. package/lib/components/VerticalStackedBarChart/index.js +3 -0
  97. package/lib/components/VerticalStackedBarChart/index.js.map +1 -0
  98. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +65 -0
  99. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
  100. package/lib/index.js +5 -0
  101. package/lib/index.js.map +1 -1
  102. package/lib/types/DataPoint.js +1 -3
  103. package/lib/types/DataPoint.js.map +1 -1
  104. package/lib/utilities/SVGTooltipText.js +49 -4
  105. package/lib/utilities/SVGTooltipText.js.map +1 -1
  106. package/lib/utilities/colors.js +20 -0
  107. package/lib/utilities/colors.js.map +1 -1
  108. package/lib/utilities/string.js +32 -0
  109. package/lib/utilities/string.js.map +1 -0
  110. package/lib/utilities/test-data.js +53 -0
  111. package/lib/utilities/test-data.js.map +1 -1
  112. package/lib/utilities/utilities.js +90 -18
  113. package/lib/utilities/utilities.js.map +1 -1
  114. package/lib-commonjs/AreaChart.js +6 -0
  115. package/lib-commonjs/AreaChart.js.map +1 -0
  116. package/lib-commonjs/HeatMapChart.js +6 -0
  117. package/lib-commonjs/HeatMapChart.js.map +1 -0
  118. package/lib-commonjs/HorizontalBarChartWithAxis.js +6 -0
  119. package/lib-commonjs/HorizontalBarChartWithAxis.js.map +1 -0
  120. package/lib-commonjs/SankeyChart.js +6 -0
  121. package/lib-commonjs/SankeyChart.js.map +1 -0
  122. package/lib-commonjs/VerticalStackedBarChart.js +6 -0
  123. package/lib-commonjs/VerticalStackedBarChart.js.map +1 -0
  124. package/lib-commonjs/components/AreaChart/AreaChart.js +781 -0
  125. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -0
  126. package/lib-commonjs/components/AreaChart/AreaChart.types.js +7 -0
  127. package/lib-commonjs/components/AreaChart/AreaChart.types.js.map +1 -0
  128. package/lib-commonjs/components/AreaChart/index.js +8 -0
  129. package/lib-commonjs/components/AreaChart/index.js.map +1 -0
  130. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +95 -0
  131. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
  132. package/lib-commonjs/components/CommonComponents/CartesianChart.js +29 -14
  133. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  134. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  135. package/lib-commonjs/components/CommonComponents/ChartPopover.js +2 -2
  136. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
  137. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +8 -198
  138. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  139. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +12 -37
  140. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  141. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +120 -73
  142. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  143. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +592 -178
  144. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  145. package/lib-commonjs/components/DonutChart/Arc/Arc.js +1 -1
  146. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  147. package/lib-commonjs/components/DonutChart/DonutChart.js +1 -1
  148. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  149. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js +3 -10
  150. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -1
  151. package/lib-commonjs/components/GaugeChart/GaugeChart.js +4 -1
  152. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  153. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  154. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +14 -8
  155. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  156. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +9 -0
  157. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  158. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -9
  159. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  160. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +599 -0
  161. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -0
  162. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js +7 -0
  163. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
  164. package/lib-commonjs/components/HeatMapChart/index.js +8 -0
  165. package/lib-commonjs/components/HeatMapChart/index.js.map +1 -0
  166. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +59 -0
  167. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
  168. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +2 -16
  169. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  170. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +580 -0
  171. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
  172. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +7 -0
  173. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
  174. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js +8 -0
  175. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js.map +1 -0
  176. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +107 -0
  177. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
  178. package/lib-commonjs/components/Legends/Legends.js +37 -37
  179. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  180. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +2 -2
  181. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +1 -1
  182. package/lib-commonjs/components/LineChart/LineChart.js +41 -33
  183. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  184. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +1 -10
  185. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  186. package/lib-commonjs/components/SankeyChart/SankeyChart.js +1039 -0
  187. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -0
  188. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js +6 -0
  189. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -0
  190. package/lib-commonjs/components/SankeyChart/index.js +8 -0
  191. package/lib-commonjs/components/SankeyChart/index.js.map +1 -0
  192. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +179 -0
  193. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
  194. package/lib-commonjs/components/ScatterChart/ScatterChart.js +45 -58
  195. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  196. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +1 -10
  197. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  198. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +164 -87
  199. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  200. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
  201. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +4 -11
  202. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  203. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +915 -0
  204. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
  205. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +6 -0
  206. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
  207. package/lib-commonjs/components/VerticalStackedBarChart/index.js +8 -0
  208. package/lib-commonjs/components/VerticalStackedBarChart/index.js.map +1 -0
  209. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +113 -0
  210. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
  211. package/lib-commonjs/index.js +5 -0
  212. package/lib-commonjs/index.js.map +1 -1
  213. package/lib-commonjs/types/DataPoint.js +1 -3
  214. package/lib-commonjs/types/DataPoint.js.map +1 -1
  215. package/lib-commonjs/utilities/SVGTooltipText.js +49 -4
  216. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  217. package/lib-commonjs/utilities/colors.js +23 -0
  218. package/lib-commonjs/utilities/colors.js.map +1 -1
  219. package/lib-commonjs/utilities/string.js +29 -0
  220. package/lib-commonjs/utilities/string.js.map +1 -0
  221. package/lib-commonjs/utilities/test-data.js +59 -0
  222. package/lib-commonjs/utilities/test-data.js.map +1 -1
  223. package/lib-commonjs/utilities/utilities.js +94 -17
  224. package/lib-commonjs/utilities/utilities.js.map +1 -1
  225. package/package.json +11 -8
  226. package/lib/components/DeclarativeChart/PlotlySchema.js +0 -7
  227. package/lib/components/DeclarativeChart/PlotlySchema.js.map +0 -1
  228. package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js +0 -10
  229. package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js.map +0 -1
@@ -1,23 +1,57 @@
1
1
  /* eslint-disable @typescript-eslint/naming-convention */ import * as React from 'react';
2
+ import { decodeBase64Fields, isArrayOrTypedArray, isDateArray, isNumberArray, mapFluentChart, sanitizeJson } from '@fluentui/chart-utilities';
3
+ import { tokens } from '@fluentui/react-theme';
4
+ import { ThemeContext_unstable as V9ThemeContext } from '@fluentui/react-shared-contexts';
5
+ import { webLightTheme } from '@fluentui/tokens';
6
+ import * as d3Color from 'd3-color';
7
+ import { isMonthArray, correctYearMonth, transformPlotlyJsonToDonutProps, transformPlotlyJsonToVSBCProps, transformPlotlyJsonToScatterChartProps, transformPlotlyJsonToHorizontalBarWithAxisProps, transformPlotlyJsonToHeatmapProps, transformPlotlyJsonToSankeyProps, transformPlotlyJsonToGaugeProps, transformPlotlyJsonToGVBCProps, transformPlotlyJsonToVBCProps } from './PlotlySchemaAdapter';
2
8
  import { DonutChart } from '../DonutChart/index';
3
- import { isArrayOrTypedArray, isDateArray, isNumberArray, isMonthArray, sanitizeJson, updateXValues, transformPlotlyJsonToDonutProps, transformPlotlyJsonToScatterChartProps, transformPlotlyJsonToVBCProps } from './PlotlySchemaAdapter';
9
+ import { VerticalStackedBarChart } from '../VerticalStackedBarChart/index';
4
10
  import { LineChart } from '../LineChart/index';
11
+ import { HorizontalBarChartWithAxis } from '../HorizontalBarChartWithAxis/index';
12
+ import { AreaChart } from '../AreaChart/index';
13
+ import { HeatMapChart } from '../HeatMapChart/index';
14
+ import { SankeyChart } from '../SankeyChart/SankeyChart';
15
+ import { GaugeChart } from '../GaugeChart/index';
16
+ import { GroupedVerticalBarChart } from '../GroupedVerticalBarChart/index';
5
17
  import { VerticalBarChart } from '../VerticalBarChart/index';
6
18
  import { toImage } from './imageExporter';
7
- import { tokens } from '@fluentui/react-theme';
19
+ import { ScatterChart } from '../ScatterChart/index';
8
20
  const useColorMapping = ()=>{
9
21
  const colorMap = React.useRef(new Map());
10
22
  return colorMap;
11
23
  };
24
+ const useIsDarkTheme = ()=>{
25
+ const parentV9Theme = React.useContext(V9ThemeContext);
26
+ const v9Theme = parentV9Theme ? parentV9Theme : webLightTheme;
27
+ // Get background and foreground colors
28
+ const backgroundColor = d3Color.hsl(v9Theme.colorNeutralBackground1);
29
+ const foregroundColor = d3Color.hsl(v9Theme.colorNeutralForeground1);
30
+ const isDarkTheme = backgroundColor.l < foregroundColor.l;
31
+ return isDarkTheme;
32
+ };
12
33
  /**
13
34
  * DeclarativeChart component.
14
35
  * {@docCategory DeclarativeChart}
15
36
  */ export const DeclarativeChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
16
37
  const { plotlySchema } = sanitizeJson(props.chartSchema);
17
- const plotlyInput = plotlySchema;
38
+ const chart = mapFluentChart(plotlySchema);
39
+ if (!chart.isValid) {
40
+ throw new Error(`Invalid chart schema: ${chart.errorMessage}`);
41
+ }
42
+ let plotlyInput = plotlySchema;
43
+ try {
44
+ plotlyInput = decodeBase64Fields(plotlyInput);
45
+ } catch (error) {
46
+ throw new Error(`Failed to decode plotly schema: ${error}`);
47
+ }
48
+ const plotlyInputWithValidData = {
49
+ ...plotlyInput,
50
+ data: chart.validTracesInfo.map((trace)=>plotlyInput.data[trace[0]])
51
+ };
18
52
  let { selectedLegends } = plotlySchema;
19
53
  const colorMap = useColorMapping();
20
- const isDarkTheme = false;
54
+ const isDarkTheme = useIsDarkTheme();
21
55
  const chartRef = React.useRef(null);
22
56
  if (!isArrayOrTypedArray(selectedLegends)) {
23
57
  selectedLegends = [];
@@ -52,37 +86,47 @@ const useColorMapping = ()=>{
52
86
  legendProps: multiSelectLegendProps,
53
87
  componentRef: chartRef
54
88
  };
55
- const checkAndRenderChart = (renderChartJsx, isAreaChart = false)=>{
56
- var _plotlyInput_data_;
57
- const xValues = plotlyInput.data[0].x;
89
+ const renderLineAreaScatter = (plotlyData, isAreaChart)=>{
90
+ var _plotlyData_;
91
+ const isScatterMarkers = ((_plotlyData_ = plotlyData[0]) === null || _plotlyData_ === void 0 ? void 0 : _plotlyData_.mode) === 'markers';
92
+ const chartProps = {
93
+ ...transformPlotlyJsonToScatterChartProps({
94
+ data: plotlyData,
95
+ layout: plotlyInput.layout
96
+ }, isAreaChart, colorMap, isDarkTheme),
97
+ ...commonProps
98
+ };
99
+ if (isAreaChart) {
100
+ return /*#__PURE__*/ React.createElement(AreaChart, chartProps);
101
+ }
102
+ if (isScatterMarkers) {
103
+ return /*#__PURE__*/ React.createElement(ScatterChart, chartProps);
104
+ }
105
+ return /*#__PURE__*/ React.createElement(LineChart, chartProps);
106
+ };
107
+ const checkAndRenderChart = (isAreaChart = false)=>{
108
+ let fallbackVSBC = false;
109
+ const xValues = plotlyInputWithValidData.data[0].x;
58
110
  const isXDate = isDateArray(xValues);
59
111
  const isXNumber = isNumberArray(xValues);
60
112
  const isXMonth = isMonthArray(xValues);
61
113
  if (isXDate || isXNumber) {
62
- const chartProps = {
63
- ...transformPlotlyJsonToScatterChartProps({
64
- data: plotlyInput.data,
65
- layout: plotlyInput.layout
66
- }, isAreaChart, colorMap, isDarkTheme),
67
- ...commonProps
68
- };
69
- return renderChartJsx(chartProps);
114
+ return renderLineAreaScatter(plotlyInputWithValidData.data, isAreaChart);
70
115
  } else if (isXMonth) {
71
- const updatedData = plotlyInput.data.map((dataPoint)=>({
116
+ const updatedData = plotlyInputWithValidData.data.map((dataPoint)=>({
72
117
  ...dataPoint,
73
- x: updateXValues(dataPoint.x)
118
+ x: correctYearMonth(dataPoint.x)
74
119
  }));
75
- const chartProps = {
76
- ...transformPlotlyJsonToScatterChartProps({
77
- data: updatedData,
78
- layout: plotlyInput.layout
79
- }, isAreaChart, colorMap, isDarkTheme),
80
- ...commonProps
81
- };
82
- return renderChartJsx(chartProps);
120
+ return renderLineAreaScatter(updatedData, isAreaChart);
83
121
  }
84
- throw new Error(`Unsupported chart type :${(_plotlyInput_data_ = plotlyInput.data[0]) === null || _plotlyInput_data_ === void 0 ? void 0 : _plotlyInput_data_.type}`);
122
+ // Unsupported schema, render as VerticalStackedBarChart
123
+ fallbackVSBC = true;
124
+ return /*#__PURE__*/ React.createElement(VerticalStackedBarChart, {
125
+ ...transformPlotlyJsonToVSBCProps(plotlyInputWithValidData, colorMap, isDarkTheme, fallbackVSBC),
126
+ ...commonProps
127
+ });
85
128
  };
129
+ // TODO
86
130
  const exportAsImage = React.useCallback((opts)=>{
87
131
  var _chartRef_current;
88
132
  return toImage((_chartRef_current = chartRef.current) === null || _chartRef_current === void 0 ? void 0 : _chartRef_current.chartContainer, {
@@ -96,55 +140,58 @@ const useColorMapping = ()=>{
96
140
  }), [
97
141
  exportAsImage
98
142
  ]);
99
- switch(plotlyInput.data[0].type){
100
- case 'pie':
143
+ switch(chart.type){
144
+ case 'donut':
101
145
  return /*#__PURE__*/ React.createElement(DonutChart, {
102
- ...transformPlotlyJsonToDonutProps(plotlySchema, colorMap, isDarkTheme),
146
+ ...transformPlotlyJsonToDonutProps(plotlyInputWithValidData, colorMap, isDarkTheme),
147
+ ...commonProps
148
+ });
149
+ case 'horizontalbar':
150
+ return /*#__PURE__*/ React.createElement(HorizontalBarChartWithAxis, {
151
+ ...transformPlotlyJsonToHorizontalBarWithAxisProps(plotlyInputWithValidData, colorMap, isDarkTheme),
152
+ ...commonProps
153
+ });
154
+ case 'groupedverticalbar':
155
+ return /*#__PURE__*/ React.createElement(GroupedVerticalBarChart, {
156
+ ...transformPlotlyJsonToGVBCProps(plotlyInputWithValidData, colorMap, isDarkTheme),
157
+ ...commonProps
158
+ });
159
+ case 'verticalstackedbar':
160
+ return /*#__PURE__*/ React.createElement(VerticalStackedBarChart, {
161
+ ...transformPlotlyJsonToVSBCProps(plotlyInputWithValidData, colorMap, isDarkTheme),
103
162
  ...commonProps
104
163
  });
105
- case 'bar':
106
- var _plotlyInput_data_;
107
- throw new Error(`Unsupported chart type :${(_plotlyInput_data_ = plotlyInput.data[0]) === null || _plotlyInput_data_ === void 0 ? void 0 : _plotlyInput_data_.type}`);
108
- case 'scatter':
109
- if (plotlyInput.data[0].mode === 'markers') {
110
- var _plotlyInput_data_1, _plotlyInput_data_2;
111
- throw new Error(`Unsupported chart - type :${(_plotlyInput_data_1 = plotlyInput.data[0]) === null || _plotlyInput_data_1 === void 0 ? void 0 : _plotlyInput_data_1.type}, mode: ${(_plotlyInput_data_2 = plotlyInput.data[0]) === null || _plotlyInput_data_2 === void 0 ? void 0 : _plotlyInput_data_2.mode}`);
112
- }
113
- const isAreaChart = plotlyInput.data.some((series)=>series.fill === 'tonexty' || series.fill === 'tozeroy');
114
- const renderChartJsx = (chartProps)=>{
115
- if (isAreaChart) {
116
- var _plotlyInput_data_, _plotlyInput_data_1;
117
- throw new Error(`Unsupported chart type :${(_plotlyInput_data_ = plotlyInput.data[0]) === null || _plotlyInput_data_ === void 0 ? void 0 : _plotlyInput_data_.type}, fill: ${(_plotlyInput_data_1 = plotlyInput.data[0]) === null || _plotlyInput_data_1 === void 0 ? void 0 : _plotlyInput_data_1.fill}`);
118
- }
119
- return /*#__PURE__*/ React.createElement(LineChart, chartProps);
120
- };
121
- return checkAndRenderChart(renderChartJsx, isAreaChart);
122
164
  case 'heatmap':
123
- var _plotlyInput_data_3;
124
- throw new Error(`Unsupported chart type :${(_plotlyInput_data_3 = plotlyInput.data[0]) === null || _plotlyInput_data_3 === void 0 ? void 0 : _plotlyInput_data_3.type}`);
165
+ return /*#__PURE__*/ React.createElement(HeatMapChart, {
166
+ ...transformPlotlyJsonToHeatmapProps(plotlyInputWithValidData),
167
+ ...commonProps,
168
+ legendProps: {}
169
+ });
125
170
  case 'sankey':
126
- var _plotlyInput_data_4;
127
- throw new Error(`Unsupported chart type :${(_plotlyInput_data_4 = plotlyInput.data[0]) === null || _plotlyInput_data_4 === void 0 ? void 0 : _plotlyInput_data_4.type}`);
128
- case 'indicator':
171
+ return /*#__PURE__*/ React.createElement(SankeyChart, {
172
+ ...transformPlotlyJsonToSankeyProps(plotlyInputWithValidData, colorMap, isDarkTheme),
173
+ ...commonProps
174
+ });
129
175
  case 'gauge':
130
- var _plotlyInput_data_5, _plotlyInput_data_6;
131
- throw new Error(`Unsupported chart - type: ${(_plotlyInput_data_5 = plotlyInput.data[0]) === null || _plotlyInput_data_5 === void 0 ? void 0 : _plotlyInput_data_5.type}, mode: ${(_plotlyInput_data_6 = plotlyInput.data[0]) === null || _plotlyInput_data_6 === void 0 ? void 0 : _plotlyInput_data_6.mode}`);
132
- case 'histogram':
176
+ return /*#__PURE__*/ React.createElement(GaugeChart, {
177
+ ...transformPlotlyJsonToGaugeProps(plotlyInputWithValidData, colorMap, isDarkTheme),
178
+ ...commonProps
179
+ });
180
+ case 'verticalbar':
133
181
  return /*#__PURE__*/ React.createElement(VerticalBarChart, {
134
- ...transformPlotlyJsonToVBCProps(plotlySchema, colorMap, isDarkTheme),
182
+ ...transformPlotlyJsonToVBCProps(plotlyInputWithValidData, colorMap, isDarkTheme),
135
183
  ...commonProps
136
184
  });
185
+ // TODO: Add 'scatter' as a separate chart type
186
+ case 'area':
187
+ case 'line':
188
+ case 'fallback':
189
+ // Need recheck for area chart as we don't have ability to check for valid months in previous step
190
+ const isAreaChart = plotlyInputWithValidData.data.some((series)=>series.fill === 'tonexty' || series.fill === 'tozeroy' || !!series.stackgroup);
191
+ return checkAndRenderChart(isAreaChart);
137
192
  default:
138
- var _plotlyInput_data_7;
139
- const xValues = plotlyInput.data[0].x;
140
- const yValues = plotlyInput.data[0].y;
141
- if (xValues && yValues && xValues.length > 0 && yValues.length > 0) {
142
- const renderLineChartJsx = (chartProps)=>{
143
- return /*#__PURE__*/ React.createElement(LineChart, chartProps);
144
- };
145
- return checkAndRenderChart(renderLineChartJsx);
146
- }
147
- throw new Error(`Unsupported chart type :${(_plotlyInput_data_7 = plotlyInput.data[0]) === null || _plotlyInput_data_7 === void 0 ? void 0 : _plotlyInput_data_7.type}`);
193
+ var _plotlyInputWithValidData_data_;
194
+ throw new Error(`Unsupported chart type :${(_plotlyInputWithValidData_data_ = plotlyInputWithValidData.data[0]) === null || _plotlyInputWithValidData_data_ === void 0 ? void 0 : _plotlyInputWithValidData_data_.type}`);
148
195
  }
149
196
  });
150
197
  DeclarativeChart.displayName = 'DeclarativeChart';
@@ -1 +1 @@
1
- {"version":3,"sources":["DeclarativeChart.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport * as React from 'react';\nimport { DonutChart } from '../DonutChart/index';\nimport { PlotData, PlotlySchema } from './PlotlySchema';\nimport {\n isArrayOrTypedArray,\n isDateArray,\n isNumberArray,\n isMonthArray,\n sanitizeJson,\n updateXValues,\n transformPlotlyJsonToDonutProps,\n transformPlotlyJsonToScatterChartProps,\n transformPlotlyJsonToVBCProps,\n} from './PlotlySchemaAdapter';\nimport { LineChart, LineChartProps } from '../LineChart/index';\nimport { VerticalBarChart } from '../VerticalBarChart/index';\nimport { ImageExportOptions, toImage } from './imageExporter';\nimport { Chart } from '../../types/index';\nimport { tokens } from '@fluentui/react-theme';\n\n/**\n * DeclarativeChart schema.\n * {@docCategory DeclarativeChart}\n */\nexport interface Schema {\n /**\n * Plotly schema represented as JSON object\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n plotlySchema: any;\n}\n\n/**\n * DeclarativeChart props.\n * {@docCategory DeclarativeChart}\n */\nexport interface DeclarativeChartProps extends React.RefAttributes<HTMLDivElement> {\n /**\n * The schema representing the chart data, layout and configuration\n */\n chartSchema: Schema;\n\n /**\n * Callback when an event occurs\n */\n onSchemaChange?: (eventData: Schema) => void;\n\n /**\n * Optional callback to access the IDeclarativeChart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<IDeclarativeChart>;\n}\n\n/**\n * {@docCategory DeclarativeChart}\n */\nexport interface IDeclarativeChart {\n exportAsImage: (opts?: ImageExportOptions) => Promise<string>;\n}\n\nconst useColorMapping = () => {\n const colorMap = React.useRef(new Map<string, string>());\n return colorMap;\n};\n\n/**\n * DeclarativeChart component.\n * {@docCategory DeclarativeChart}\n */\nexport const DeclarativeChart: React.FunctionComponent<DeclarativeChartProps> = React.forwardRef<\n HTMLDivElement,\n DeclarativeChartProps\n>((props, forwardedRef) => {\n const { plotlySchema } = sanitizeJson(props.chartSchema);\n const plotlyInput = plotlySchema as PlotlySchema;\n let { selectedLegends } = plotlySchema;\n const colorMap = useColorMapping();\n const isDarkTheme = false;\n const chartRef = React.useRef<Chart>(null);\n\n if (!isArrayOrTypedArray(selectedLegends)) {\n selectedLegends = [];\n }\n\n const [activeLegends, setActiveLegends] = React.useState<string[]>(selectedLegends);\n const onActiveLegendsChange = (keys: string[]) => {\n setActiveLegends(keys);\n if (props.onSchemaChange) {\n props.onSchemaChange({ plotlySchema: { plotlyInput, selectedLegends: keys } });\n }\n };\n\n React.useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { plotlySchema } = sanitizeJson(props.chartSchema);\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { selectedLegends } = plotlySchema;\n setActiveLegends(selectedLegends ?? []);\n }, [props.chartSchema]);\n\n const multiSelectLegendProps = {\n canSelectMultipleLegends: true,\n onChange: onActiveLegendsChange,\n selectedLegends: activeLegends,\n };\n\n const commonProps = {\n legendProps: multiSelectLegendProps,\n componentRef: chartRef,\n };\n\n const checkAndRenderChart = (\n renderChartJsx: (chartProps: LineChartProps) => JSX.Element,\n isAreaChart: boolean = false,\n ) => {\n const xValues = (plotlyInput.data[0] as PlotData).x;\n const isXDate = isDateArray(xValues);\n const isXNumber = isNumberArray(xValues);\n const isXMonth = isMonthArray(xValues);\n if (isXDate || isXNumber) {\n const chartProps: LineChartProps = {\n ...transformPlotlyJsonToScatterChartProps(\n { data: plotlyInput.data, layout: plotlyInput.layout },\n isAreaChart,\n colorMap,\n isDarkTheme,\n ),\n ...commonProps,\n };\n return renderChartJsx(chartProps);\n } else if (isXMonth) {\n const updatedData = plotlyInput.data.map((dataPoint: PlotData) => ({\n ...dataPoint,\n x: updateXValues(dataPoint.x),\n }));\n const chartProps: LineChartProps = {\n ...transformPlotlyJsonToScatterChartProps(\n { data: updatedData, layout: plotlyInput.layout },\n isAreaChart,\n colorMap,\n isDarkTheme,\n ),\n ...commonProps,\n };\n return renderChartJsx(chartProps);\n }\n throw new Error(`Unsupported chart type :${plotlyInput.data[0]?.type}`);\n };\n\n const exportAsImage = React.useCallback((opts?: ImageExportOptions) => {\n return toImage(chartRef.current?.chartContainer, {\n background: tokens.colorNeutralBackground1,\n scale: 5,\n ...opts,\n });\n }, []);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n exportAsImage,\n }),\n [exportAsImage],\n );\n\n switch (plotlyInput.data[0].type) {\n case 'pie':\n return <DonutChart {...transformPlotlyJsonToDonutProps(plotlySchema, colorMap, isDarkTheme)} {...commonProps} />;\n case 'bar':\n throw new Error(`Unsupported chart type :${plotlyInput.data[0]?.type}`);\n case 'scatter':\n if (plotlyInput.data[0].mode === 'markers') {\n throw new Error(`Unsupported chart - type :${plotlyInput.data[0]?.type}, mode: ${plotlyInput.data[0]?.mode}`);\n }\n const isAreaChart = plotlyInput.data.some(\n (series: PlotData) => series.fill === 'tonexty' || series.fill === 'tozeroy',\n );\n const renderChartJsx = (chartProps: LineChartProps) => {\n if (isAreaChart) {\n throw new Error(\n `Unsupported chart type :${plotlyInput.data[0]?.type}, fill: ${\n (plotlyInput.data[0] as Partial<PlotData>)?.fill\n }`,\n );\n }\n return <LineChart {...chartProps} />;\n };\n return checkAndRenderChart(renderChartJsx, isAreaChart);\n case 'heatmap':\n throw new Error(`Unsupported chart type :${plotlyInput.data[0]?.type}`);\n case 'sankey':\n throw new Error(`Unsupported chart type :${plotlyInput.data[0]?.type}`);\n case 'indicator':\n case 'gauge':\n throw new Error(`Unsupported chart - type: ${plotlyInput.data[0]?.type}, mode: ${plotlyInput.data[0]?.mode}`);\n case 'histogram':\n return (\n <VerticalBarChart {...transformPlotlyJsonToVBCProps(plotlySchema, colorMap, isDarkTheme)} {...commonProps} />\n );\n default:\n const xValues = (plotlyInput.data[0] as PlotData).x;\n const yValues = (plotlyInput.data[0] as PlotData).y;\n if (xValues && yValues && xValues.length > 0 && yValues.length > 0) {\n const renderLineChartJsx = (chartProps: LineChartProps) => {\n return <LineChart {...chartProps} />;\n };\n return checkAndRenderChart(renderLineChartJsx);\n }\n throw new Error(`Unsupported chart type :${plotlyInput.data[0]?.type}`);\n }\n});\nDeclarativeChart.displayName = 'DeclarativeChart';\n"],"names":["React","DonutChart","isArrayOrTypedArray","isDateArray","isNumberArray","isMonthArray","sanitizeJson","updateXValues","transformPlotlyJsonToDonutProps","transformPlotlyJsonToScatterChartProps","transformPlotlyJsonToVBCProps","LineChart","VerticalBarChart","toImage","tokens","useColorMapping","colorMap","useRef","Map","DeclarativeChart","forwardRef","props","forwardedRef","plotlySchema","chartSchema","plotlyInput","selectedLegends","isDarkTheme","chartRef","activeLegends","setActiveLegends","useState","onActiveLegendsChange","keys","onSchemaChange","useEffect","multiSelectLegendProps","canSelectMultipleLegends","onChange","commonProps","legendProps","componentRef","checkAndRenderChart","renderChartJsx","isAreaChart","xValues","data","x","isXDate","isXNumber","isXMonth","chartProps","layout","updatedData","map","dataPoint","Error","type","exportAsImage","useCallback","opts","current","chartContainer","background","colorNeutralBackground1","scale","useImperativeHandle","mode","some","series","fill","yValues","y","length","renderLineChartJsx","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC,EAAE,cAAnBrB,0CAAAA,oBAAqBgC,IAAI,CAAC,CAAC;IAC1E;AACF,GAAG;AACHtC,iBAAiBwD,WAAW,GAAG"}
1
+ {"version":3,"sources":["DeclarativeChart.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport * as React from 'react';\nimport type { Data, PlotData, PlotlySchema, OutputChartType } from '@fluentui/chart-utilities';\nimport {\n decodeBase64Fields,\n isArrayOrTypedArray,\n isDateArray,\n isNumberArray,\n mapFluentChart,\n sanitizeJson,\n} from '@fluentui/chart-utilities';\nimport { tokens } from '@fluentui/react-theme';\nimport { ThemeContext_unstable as V9ThemeContext } from '@fluentui/react-shared-contexts';\nimport { Theme, webLightTheme } from '@fluentui/tokens';\nimport * as d3Color from 'd3-color';\n\nimport {\n isMonthArray,\n correctYearMonth,\n transformPlotlyJsonToDonutProps,\n transformPlotlyJsonToVSBCProps,\n transformPlotlyJsonToScatterChartProps,\n transformPlotlyJsonToHorizontalBarWithAxisProps,\n transformPlotlyJsonToHeatmapProps,\n transformPlotlyJsonToSankeyProps,\n transformPlotlyJsonToGaugeProps,\n transformPlotlyJsonToGVBCProps,\n transformPlotlyJsonToVBCProps,\n} from './PlotlySchemaAdapter';\nimport { DonutChart } from '../DonutChart/index';\nimport { VerticalStackedBarChart } from '../VerticalStackedBarChart/index';\nimport { LineChart, LineChartProps } from '../LineChart/index';\nimport { HorizontalBarChartWithAxis } from '../HorizontalBarChartWithAxis/index';\nimport { AreaChart, AreaChartProps } from '../AreaChart/index';\nimport { HeatMapChart } from '../HeatMapChart/index';\nimport { SankeyChart } from '../SankeyChart/SankeyChart';\nimport { GaugeChart } from '../GaugeChart/index';\nimport { GroupedVerticalBarChart } from '../GroupedVerticalBarChart/index';\nimport { VerticalBarChart } from '../VerticalBarChart/index';\nimport { ImageExportOptions, toImage } from './imageExporter';\nimport { Chart } from '../../types/index';\nimport { ScatterChart } from '../ScatterChart/index';\n// TODO\n// import { withResponsiveContainer } from '../ResponsiveContainer/withResponsiveContainer';\n\n// const ResponsiveDonutChart = withResponsiveContainer(DonutChart);\n// const ResponsiveVerticalStackedBarChart = withResponsiveContainer(VerticalStackedBarChart);\n// const ResponsiveLineChart = withResponsiveContainer(LineChart);\n// const ResponsiveHorizontalBarChartWithAxis = withResponsiveContainer(HorizontalBarChartWithAxis);\n// const ResponsiveAreaChart = withResponsiveContainer(AreaChart);\n// const ResponsiveHeatMapChart = withResponsiveContainer(HeatMapChart);\n// const ResponsiveSankeyChart = withResponsiveContainer(SankeyChart);\n// const ResponsiveGaugeChart = withResponsiveContainer(GaugeChart);\n// const ResponsiveGroupedVerticalBarChart = withResponsiveContainer(GroupedVerticalBarChart);\n// const ResponsiveVerticalBarChart = withResponsiveContainer(VerticalBarChart);\n\n/**\n * DeclarativeChart schema.\n * {@docCategory DeclarativeChart}\n */\nexport interface Schema {\n /**\n * Plotly schema represented as JSON object\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n plotlySchema: any;\n}\n\n/**\n * DeclarativeChart props.\n * {@docCategory DeclarativeChart}\n */\nexport interface DeclarativeChartProps extends React.RefAttributes<HTMLDivElement> {\n /**\n * The schema representing the chart data, layout and configuration\n */\n chartSchema: Schema;\n\n /**\n * Callback when an event occurs\n */\n onSchemaChange?: (eventData: Schema) => void;\n\n /**\n * Optional callback to access the IDeclarativeChart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<IDeclarativeChart>;\n}\n\n/**\n * {@docCategory DeclarativeChart}\n */\nexport interface IDeclarativeChart {\n exportAsImage: (opts?: ImageExportOptions) => Promise<string>;\n}\n\nconst useColorMapping = () => {\n const colorMap = React.useRef(new Map<string, string>());\n return colorMap;\n};\n\nconst useIsDarkTheme = (): boolean => {\n const parentV9Theme = React.useContext(V9ThemeContext) as Theme;\n const v9Theme: Theme = parentV9Theme ? parentV9Theme : webLightTheme;\n\n // Get background and foreground colors\n const backgroundColor = d3Color.hsl(v9Theme.colorNeutralBackground1);\n const foregroundColor = d3Color.hsl(v9Theme.colorNeutralForeground1);\n\n const isDarkTheme = backgroundColor.l < foregroundColor.l;\n\n return isDarkTheme;\n};\n\n/**\n * DeclarativeChart component.\n * {@docCategory DeclarativeChart}\n */\nexport const DeclarativeChart: React.FunctionComponent<DeclarativeChartProps> = React.forwardRef<\n HTMLDivElement,\n DeclarativeChartProps\n>((props, forwardedRef) => {\n const { plotlySchema } = sanitizeJson(props.chartSchema);\n const chart: OutputChartType = mapFluentChart(plotlySchema);\n if (!chart.isValid) {\n throw new Error(`Invalid chart schema: ${chart.errorMessage}`);\n }\n let plotlyInput = plotlySchema as PlotlySchema;\n try {\n plotlyInput = decodeBase64Fields(plotlyInput);\n } catch (error) {\n throw new Error(`Failed to decode plotly schema: ${error}`);\n }\n const plotlyInputWithValidData: PlotlySchema = {\n ...plotlyInput,\n data: chart.validTracesInfo!.map(trace => plotlyInput.data[trace[0]]),\n };\n\n let { selectedLegends } = plotlySchema;\n const colorMap = useColorMapping();\n const isDarkTheme = useIsDarkTheme();\n const chartRef = React.useRef<Chart>(null);\n\n if (!isArrayOrTypedArray(selectedLegends)) {\n selectedLegends = [];\n }\n\n const [activeLegends, setActiveLegends] = React.useState<string[]>(selectedLegends);\n const onActiveLegendsChange = (keys: string[]) => {\n setActiveLegends(keys);\n if (props.onSchemaChange) {\n props.onSchemaChange({ plotlySchema: { plotlyInput, selectedLegends: keys } });\n }\n };\n\n React.useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { plotlySchema } = sanitizeJson(props.chartSchema);\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { selectedLegends } = plotlySchema;\n setActiveLegends(selectedLegends ?? []);\n }, [props.chartSchema]);\n\n const multiSelectLegendProps = {\n canSelectMultipleLegends: true,\n onChange: onActiveLegendsChange,\n selectedLegends: activeLegends,\n };\n\n const commonProps = {\n legendProps: multiSelectLegendProps,\n componentRef: chartRef,\n };\n\n const renderLineAreaScatter = (plotlyData: Data[], isAreaChart: boolean): JSX.Element => {\n const isScatterMarkers = (plotlyData[0] as PlotData)?.mode === 'markers';\n const chartProps: LineChartProps | AreaChartProps = {\n ...transformPlotlyJsonToScatterChartProps(\n { data: plotlyData, layout: plotlyInput.layout },\n isAreaChart,\n colorMap,\n isDarkTheme,\n ),\n ...commonProps,\n };\n if (isAreaChart) {\n return <AreaChart {...chartProps} />;\n }\n if (isScatterMarkers) {\n return <ScatterChart {...chartProps} />;\n }\n return <LineChart {...chartProps} />;\n };\n\n const checkAndRenderChart = (isAreaChart: boolean = false) => {\n let fallbackVSBC = false;\n const xValues = (plotlyInputWithValidData.data[0] as PlotData).x;\n const isXDate = isDateArray(xValues);\n const isXNumber = isNumberArray(xValues);\n const isXMonth = isMonthArray(xValues);\n if (isXDate || isXNumber) {\n return renderLineAreaScatter(plotlyInputWithValidData.data, isAreaChart);\n } else if (isXMonth) {\n const updatedData = plotlyInputWithValidData.data.map((dataPoint: PlotData) => ({\n ...dataPoint,\n x: correctYearMonth(dataPoint.x),\n }));\n return renderLineAreaScatter(updatedData, isAreaChart);\n }\n // Unsupported schema, render as VerticalStackedBarChart\n fallbackVSBC = true;\n return (\n <VerticalStackedBarChart\n {...transformPlotlyJsonToVSBCProps(plotlyInputWithValidData, colorMap, isDarkTheme, fallbackVSBC)}\n {...commonProps}\n />\n );\n };\n\n // TODO\n const exportAsImage = React.useCallback((opts?: ImageExportOptions) => {\n return toImage(chartRef.current?.chartContainer, {\n background: tokens.colorNeutralBackground1,\n scale: 5,\n ...opts,\n });\n }, []);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n exportAsImage,\n }),\n [exportAsImage],\n );\n\n switch (chart.type) {\n case 'donut':\n return (\n <DonutChart\n {...transformPlotlyJsonToDonutProps(plotlyInputWithValidData, colorMap, isDarkTheme)}\n {...commonProps}\n />\n );\n case 'horizontalbar':\n return (\n <HorizontalBarChartWithAxis\n {...transformPlotlyJsonToHorizontalBarWithAxisProps(plotlyInputWithValidData, colorMap, isDarkTheme)}\n {...commonProps}\n />\n );\n case 'groupedverticalbar':\n return (\n <GroupedVerticalBarChart\n {...transformPlotlyJsonToGVBCProps(plotlyInputWithValidData, colorMap, isDarkTheme)}\n {...commonProps}\n />\n );\n case 'verticalstackedbar':\n return (\n <VerticalStackedBarChart\n {...transformPlotlyJsonToVSBCProps(plotlyInputWithValidData, colorMap, isDarkTheme)}\n {...commonProps}\n />\n );\n case 'heatmap':\n return (\n <HeatMapChart\n {...transformPlotlyJsonToHeatmapProps(plotlyInputWithValidData)}\n {...commonProps}\n legendProps={{}}\n />\n );\n case 'sankey':\n return (\n <SankeyChart\n {...transformPlotlyJsonToSankeyProps(plotlyInputWithValidData, colorMap, isDarkTheme)}\n {...commonProps}\n />\n );\n case 'gauge':\n return (\n <GaugeChart\n {...transformPlotlyJsonToGaugeProps(plotlyInputWithValidData, colorMap, isDarkTheme)}\n {...commonProps}\n />\n );\n case 'verticalbar':\n return (\n <VerticalBarChart\n {...transformPlotlyJsonToVBCProps(plotlyInputWithValidData, colorMap, isDarkTheme)}\n {...commonProps}\n />\n );\n // TODO: Add 'scatter' as a separate chart type\n case 'area':\n case 'line':\n case 'fallback':\n // Need recheck for area chart as we don't have ability to check for valid months in previous step\n const isAreaChart = plotlyInputWithValidData.data.some(\n (series: PlotData) => series.fill === 'tonexty' || series.fill === 'tozeroy' || !!series.stackgroup,\n );\n return checkAndRenderChart(isAreaChart);\n default:\n throw new Error(`Unsupported chart type :${plotlyInputWithValidData.data[0]?.type}`);\n }\n});\nDeclarativeChart.displayName = 'DeclarativeChart';\n"],"names":["React","decodeBase64Fields","isArrayOrTypedArray","isDateArray","isNumberArray","mapFluentChart","sanitizeJson","tokens","ThemeContext_unstable","V9ThemeContext","webLightTheme","d3Color","isMonthArray","correctYearMonth","transformPlotlyJsonToDonutProps","transformPlotlyJsonToVSBCProps","transformPlotlyJsonToScatterChartProps","transformPlotlyJsonToHorizontalBarWithAxisProps","transformPlotlyJsonToHeatmapProps","transformPlotlyJsonToSankeyProps","transformPlotlyJsonToGaugeProps","transformPlotlyJsonToGVBCProps","transformPlotlyJsonToVBCProps","DonutChart","VerticalStackedBarChart","LineChart","HorizontalBarChartWithAxis","AreaChart","HeatMapChart","SankeyChart","GaugeChart","GroupedVerticalBarChart","VerticalBarChart","toImage","ScatterChart","useColorMapping","colorMap","useRef","Map","useIsDarkTheme","parentV9Theme","useContext","v9Theme","backgroundColor","hsl","colorNeutralBackground1","foregroundColor","colorNeutralForeground1","isDarkTheme","l","DeclarativeChart","forwardRef","props","forwardedRef","plotlySchema","chartSchema","chart","isValid","Error","errorMessage","plotlyInput","error","plotlyInputWithValidData","data","validTracesInfo","map","trace","selectedLegends","chartRef","activeLegends","setActiveLegends","useState","onActiveLegendsChange","keys","onSchemaChange","useEffect","multiSelectLegendProps","canSelectMultipleLegends","onChange","commonProps","legendProps","componentRef","renderLineAreaScatter","plotlyData","isAreaChart","isScatterMarkers","mode","chartProps","layout","checkAndRenderChart","fallbackVSBC","xValues","x","isXDate","isXNumber","isXMonth","updatedData","dataPoint","exportAsImage","useCallback","opts","current","chartContainer","background","scale","useImperativeHandle","type","some","series","fill","stackgroup","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,uDAAuD,GACvD,YAAYA,WAAW,QAAQ;AAE/B,SACEC,kBAAkB,EAClBC,mBAAmB,EACnBC,WAAW,EACXC,aAAa,EACbC,cAAc,EACdC,YAAY,QACP,4BAA4B;AACnC,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,yBAAyBC,cAAc,QAAQ,kCAAkC;AAC1F,SAAgBC,aAAa,QAAQ,mBAAm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