@fluentui/react-charts 9.0.2 → 9.0.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 (185) hide show
  1. package/CHANGELOG.md +48 -7
  2. package/dist/index.d.ts +767 -0
  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 +64 -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/DeclarativeChart/DeclarativeChart.js +112 -65
  25. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  26. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +570 -159
  27. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  28. package/lib/components/DonutChart/Arc/Arc.js +1 -1
  29. package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
  30. package/lib/components/DonutChart/DonutChart.js +1 -1
  31. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  32. package/lib/components/GaugeChart/GaugeChart.js +3 -0
  33. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  34. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  35. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +9 -0
  36. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  37. package/lib/components/HeatMapChart/HeatMapChart.js +588 -0
  38. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -0
  39. package/lib/components/HeatMapChart/HeatMapChart.types.js +4 -0
  40. package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
  41. package/lib/components/HeatMapChart/index.js +3 -0
  42. package/lib/components/HeatMapChart/index.js.map +1 -0
  43. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +46 -0
  44. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
  45. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +571 -0
  46. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
  47. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +4 -0
  48. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
  49. package/lib/components/HorizontalBarChartWithAxis/index.js +3 -0
  50. package/lib/components/HorizontalBarChartWithAxis/index.js.map +1 -0
  51. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +76 -0
  52. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
  53. package/lib/components/Legends/Legends.js +38 -37
  54. package/lib/components/Legends/Legends.js.map +1 -1
  55. package/lib/components/LineChart/LineChart.js +43 -35
  56. package/lib/components/LineChart/LineChart.js.map +1 -1
  57. package/lib/components/SankeyChart/SankeyChart.js +1022 -0
  58. package/lib/components/SankeyChart/SankeyChart.js.map +1 -0
  59. package/lib/components/SankeyChart/SankeyChart.types.js +3 -0
  60. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -0
  61. package/lib/components/SankeyChart/index.js +3 -0
  62. package/lib/components/SankeyChart/index.js.map +1 -0
  63. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +109 -0
  64. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
  65. package/lib/components/ScatterChart/ScatterChart.js +46 -59
  66. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  67. package/lib/components/VerticalBarChart/VerticalBarChart.js +165 -88
  68. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  69. package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
  70. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +904 -0
  71. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
  72. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +1 -0
  73. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
  74. package/lib/components/VerticalStackedBarChart/index.js +3 -0
  75. package/lib/components/VerticalStackedBarChart/index.js.map +1 -0
  76. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +73 -0
  77. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
  78. package/lib/index.js +5 -0
  79. package/lib/index.js.map +1 -1
  80. package/lib/types/DataPoint.js +1 -3
  81. package/lib/types/DataPoint.js.map +1 -1
  82. package/lib/utilities/SVGTooltipText.js +49 -4
  83. package/lib/utilities/SVGTooltipText.js.map +1 -1
  84. package/lib/utilities/colors.js +20 -0
  85. package/lib/utilities/colors.js.map +1 -1
  86. package/lib/utilities/string.js +32 -0
  87. package/lib/utilities/string.js.map +1 -0
  88. package/lib/utilities/test-data.js +53 -0
  89. package/lib/utilities/test-data.js.map +1 -1
  90. package/lib/utilities/utilities.js +90 -18
  91. package/lib/utilities/utilities.js.map +1 -1
  92. package/lib-commonjs/AreaChart.js +6 -0
  93. package/lib-commonjs/AreaChart.js.map +1 -0
  94. package/lib-commonjs/HeatMapChart.js +6 -0
  95. package/lib-commonjs/HeatMapChart.js.map +1 -0
  96. package/lib-commonjs/HorizontalBarChartWithAxis.js +6 -0
  97. package/lib-commonjs/HorizontalBarChartWithAxis.js.map +1 -0
  98. package/lib-commonjs/SankeyChart.js +6 -0
  99. package/lib-commonjs/SankeyChart.js.map +1 -0
  100. package/lib-commonjs/VerticalStackedBarChart.js +6 -0
  101. package/lib-commonjs/VerticalStackedBarChart.js.map +1 -0
  102. package/lib-commonjs/components/AreaChart/AreaChart.js +781 -0
  103. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -0
  104. package/lib-commonjs/components/AreaChart/AreaChart.types.js +7 -0
  105. package/lib-commonjs/components/AreaChart/AreaChart.types.js.map +1 -0
  106. package/lib-commonjs/components/AreaChart/index.js +8 -0
  107. package/lib-commonjs/components/AreaChart/index.js.map +1 -0
  108. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +104 -0
  109. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
  110. package/lib-commonjs/components/CommonComponents/CartesianChart.js +29 -14
  111. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  112. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  113. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +120 -73
  114. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  115. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +592 -178
  116. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  117. package/lib-commonjs/components/DonutChart/Arc/Arc.js +1 -1
  118. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  119. package/lib-commonjs/components/DonutChart/DonutChart.js +1 -1
  120. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  121. package/lib-commonjs/components/GaugeChart/GaugeChart.js +3 -0
  122. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  123. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  124. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +9 -0
  125. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  126. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +599 -0
  127. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -0
  128. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js +7 -0
  129. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
  130. package/lib-commonjs/components/HeatMapChart/index.js +8 -0
  131. package/lib-commonjs/components/HeatMapChart/index.js.map +1 -0
  132. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +68 -0
  133. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
  134. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +580 -0
  135. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
  136. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +7 -0
  137. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
  138. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js +8 -0
  139. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js.map +1 -0
  140. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +116 -0
  141. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
  142. package/lib-commonjs/components/Legends/Legends.js +37 -37
  143. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  144. package/lib-commonjs/components/LineChart/LineChart.js +41 -33
  145. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  146. package/lib-commonjs/components/SankeyChart/SankeyChart.js +1038 -0
  147. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -0
  148. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js +6 -0
  149. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -0
  150. package/lib-commonjs/components/SankeyChart/index.js +8 -0
  151. package/lib-commonjs/components/SankeyChart/index.js.map +1 -0
  152. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +179 -0
  153. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
  154. package/lib-commonjs/components/ScatterChart/ScatterChart.js +45 -58
  155. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  156. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +164 -87
  157. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  158. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
  159. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +915 -0
  160. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
  161. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +6 -0
  162. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
  163. package/lib-commonjs/components/VerticalStackedBarChart/index.js +8 -0
  164. package/lib-commonjs/components/VerticalStackedBarChart/index.js.map +1 -0
  165. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +120 -0
  166. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
  167. package/lib-commonjs/index.js +5 -0
  168. package/lib-commonjs/index.js.map +1 -1
  169. package/lib-commonjs/types/DataPoint.js +1 -3
  170. package/lib-commonjs/types/DataPoint.js.map +1 -1
  171. package/lib-commonjs/utilities/SVGTooltipText.js +49 -4
  172. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  173. package/lib-commonjs/utilities/colors.js +23 -0
  174. package/lib-commonjs/utilities/colors.js.map +1 -1
  175. package/lib-commonjs/utilities/string.js +29 -0
  176. package/lib-commonjs/utilities/string.js.map +1 -0
  177. package/lib-commonjs/utilities/test-data.js +59 -0
  178. package/lib-commonjs/utilities/test-data.js.map +1 -1
  179. package/lib-commonjs/utilities/utilities.js +94 -17
  180. package/lib-commonjs/utilities/utilities.js.map +1 -1
  181. package/package.json +11 -8
  182. package/lib/components/DeclarativeChart/PlotlySchema.js +0 -7
  183. package/lib/components/DeclarativeChart/PlotlySchema.js.map +0 -1
  184. package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js +0 -10
  185. package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js.map +0 -1
@@ -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":["DeclarativeChart","useColorMapping","colorMap","React","useRef","Map","forwardRef","props","forwardedRef","plotlySchema","sanitizeJson","chartSchema","plotlyInput","selectedLegends","isDarkTheme","chartRef","isArrayOrTypedArray","activeLegends","setActiveLegends","useState","onActiveLegendsChange","keys","onSchemaChange","useEffect","multiSelectLegendProps","canSelectMultipleLegends","onChange","commonProps","legendProps","componentRef","checkAndRenderChart","renderChartJsx","isAreaChart","xValues","data","x","isXDate","isDateArray","isXNumber","isNumberArray","isXMonth","isMonthArray","chartProps","transformPlotlyJsonToScatterChartProps","layout","updatedData","map","dataPoint","updateXValues","Error","type","exportAsImage","useCallback","opts","toImage","current","chartContainer","background","tokens","colorNeutralBackground1","scale","useImperativeHandle","createElement","DonutChart","transformPlotlyJsonToDonutProps","mode","some","series","fill","_plotlyInput_data_1","LineChart","VerticalBarCh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F,MAAE,QAAnBtB,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAqBsC,IAAI,CAAC,QAAQ,EAAA,AAAEtC,CAAAA,sBAAAA,YAAYsB,IAAI,CAAC,EAAE,AAAF,MAAE,QAAnBtB,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAqBqD,IAAI,CAAC,CAAC;QAC9G,KAAK;YACH,OAAA,WAAA,GACE9D,OAAA2D,aAAA,CAACS,wBAAAA,EAAAA;gBAAkB,GAAGC,IAAAA,kDAAAA,EAA8B/D,cAAcP,UAAUY,YAAY;gBAAG,GAAGa,WAAW;;QAE7G;gBAS6Cf;YAR3C,MAAMqB,UAAUrB,YAAasB,IAAI,CAAC,EAAE,CAAcC,CAAC;YACnD,MAAMsC,UAAU7D,YAAasB,IAAI,CAAC,EAAE,CAAcwC,CAAC;YACnD,IAAIzC,WAAWwC,WAAWxC,QAAQ0C,MAAM,GAAG,KAAKF,QAAQE,MAAM,GAAG,GAAG;gBAClE,MAAMC,qBAAqB,CAAClC;oBAC1B,OAAA,WAAA,GAAOvC,OAAA2D,aAAA,CAACQ,iBAAAA,EAAc5B;gBACxB;gBACA,OAAOZ,oBAAoB8C;YAC7B;YACA,MAAM,IAAI3B,MAAM,CAAC,wBAAwB,EAAA,AAAErC,CAAAA,sBAAAA,YAAYsB,IAAI,CAAC,EAAE,AAAF,MAAE,QAAnBtB,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAqBsC,IAAI,CAAC,CAAC;IAC1E;AACF;AACAlD,iBAAiB6E,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":["DeclarativeChart","useColorMapping","colorMap","React","useRef","Map","useIsDarkTheme","parentV9Theme","useContext","V9ThemeContext","v9Theme","webLightTheme","backgroundColor","d3Color","hsl","colorNeutralBackground1","foregroundColor","colorNeutralForeground1","isDarkTheme","l","forwardRef","props","forwardedRef","plotlySchema","sanitizeJson","chartSchema","chart","mapFluentChart","isValid","Error","errorMessage","plotlyInput","decodeBase64Fields","error","plotlyInputWithValidData","data","validTracesInfo","map","trace","selectedLegends","chartRef","isArrayOrTypedArray","activeLegends","setActiveLegends","useState","onActiveLegendsChange","keys","onSchemaChange","useEffect","multiSelectLegendProps","canSelectMultipleLegends","onChange","commonProps","legendProps","componentRef","renderLineAreaScatter","plotlyData","isAreaChart","isScatterMarkers","_plotlyData_","mode","chartProps","transformPlotlyJsonToScatterChartProps","layout","createElement","AreaChart","ScatterChart","LineChart","checkAndRenderChart","fallbackVSBC","xValues","x","isXDate","isDateArray","isXNumber","isNumberArray","isXMonth","isMonthArray","updatedData","dataPoint","correctYearMonth","VerticalStackedBarChart","transformPlotlyJsonToVSBCProps","exportAsImage","useCallback","opts","toImage","current","chartContainer","background","tokens","scale","useImperativeHandle","type","DonutChart","transformPlotlyJsonToDonutProps","HorizontalBarChartWithAxis","transformPlotlyJsonToHorizontalBarWithAxisProps","GroupedVerticalBarChart","transformPlotlyJsonToGVBCProps","HeatMapChart","transformPlotlyJsonToHeatmapProps","SankeyChart","transformPlotlyJsonToSankeyProps","GaugeChart","transformPlotlyJsonToGaugeProps","VerticalBarChart","transformPlotlyJsonToVBCProps","some","series","fill","stackgroup","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,uDAAuD;;;;+BAuH1CA;;;eAAAA;;;;iEAtHU;gCAShB;4BACgB;qCACiC;wBACnB;mEACZ;qCAclB;uBACoB;wBACa;wBACE;wBACC;wBACD;wBACb;6BACD;wBACD;wBACa;wBACP;+BACW;wBAEf;AAwD7B,MAAMC,kBAAkB;IACtB,MAAMC,WAAWC,OAAMC,MAAM,CAAC,IAAIC;IAClC,OAAOH;AACT;AAEA,MAAMI,iBAAiB;IACrB,MAAMC,gBAAgBJ,OAAMK,UAAU,CAACC,0CAAAA;IACvC,MAAMC,UAAiBH,gBAAgBA,gBAAgBI,qBAAAA;IAEvD,uCAAuC;IACvC,MAAMC,kBAAkBC,SAAQC,GAAG,CAACJ,QAAQK,uBAAuB;IACnE,MAAMC,kBAAkBH,SAAQC,GAAG,CAACJ,QAAQO,uBAAuB;IAEnE,MAAMC,cAAcN,gBAAgBO,CAAC,GAAGH,gBAAgBG,CAAC;IAEzD,OAAOD;AACT;AAMO,MAAMlB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