@fluentui/react-charts 0.0.0-nightly-20250603-0406.1 → 0.0.0-nightly-20250605-0406.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 (61) hide show
  1. package/CHANGELOG.md +15 -15
  2. package/dist/index.d.ts +1 -1
  3. package/lib/components/CommonComponents/CartesianChart.js +3 -0
  4. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  5. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  6. package/lib/components/CommonComponents/ChartPopover.js +10 -10
  7. package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
  8. package/lib/components/DeclarativeChart/DeclarativeChart.js +7 -2
  9. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  10. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +7 -4
  11. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  12. package/lib/components/DonutChart/Arc/Arc.js +2 -2
  13. package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
  14. package/lib/components/DonutChart/DonutChart.js +2 -2
  15. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  16. package/lib/components/GaugeChart/GaugeChart.js +9 -9
  17. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  18. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +2 -2
  19. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  20. package/lib/components/HeatMapChart/HeatMapChart.js +3 -2
  21. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  22. package/lib/components/HorizontalBarChart/HorizontalBarChart.js +8 -8
  23. package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  24. package/lib/components/VerticalBarChart/VerticalBarChart.js +2 -2
  25. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  26. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +2 -2
  27. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  28. package/lib/utilities/utilities.js +232 -53
  29. package/lib/utilities/utilities.js.map +1 -1
  30. package/lib-commonjs/components/CommonComponents/CartesianChart.js +3 -0
  31. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  32. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  33. package/lib-commonjs/components/CommonComponents/ChartPopover.js +10 -10
  34. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
  35. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +6 -1
  36. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  37. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +6 -3
  38. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  39. package/lib-commonjs/components/DonutChart/Arc/Arc.js +1 -1
  40. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  41. package/lib-commonjs/components/DonutChart/DonutChart.js +2 -2
  42. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  43. package/lib-commonjs/components/GaugeChart/GaugeChart.js +8 -8
  44. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  45. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +1 -1
  46. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  47. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +2 -1
  48. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  49. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +7 -7
  50. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  51. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +1 -1
  52. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  53. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +1 -1
  54. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  55. package/lib-commonjs/utilities/utilities.js +236 -61
  56. package/lib-commonjs/utilities/utilities.js.map +1 -1
  57. package/package.json +13 -13
  58. package/lib/utilities/locale-util.js +0 -15
  59. package/lib/utilities/locale-util.js.map +0 -1
  60. package/lib-commonjs/utilities/locale-util.js +0 -25
  61. package/lib-commonjs/utilities/locale-util.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 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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AUY,YAAY;gBACjF,GAAG+B,WAAW;;QAGrB,+CAA+C;QAC/C,KAAK;QACL,KAAK;QACL,KAAK;YACH,kGAAkG;YAClG,MAAMK,cAActB,yBAAyBC,IAAI,CAAC4C,IAAI,CACpD,CAACC,SAAqBA,OAAOC,IAAI,KAAK,aAAaD,OAAOC,IAAI,KAAK,aAAa,CAAC,CAACD,OAAOE,UAAU;YAErG,OAAOrB,oBAAoBL;QAC7B;gBAC6CtB;YAA3C,MAAM,IAAIJ,MAAM,CAAC,wBAAwB,GAAEI,kCAAAA,yBAAyBC,IAAI,CAAC,EAAE,cAAhCD,sDAAAA,gCAAkC4C,IAAI,CAAC,CAAC;IACvF;AACF,GAAG;AACHxD,iBAAiB6D,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 isYearArray,\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\n // Consider year as categorical variable not numeric continuous variable\n // Also year is not considered a date variable as it is represented as a point\n // in time and brings additional complexity of handling timezone and locale\n // formatting given the current design of the charting library\n const isXYear = isYearArray(xValues);\n\n if ((isXDate || isXNumber) && !isXYear) {\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","isYearArray","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","isXYear","updatedData","dataPoint","exportAsImage","useCallback","opts","current","chartContainer","background","scale","useImperativeHandle","type","some","series","fill","stackgroup","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+C,0BAA0B1B,UAAUY,YAAY;gBAClF,GAAG+B,WAAW;;QAGrB,KAAK;YACH,qBACE,oBAACnD;gBACE,GAAGV,kCAAkC4C,yBAAyB;gBAC9D,GAAGiB,WAAW;gBACfC,aAAa,CAAC;;QAGpB,KAAK;YACH,qBACE,oBAACnD;gBACE,GAAGV,iCAAiC2C,0BAA0B1B,UAAUY,YAAY;gBACpF,GAAG+B,WAAW;;QAGrB,KAAK;YACH,qBACE,oBAACjD;gBACE,GAAGV,gCAAgC0C,0BAA0B1B,UAAUY,YAAY;gBACnF,GAAG+B,WAAW;;QAGrB,KAAK;YACH,qBACE,oBAAC/C;gBACE,GAAGV,8BAA8BwC,0BAA0B1B,UAAUY,YAAY;gBACjF,GAAG+B,WAAW;;QAGrB,+CAA+C;QAC/C,KAAK;QACL,KAAK;QACL,KAAK;YACH,kGAAkG;YAClG,MAAMK,cAActB,yBAAyBC,IAAI,CAAC6C,IAAI,CACpD,CAACC,SAAqBA,OAAOC,IAAI,KAAK,aAAaD,OAAOC,IAAI,KAAK,aAAa,CAAC,CAACD,OAAOE,UAAU;YAErG,OAAOtB,oBAAoBL;QAC7B;gBAC6CtB;YAA3C,MAAM,IAAIJ,MAAM,CAAC,wBAAwB,GAAEI,kCAAAA,yBAAyBC,IAAI,CAAC,EAAE,cAAhCD,sDAAAA,gCAAkC6C,IAAI,CAAC,CAAC;IACvF;AACF,GAAG;AACHzD,iBAAiB8D,WAAW,GAAG"}
@@ -3,7 +3,7 @@ import { bin as d3Bin, extent as d3Extent, sum as d3Sum, min as d3Min, max as d3
3
3
  import { scaleLinear as d3ScaleLinear } from 'd3-scale';
4
4
  import { DataVizPalette, getColorFromToken, getNextColor } from '../../utilities/colors';
5
5
  import { findNumericMinMaxOfY } from '../../utilities/utilities';
6
- import { isArrayOfType, isArrayOrTypedArray, isDate, isDateArray, isNumberArray } from '@fluentui/chart-utilities';
6
+ import { isArrayOfType, isArrayOrTypedArray, isDate, isDateArray, isNumberArray, isYearArray } from '@fluentui/chart-utilities';
7
7
  import { timeParse } from 'd3-time-format';
8
8
  import { curveCardinal as d3CurveCardinal } from 'd3-shape';
9
9
  const dashOptions = {
@@ -177,11 +177,12 @@ export const transformPlotlyJsonToVSBCProps = (input, colorMap, isDarkTheme, fal
177
177
  let secondaryYAxisValues = {};
178
178
  input.data.forEach((series, index1)=>{
179
179
  var _series_x;
180
+ const isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis
180
181
  (_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x.forEach((x, index2)=>{
181
182
  var _series_y;
182
183
  if (!mapXToDataPoints[x]) {
183
184
  mapXToDataPoints[x] = {
184
- xAxisPoint: x,
185
+ xAxisPoint: isXYearCategory ? x.toString() : x,
185
186
  chartData: [],
186
187
  lineData: []
187
188
  };
@@ -379,7 +380,8 @@ export const transformPlotlyJsonToScatterChartProps = (input, isAreaChart, color
379
380
  mode,
380
381
  width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
381
382
  height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
382
- hideTickOverlap: true
383
+ hideTickOverlap: true,
384
+ useUTC: false
383
385
  };
384
386
  } else {
385
387
  var _input_layout2, _input_layout3;
@@ -397,7 +399,8 @@ export const transformPlotlyJsonToScatterChartProps = (input, isAreaChart, color
397
399
  width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
398
400
  height: (_input_layout_height1 = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.height) !== null && _input_layout_height1 !== void 0 ? _input_layout_height1 : 350,
399
401
  hideTickOverlap: true,
400
- enableReflow: false
402
+ enableReflow: false,
403
+ useUTC: false
401
404
  };
402
405
  }
403
406
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["PlotlySchemaAdapter.ts"],"sourcesContent":["/* eslint-disable one-var */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-var */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport {\n bin as d3Bin,\n extent as d3Extent,\n sum as d3Sum,\n min as d3Min,\n max as d3Max,\n range as d3Range,\n Bin,\n} from 'd3-array';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\nimport { DonutChartProps } from '../DonutChart/index';\nimport {\n ChartDataPoint,\n ChartProps,\n HorizontalBarChartWithAxisDataPoint,\n LineChartPoints,\n VerticalStackedChartProps,\n HeatMapChartData,\n HeatMapChartDataPoint,\n GroupedVerticalBarChartData,\n VerticalBarChartDataPoint,\n SankeyChartData,\n LineChartLineOptions,\n} from '../../types/DataPoint';\nimport { SankeyChartProps } from '../SankeyChart/index';\nimport { VerticalStackedBarChartProps } from '../VerticalStackedBarChart/index';\nimport { HorizontalBarChartWithAxisProps } from '../HorizontalBarChartWithAxis/index';\nimport { LineChartProps } from '../LineChart/index';\nimport { AreaChartProps } from '../AreaChart/index';\nimport { HeatMapChartProps } from '../HeatMapChart/index';\nimport { DataVizPalette, getColorFromToken, getNextColor } from '../../utilities/colors';\nimport { GaugeChartProps, GaugeChartSegment } from '../GaugeChart/index';\nimport { GroupedVerticalBarChartProps } from '../GroupedVerticalBarChart/index';\nimport { VerticalBarChartProps } from '../VerticalBarChart/index';\nimport { findNumericMinMaxOfY } from '../../utilities/utilities';\nimport type {\n Datum,\n Layout,\n PlotlySchema,\n PieData,\n PlotData,\n SankeyData,\n ScatterLine,\n TypedArray,\n} from '@fluentui/chart-utilities';\nimport { isArrayOfType, isArrayOrTypedArray, isDate, isDateArray, isNumberArray } from '@fluentui/chart-utilities';\nimport { timeParse } from 'd3-time-format';\nimport { curveCardinal as d3CurveCardinal } from 'd3-shape';\n\ninterface SecondaryYAxisValues {\n secondaryYAxistitle?: string;\n secondaryYScaleOptions?: { yMinValue?: number; yMaxValue?: number };\n}\n\nconst dashOptions = {\n dot: {\n strokeDasharray: '1, 5',\n strokeLinecap: 'round',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n dash: {\n strokeDasharray: '5, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n longdash: {\n strokeDasharray: '10, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n dashdot: {\n strokeDasharray: '5, 5, 1, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n longdashdot: {\n strokeDasharray: '10, 5, 1, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n solid: {\n strokeDasharray: '0',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n} as const;\n\nconst isMonth = (possiblyMonthValue: any): boolean => {\n const parseFullMonth = timeParse('%B');\n const parseShortMonth = timeParse('%b');\n return parseFullMonth(possiblyMonthValue) !== null || parseShortMonth(possiblyMonthValue) !== null;\n};\n\nexport const isMonthArray = (data: Datum[] | Datum[][] | TypedArray): boolean => {\n return isArrayOfType(data, isMonth);\n};\n\nconst getLegend = (series: Partial<PlotData>, index: number): string => {\n return series.name || `Series ${index + 1}`;\n};\n\nfunction getTitles(layout: Partial<Layout> | undefined) {\n const titles = {\n chartTitle: typeof layout?.title === 'string' ? layout.title : layout?.title?.text ?? '',\n xAxisTitle: typeof layout?.xaxis?.title === 'string' ? layout?.xaxis?.title : layout?.xaxis?.title?.text ?? '',\n yAxisTitle: typeof layout?.yaxis?.title === 'string' ? layout?.yaxis?.title : layout?.yaxis?.title?.text ?? '',\n };\n return titles;\n}\n\nexport const correctYearMonth = (xValues: Datum[] | Datum[][] | TypedArray): any[] => {\n const presentYear = new Date().getFullYear();\n if (xValues.length > 0 && Array.isArray(xValues[0])) {\n throw new Error('updateXValues:: 2D array not supported');\n }\n const dates = (xValues as Datum[]).map(possiblyMonthValue => {\n const parsedDate = `${possiblyMonthValue} 01, ${presentYear}`;\n return isDate(parsedDate) ? new Date(parsedDate) : null;\n });\n for (let i = dates.length - 1; i > 0; i--) {\n const currentMonth = dates[i]!.getMonth();\n const previousMonth = dates[i - 1]!.getMonth();\n const currentYear = dates[i]!.getFullYear();\n const previousYear = dates[i - 1]!.getFullYear();\n if (previousMonth >= currentMonth) {\n dates[i - 1]!.setFullYear(dates[i]!.getFullYear() - 1);\n } else if (previousYear > currentYear) {\n dates[i - 1]!.setFullYear(currentYear);\n }\n }\n xValues = (xValues as Datum[]).map((month, index) => {\n return `${month} 01, ${dates[index]!.getFullYear()}`;\n });\n return xValues;\n};\n\nexport const getColor = (\n legendLabel: string,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): string => {\n if (!colorMap.current.has(legendLabel)) {\n const nextColor = getNextColor(colorMap.current.size + 1, 0, isDarkTheme);\n colorMap.current.set(legendLabel, nextColor);\n return nextColor;\n }\n\n return colorMap.current.get(legendLabel) as string;\n};\n\nconst getSecondaryYAxisValues = (series: PlotData, layout: Partial<Layout> | undefined) => {\n const secondaryYAxisValues: SecondaryYAxisValues = {};\n if (layout && layout.yaxis2 && series.yaxis === 'y2') {\n secondaryYAxisValues.secondaryYAxistitle =\n typeof layout.yaxis2.title === 'string'\n ? layout.yaxis2.title\n : typeof layout.yaxis2.title?.text === 'string'\n ? layout.yaxis2.title.text\n : '';\n if (layout.yaxis2.range) {\n secondaryYAxisValues.secondaryYScaleOptions = {\n yMinValue: layout.yaxis2.range[0],\n yMaxValue: layout.yaxis2.range[1],\n };\n } else {\n const yValues = series.y as number[];\n if (yValues) {\n secondaryYAxisValues.secondaryYScaleOptions = {\n yMinValue: Math.min(...yValues),\n yMaxValue: Math.max(...yValues),\n };\n }\n }\n }\n secondaryYAxisValues.secondaryYAxistitle =\n secondaryYAxisValues.secondaryYAxistitle !== '' ? secondaryYAxisValues.secondaryYAxistitle : undefined;\n secondaryYAxisValues.secondaryYScaleOptions =\n secondaryYAxisValues.secondaryYScaleOptions && Object.keys(secondaryYAxisValues.secondaryYScaleOptions).length !== 0\n ? secondaryYAxisValues.secondaryYScaleOptions\n : undefined;\n return secondaryYAxisValues;\n};\n\nexport const transformPlotlyJsonToDonutProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): DonutChartProps => {\n const firstData = input.data[0] as PieData;\n\n const mapLegendToDataPoint: Record<string, ChartDataPoint> = {};\n firstData.labels?.forEach((label: string, index: number) => {\n const color = getColor(label, colorMap, isDarkTheme);\n //ToDo how to handle string data?\n const value = typeof firstData.values?.[index] === 'number' ? (firstData.values[index] as number) : 1;\n\n if (!mapLegendToDataPoint[label]) {\n mapLegendToDataPoint[label] = {\n legend: label,\n data: value,\n color,\n };\n } else {\n mapLegendToDataPoint[label].data! += value;\n }\n });\n\n const width: number = input.layout?.width ?? 440;\n const height: number = input.layout?.height ?? 220;\n const hideLabels: boolean = firstData.textinfo\n ? !['value', 'percent', 'label+percent'].includes(firstData.textinfo)\n : false;\n const donutMarginHorizontal: number = hideLabels ? 0 : 80;\n const donutMarginVertical: number = 40 + (hideLabels ? 0 : 40);\n const innerRadius: number = firstData.hole\n ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2)\n : 0;\n const { chartTitle } = getTitles(input.layout);\n\n return {\n data: {\n chartTitle,\n chartData: Object.values(mapLegendToDataPoint),\n },\n hideLegend: input.layout?.showlegend === false ? true : false,\n width: input.layout?.width,\n height,\n innerRadius,\n hideLabels,\n showLabelsInPercent: firstData.textinfo ? ['percent', 'label+percent'].includes(firstData.textinfo) : true,\n };\n};\n\nexport const transformPlotlyJsonToVSBCProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n fallbackVSBC?: boolean,\n): VerticalStackedBarChartProps => {\n const mapXToDataPoints: { [key: string]: VerticalStackedChartProps } = {};\n let yMaxValue = 0;\n let secondaryYAxisValues: SecondaryYAxisValues = {};\n input.data.forEach((series: PlotData, index1: number) => {\n (series.x as Datum[])?.forEach((x: string | number, index2: number) => {\n if (!mapXToDataPoints[x]) {\n mapXToDataPoints[x] = { xAxisPoint: x, chartData: [], lineData: [] };\n }\n const legend: string = getLegend(series, index1);\n const yVal: number = (series.y?.[index2] as number) ?? 0;\n if (series.type === 'bar') {\n const color = getColor(legend, colorMap, isDarkTheme);\n mapXToDataPoints[x].chartData.push({\n legend,\n data: yVal,\n color,\n });\n } else if (series.type === 'scatter' || !!fallbackVSBC) {\n const color = getColor(legend, colorMap, isDarkTheme);\n const lineOptions = getLineOptions(series.line);\n mapXToDataPoints[x].lineData!.push({\n legend,\n y: yVal,\n color,\n ...(lineOptions ? { lineOptions } : {}),\n });\n }\n\n yMaxValue = Math.max(yMaxValue, yVal);\n });\n secondaryYAxisValues = getSecondaryYAxisValues(series, input.layout);\n });\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: Object.values(mapXToDataPoints),\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n barWidth: 'auto',\n yMaxValue,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n mode: 'plotly',\n secondaryYAxistitle: secondaryYAxisValues.secondaryYAxistitle,\n secondaryYScaleOptions: secondaryYAxisValues.secondaryYScaleOptions,\n hideTickOverlap: true,\n };\n};\n\nexport const transformPlotlyJsonToGVBCProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): GroupedVerticalBarChartProps => {\n const mapXToDataPoints: Record<string, GroupedVerticalBarChartData> = {};\n let secondaryYAxisValues: SecondaryYAxisValues = {};\n input.data.forEach((series: PlotData, index1: number) => {\n (series.x as Datum[])?.forEach((x: string | number, index2: number) => {\n if (!mapXToDataPoints[x]) {\n mapXToDataPoints[x] = { name: x.toString(), series: [] };\n }\n if (series.type === 'bar') {\n const legend: string = getLegend(series, index1);\n const color = getColor(legend, colorMap, isDarkTheme);\n\n mapXToDataPoints[x].series.push({\n key: legend,\n data: (series.y?.[index2] as number) ?? 0,\n xAxisCalloutData: x as string,\n color,\n legend,\n });\n }\n });\n secondaryYAxisValues = getSecondaryYAxisValues(series, input.layout);\n });\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: Object.values(mapXToDataPoints),\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n barWidth: 'auto',\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n mode: 'plotly',\n secondaryYAxistitle: secondaryYAxisValues.secondaryYAxistitle,\n secondaryYScaleOptions: secondaryYAxisValues.secondaryYScaleOptions,\n hideTickOverlap: true,\n };\n};\n\nexport const transformPlotlyJsonToVBCProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): VerticalBarChartProps => {\n const vbcData: VerticalBarChartDataPoint[] = [];\n\n input.data.forEach((series: Partial<PlotData>, seriesIdx: number) => {\n if (!series.x) {\n return;\n }\n\n const isXString = isStringArray(series.x);\n const xBins = createBins(series.x, series.xbins?.start, series.xbins?.end, series.xbins?.size);\n const yBins: number[][] = xBins.map(() => []);\n let total = 0;\n\n series.x.forEach((xVal, index) => {\n const binIdx = findBinIndex(xBins, xVal as string | number | null, isXString);\n if (binIdx !== -1) {\n yBins[binIdx].push((series.y?.[index] as number | null | undefined) ?? 1);\n }\n });\n\n const y = yBins.map(bin => {\n const yVal = calculateHistFunc(series.histfunc, bin);\n total += yVal;\n return yVal;\n });\n\n xBins.forEach((bin, index) => {\n const legend: string = getLegend(series, seriesIdx);\n const color: string = getColor(legend, colorMap, isDarkTheme);\n const yVal = calculateHistNorm(\n series.histnorm,\n y[index],\n total,\n isXString ? bin.length : getBinSize(bin as Bin<number, number>),\n );\n\n vbcData.push({\n x: isXString ? bin.join(', ') : getBinCenter(bin as Bin<number, number>),\n y: yVal,\n legend,\n color,\n ...(isXString\n ? {}\n : { xAxisCalloutData: `[${(bin as Bin<number, number>).x0} - ${(bin as Bin<number, number>).x1})` }),\n });\n });\n });\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: vbcData,\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n mode: 'plotly',\n hideTickOverlap: true,\n };\n};\n\nexport const transformPlotlyJsonToScatterChartProps = (\n input: PlotlySchema,\n isAreaChart: boolean,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): LineChartProps | AreaChartProps => {\n let secondaryYAxisValues: SecondaryYAxisValues = {};\n let mode: string = 'tonexty';\n const chartData: LineChartPoints[] = input.data.map((series: PlotData, index: number) => {\n const xValues = series.x as Datum[];\n const isString = typeof xValues[0] === 'string';\n const isXDate = isDateArray(xValues);\n const isXNumber = isNumberArray(xValues);\n const legend: string = getLegend(series, index);\n const lineColor = getColor(legend, colorMap, isDarkTheme);\n secondaryYAxisValues = getSecondaryYAxisValues(series, input.layout);\n mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';\n const lineOptions = getLineOptions(series.line);\n\n return {\n legend,\n data: xValues.map((x, i: number) => ({\n x: isString ? (isXDate ? new Date(x as string) : isXNumber ? parseFloat(x as string) : x) : x,\n y: series.y[i],\n ...(Array.isArray(series.marker?.size)\n ? { markerSize: series.marker.size[i] }\n : typeof series.marker?.size === 'number'\n ? { markerSize: series.marker.size }\n : {}),\n })),\n color: lineColor,\n ...(lineOptions ? { lineOptions } : {}),\n } as LineChartPoints;\n });\n\n const yMinMaxValues = findNumericMinMaxOfY(chartData);\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n const chartProps: ChartProps = {\n chartTitle,\n lineChartData: chartData,\n };\n\n if (isAreaChart) {\n return {\n data: chartProps,\n supportNegativeData: true,\n xAxisTitle,\n yAxisTitle,\n secondaryYAxistitle: secondaryYAxisValues.secondaryYAxistitle,\n secondaryYScaleOptions: secondaryYAxisValues.secondaryYScaleOptions,\n mode,\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n hideTickOverlap: true,\n } as AreaChartProps;\n } else {\n return {\n data: chartProps,\n supportNegativeData: true,\n xAxisTitle,\n yAxisTitle,\n secondaryYAxistitle: secondaryYAxisValues.secondaryYAxistitle,\n secondaryYScaleOptions: secondaryYAxisValues.secondaryYScaleOptions,\n roundedTicks: true,\n yMinValue: yMinMaxValues.startValue,\n yMaxValue: yMinMaxValues.endValue,\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n hideTickOverlap: true,\n enableReflow: false,\n } as LineChartProps;\n }\n};\n\nexport const transformPlotlyJsonToHorizontalBarWithAxisProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): HorizontalBarChartWithAxisProps => {\n const chartData: HorizontalBarChartWithAxisDataPoint[] = input.data\n .map((series: PlotData, index: number) => {\n return (series.y as Datum[]).map((yValue: string, i: number) => {\n const color = getColor(yValue, colorMap, isDarkTheme);\n return {\n x: series.x[i],\n y: yValue,\n legend: yValue,\n color,\n } as HorizontalBarChartWithAxisDataPoint;\n });\n })\n .flat()\n //reversing the order to invert the Y bars order as required by plotly.\n .reverse();\n\n const chartHeight: number = input.layout?.height ?? 450;\n const margin: number = input.layout?.margin?.l ?? 0;\n const padding: number = input.layout?.margin?.pad ?? 0;\n const availableHeight: number = chartHeight - margin - padding;\n const numberOfBars = (input.data[0] as PlotData).y.length;\n const scalingFactor = 0.01;\n const gapFactor = 1 / (1 + scalingFactor * numberOfBars);\n const barHeight = availableHeight / (numberOfBars * (1 + gapFactor));\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: chartData,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n secondaryYAxistitle:\n typeof input.layout?.yaxis2?.title === 'string'\n ? input.layout?.yaxis2?.title\n : input.layout?.yaxis2?.title?.text || '',\n barHeight,\n showYAxisLables: true,\n height: chartHeight,\n width: input.layout?.width,\n hideTickOverlap: true,\n };\n};\n\nexport const transformPlotlyJsonToHeatmapProps = (input: PlotlySchema): HeatMapChartProps => {\n const firstData = input.data[0] as Partial<PlotData>;\n const heatmapDataPoints: HeatMapChartDataPoint[] = [];\n let zMin = Number.POSITIVE_INFINITY;\n let zMax = Number.NEGATIVE_INFINITY;\n\n if (firstData.type === 'histogram2d') {\n const isXString = isStringArray(firstData.x);\n const isYString = isStringArray(firstData.y);\n const xBins = createBins(firstData.x, firstData.xbins?.start, firstData.xbins?.end, firstData.xbins?.size);\n const yBins = createBins(firstData.y, firstData.ybins?.start, firstData.ybins?.end, firstData.ybins?.size);\n const zBins: number[][][] = yBins.map(() => xBins.map(() => []));\n let total = 0;\n\n firstData.x?.forEach((xVal, index) => {\n const xBinIdx = findBinIndex(xBins, xVal as string | number | null, isXString);\n const yBinIdx = findBinIndex(yBins, firstData.y?.[index] as string | number | null | undefined, isYString);\n\n if (xBinIdx !== -1 && yBinIdx !== -1) {\n zBins[yBinIdx][xBinIdx].push((firstData.z?.[index] as number | null | undefined) ?? 1);\n }\n });\n\n const z = zBins.map(row => {\n return row.map(bin => {\n const zVal = calculateHistFunc(firstData.histfunc, bin);\n total += zVal;\n return zVal;\n });\n });\n\n xBins.forEach((xBin, xIdx) => {\n yBins.forEach((yBin, yIdx) => {\n const zVal = calculateHistNorm(\n firstData.histnorm,\n z[yIdx][xIdx],\n total,\n isXString ? xBin.length : getBinSize(xBin as Bin<number, number>),\n isYString ? yBin.length : getBinSize(yBin as Bin<number, number>),\n );\n\n heatmapDataPoints.push({\n x: isXString ? xBin.join(', ') : getBinCenter(xBin as Bin<number, number>),\n y: isYString ? yBin.join(', ') : getBinCenter(yBin as Bin<number, number>),\n value: zVal,\n rectText: zVal,\n });\n\n if (typeof zVal === 'number') {\n zMin = Math.min(zMin, zVal);\n zMax = Math.max(zMax, zVal);\n }\n });\n });\n } else {\n (firstData.x as Datum[])?.forEach((xVal, xIdx: number) => {\n firstData.y?.forEach((yVal: any, yIdx: number) => {\n const zVal = (firstData.z as number[][])?.[yIdx]?.[xIdx];\n\n heatmapDataPoints.push({\n x: input.layout?.xaxis?.type === 'date' ? (xVal as Date) : xVal ?? 0,\n y: input.layout?.yaxis?.type === 'date' ? (yVal as Date) : yVal,\n value: zVal,\n rectText: zVal,\n });\n\n if (typeof zVal === 'number') {\n zMin = Math.min(zMin, zVal);\n zMax = Math.max(zMax, zVal);\n }\n });\n });\n }\n\n const heatmapData: HeatMapChartData = {\n legend: firstData.name ?? '',\n data: heatmapDataPoints,\n value: 0,\n };\n\n // Initialize domain and range to default values\n const defaultDomain = [zMin, (zMax + zMin) / 2, zMax];\n const defaultRange = [\n getColorFromToken(DataVizPalette.color1),\n getColorFromToken(DataVizPalette.color2),\n getColorFromToken(DataVizPalette.color3),\n ];\n const domainValuesForColorScale: number[] = Array.isArray(firstData.colorscale)\n ? (firstData.colorscale as Array<[number, string]>).map(arr => arr[0] * (zMax - zMin) + zMin)\n : defaultDomain;\n\n const rangeValuesForColorScale: string[] = Array.isArray(firstData.colorscale)\n ? (firstData.colorscale as Array<[number, string]>).map(arr => arr[1])\n : defaultRange;\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: [heatmapData],\n domainValuesForColorScale,\n rangeValuesForColorScale,\n hideLegend: true,\n showYAxisLables: true,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n sortOrder: 'none',\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n hideTickOverlap: true,\n };\n};\n\nexport const transformPlotlyJsonToSankeyProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): SankeyChartProps => {\n const { link, node } = input.data[0] as SankeyData;\n const validLinks = (link?.value ?? [])\n .map((val: number, index: number) => ({\n value: val,\n source: link?.source![index],\n target: link?.target![index],\n }))\n // eslint-disable-next-line @typescript-eslint/no-shadow\n // Filter out negative nodes, unequal nodes and self-references (circular links)\n .filter(x => x.source >= 0 && x.target >= 0 && x.source !== x.target);\n\n const sankeyChartData = {\n nodes: node.label?.map((label: string, index: number) => {\n const color = getColor(label, colorMap, isDarkTheme);\n\n return {\n nodeId: index,\n name: label,\n color,\n };\n }),\n links: validLinks.map((validLink: any, index: number) => {\n return {\n ...validLink,\n };\n }),\n } as SankeyChartData;\n\n // const styles: SankeyChartProps['styles'] = {\n // root: {\n // ...(input.layout?.font?.size ? { fontSize: input.layout.font?.size } : {}),\n // },\n // };\n\n const { chartTitle } = getTitles(input.layout);\n\n return {\n data: {\n chartTitle,\n SankeyChartData: sankeyChartData,\n },\n width: input.layout?.width,\n height: input.layout?.height ?? 468,\n // TODO\n // styles,\n enableReflow: true,\n };\n};\n\nexport const transformPlotlyJsonToGaugeProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): GaugeChartProps => {\n const firstData = input.data[0] as PlotData;\n\n const segments = firstData.gauge?.steps?.length\n ? firstData.gauge.steps.map((step: any, index: number): GaugeChartSegment => {\n const legend = step.name || `Segment ${index + 1}`;\n const color = getColor(legend, colorMap, isDarkTheme);\n return {\n legend,\n size: step.range?.[1] - step.range?.[0],\n color,\n };\n })\n : [\n {\n legend: 'Current',\n size: firstData.value ?? 0 - (firstData.gauge?.axis?.range?.[0] ?? 0),\n color: getColor('Current', colorMap, isDarkTheme),\n },\n {\n legend: 'Target',\n size: (firstData.gauge?.axis?.range?.[1] ?? 100) - (firstData.value ?? 0),\n color: DataVizPalette.disabled,\n },\n ];\n\n let sublabel: string | undefined;\n // let sublabelColor: string | undefined;\n if (firstData.delta?.reference) {\n const diff = firstData.value - firstData.delta.reference;\n if (diff >= 0) {\n sublabel = `\\u25B2 ${diff}`;\n // const color = getColorFromToken(DataVizPalette.success, isDarkTheme);\n // sublabelColor = color;\n } else {\n sublabel = `\\u25BC ${Math.abs(diff)}`;\n // const color = getColorFromToken(DataVizPalette.error, isDarkTheme);\n // sublabelColor = color;\n }\n }\n\n // const styles: GaugeChartProps['styles'] = {\n // sublabel: {\n // fill: sublabelColor,\n // },\n // };\n\n const { chartTitle } = getTitles(input.layout);\n\n return {\n segments,\n chartValue: firstData.value ?? 0,\n chartTitle,\n sublabel,\n // range values can be null\n minValue: typeof firstData.gauge?.axis?.range?.[0] === 'number' ? firstData.gauge?.axis?.range?.[0] : undefined,\n maxValue: typeof firstData.gauge?.axis?.range?.[1] === 'number' ? firstData.gauge?.axis?.range?.[1] : undefined,\n chartValueFormat: () => firstData.value?.toString() ?? '',\n // FIXME\n // width: input.layout?.width,\n // height: input.layout?.height ?? 220,\n // TODO\n // styles,\n variant: firstData.gauge?.steps?.length ? 'multiple-segments' : 'single-segment',\n };\n};\n\nfunction isPlainObject(obj: any) {\n return (\n Object.prototype.toString.call(obj) === '[object Object]' &&\n Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty')\n );\n}\n\nvar arrayAttributes: any[] = [];\nvar stack: any[] = [];\nvar isArrayStack: any[] = [];\nvar baseContainer: any, baseAttrName: any;\n/**\n * Interate iteratively through the trace object and find all the array attributes.\n * 1 trace record = 1 series of data\n * @param trace\n */\nexport function findArrayAttributes(trace: any) {\n // Init basecontainer and baseAttrName\n crawlIntoTrace(baseContainer, 0, '');\n}\n\nfunction crawlIntoTrace(container: any, i: number, astrPartial: any) {\n var item = container[stack[i]];\n var newAstrPartial = astrPartial + stack[i];\n if (i === stack.length - 1) {\n if (isArrayOrTypedArray(item)) {\n arrayAttributes.push(baseAttrName + newAstrPartial);\n }\n } else {\n if (isArrayStack[i]) {\n if (Array.isArray(item)) {\n for (var j = 0; j < item.length; j++) {\n if (isPlainObject(item[j])) {\n crawlIntoTrace(item[j], i + 1, newAstrPartial + '[' + j + '].');\n }\n }\n }\n } else if (isPlainObject(item)) {\n crawlIntoTrace(item, i + 1, newAstrPartial + '.');\n }\n }\n}\n\nfunction getLineOptions(line: Partial<ScatterLine> | undefined): LineChartLineOptions | undefined {\n if (!line) {\n return;\n }\n\n let lineOptions: LineChartLineOptions = {};\n if (line.dash) {\n lineOptions = { ...lineOptions, ...dashOptions[line.dash] };\n }\n\n switch (line.shape) {\n case 'spline':\n const smoothing = typeof line.smoothing === 'number' ? line.smoothing : 1;\n lineOptions.curve = d3CurveCardinal.tension(1 - smoothing / 1.3);\n break;\n case 'hv':\n lineOptions.curve = 'stepAfter';\n break;\n case 'vh':\n lineOptions.curve = 'stepBefore';\n break;\n case 'hvh':\n lineOptions.curve = 'step';\n break;\n default:\n lineOptions.curve = 'linear';\n }\n\n return Object.keys(lineOptions).length > 0 ? lineOptions : undefined;\n}\n\nconst isStringArray = (arr: any) => {\n return isArrayOfType(arr, (value: any) => typeof value === 'string');\n};\n\n// TODO: Use binary search to find the appropriate bin for numeric value.\nconst findBinIndex = (\n bins: string[][] | Bin<number, number>[],\n value: string | number | null | undefined,\n isString: boolean,\n) => {\n if (typeof value === 'undefined' || value === null) {\n return -1;\n }\n\n return isString\n ? (bins as string[][]).findIndex(bin => bin.includes(value as string))\n : (bins as Bin<number, number>[]).findIndex(bin => (value as number) >= bin.x0! && (value as number) < bin.x1!);\n};\n\nconst getBinSize = (bin: Bin<number, number>) => {\n return bin.x1! - bin.x0!;\n};\n\nconst getBinCenter = (bin: Bin<number, number>) => {\n return (bin.x1! + bin.x0!) / 2;\n};\n\n// TODO: Add support for date axes\nconst createBins = (\n data: TypedArray | Datum[] | Datum[][] | undefined,\n binStart?: number | string,\n binEnd?: number | string,\n binSize?: number | string,\n) => {\n if (!data || data.length === 0) {\n return [];\n }\n\n if (isStringArray(data)) {\n const categories = Array.from(new Set(data as string[]));\n const start = typeof binStart === 'number' ? Math.ceil(binStart) : 0;\n const stop = typeof binEnd === 'number' ? Math.floor(binEnd) + 1 : categories.length;\n const step = typeof binSize === 'number' ? binSize : 1;\n\n return d3Range(start, stop, step).map(i => categories.slice(i, i + step));\n }\n\n const scale = d3ScaleLinear()\n .domain(d3Extent<number>(data as number[]) as [number, number])\n .nice();\n let [minVal, maxVal] = scale.domain();\n\n minVal = typeof binStart === 'number' ? binStart : minVal;\n maxVal = typeof binEnd === 'number' ? binEnd : maxVal;\n\n const binGenerator = d3Bin().domain([minVal, maxVal]);\n\n if (typeof binSize === 'number') {\n const thresholds: number[] = [];\n let th = minVal;\n const tolerance = 1 / Math.pow(10, binSize.toString().split('.')[1]?.length ?? 0);\n\n while (maxVal + binSize - th > tolerance) {\n thresholds.push(th);\n th += binSize;\n }\n\n minVal = thresholds[0];\n maxVal = thresholds[thresholds.length - 1];\n binGenerator.domain([minVal, maxVal]).thresholds(thresholds);\n }\n\n // NOTE: The last bin generated by d3Bin often has identical x0 and x1 values (both inclusive) and\n // can be ignored if the highest value is already included in the previous bin.\n return binGenerator(data as number[]);\n};\n\nconst calculateHistFunc = (histfunc: PlotData['histfunc'] | undefined, bin: number[]) => {\n switch (histfunc) {\n case 'sum':\n return d3Sum(bin);\n case 'avg':\n return bin.length === 0 ? 0 : d3Sum(bin) / bin.length;\n case 'min':\n return d3Min(bin) ?? 0;\n case 'max':\n return d3Max(bin) ?? 0;\n default:\n return bin.length;\n }\n};\n\nconst calculateHistNorm = (\n histnorm: PlotData['histnorm'] | undefined,\n value: number,\n total: number,\n dx: number,\n dy: number = 1,\n) => {\n switch (histnorm) {\n case 'percent':\n return total === 0 ? 0 : (value / total) * 100;\n case 'probability':\n return total === 0 ? 0 : value / total;\n case 'density':\n return dx * dy === 0 ? 0 : value / (dx * dy);\n case 'probability density':\n return total * dx * dy === 0 ? 0 : value / (total * dx * dy);\n default:\n return value;\n }\n};\n"],"names":["React","bin","d3Bin","extent","d3Extent","sum","d3Sum","min","d3Min","max","d3Max","range","d3Range","scaleLinear","d3ScaleLinear","DataVizPalette","getColorFromToken","getNextColor","findNumericMinMaxOfY","isArrayOfType","isArrayOrTypedArray","isDate","isDateArray","isNumberArray","timeParse","curveCardinal","d3CurveCardinal","dashOptions","dot","strokeDasharray","strokeLinecap","strokeWidth","lineBorderWidth","dash","longdash","dashdot","longdashdot","solid","isMonth","possiblyMonthValue","parseFullMonth","parseShortMonth","isMonthArray","data","getLegend","series","index","name","getTitles","layout","titles","chartTitle","title","text","xAxisTitle","xaxis","yAxisTitle","yaxis","correctYearMonth","xValues","presentYear","Date","getFullYear","length","Array","isArray","Error","dates","map","parsedDate","i","currentMonth","getMonth","previousMonth","currentYear","previousYear","setFullYear","month","getColor","legendLabel","colorMap","isDarkTheme","current","has","nextColor","size","set","get","getSecondaryYAxisValues","secondaryYAxisValues","yaxis2","secondaryYAxistitle","secondaryYScaleOptions","yMinValue","yMaxValue","yValues","y","Math","undefined","Object","keys","transformPlotlyJsonToDonutProps","input","firstData","mapLegendToDataPoint","labels","forEach","label","color","value","values","legend","width","height","hideLabels","textinfo","includes","donutMarginHorizontal","donutMarginVertical","innerRadius","hole","chartData","hideLegend","showlegend","showLabelsInPercent","transformPlotlyJsonToVSBCProps","fallbackVSBC","mapXToDataPoints","index1","x","index2","xAxisPoint","lineData","yVal","type","push","lineOptions","getLineOptions","line","barWidth","mode","hideTickOverlap","transformPlotlyJsonToGVBCProps","toString","key","xAxisCalloutData","transformPlotlyJsonToVBCProps","vbcData","seriesIdx","isXString","isStringArray","xBins","createBins","xbins","start","end","yBins","total","xVal","binIdx","findBinIndex","calculateHistFunc","histfunc","calculateHistNorm","histnorm","getBinSize","join","getBinCenter","x0","x1","transformPlotlyJsonToScatterChartProps","isAreaChart","isString","isXDate","isXNumber","lineColor","fill","parseFloat","marker","markerSize","yMinMaxValues","chartProps","lineChartData","supportNegativeData","roundedTicks","startValue","endValue","enableReflow","transformPlotlyJsonToHorizontalBarWithAxisProps","yValue","flat","reverse","chartHeight","margin","l","padding","pad","availableHeight","numberOfBars","scalingFactor","gapFactor","barHeight","showYAxisLables","transformPlotlyJsonToHeatmapProps","heatmapDataPoints","zMin","Number","POSITIVE_INFINITY","zMax","NEGATIVE_INFINITY","isYString","ybins","zBins","xBinIdx","yBinIdx","z","row","zVal","xBin","xIdx","yBin","yIdx","rectText","heatmapData","defaultDomain","defaultRange","color1","color2","color3","domainValuesForColorScale","colorscale","arr","rangeValuesForColorScale","sortOrder","transformPlotlyJsonToSankeyProps","node","link","validLinks","val","source","target","filter","sankeyChartData","nodes","nodeId","links","validLink","SankeyChartData","transformPlotlyJsonToGaugeProps","segments","gauge","steps","step","axis","disabled","sublabel","delta","reference","diff","abs","chartValue","minValue","maxValue","chartValueFormat","variant","isPlainObject","obj","prototype","call","getPrototypeOf","hasOwnProperty","arrayAttributes","stack","isArrayStack","baseContainer","baseAttrName","findArrayAttributes","trace","crawlIntoTrace","container","astrPartial","item","newAstrPartial","j","shape","smoothing","curve","tension","bins","findIndex","binStart","binEnd","binSize","categories","from","Set","ceil","stop","floor","slice","scale","domain","nice","minVal","maxVal","binGenerator","thresholds","th","tolerance","pow","split","dx","dy"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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yBAAkCrO,MAAM,cAAxCqO,6CAAAA,kCAA4C;QAE/E,MAAOY,SAASZ,UAAUe,KAAKC,UAAW;YACxCF,WAAW3K,IAAI,CAAC4K;YAChBA,MAAMf;QACR;QAEAW,SAASG,UAAU,CAAC,EAAE;QACtBF,SAASE,UAAU,CAACA,WAAWnP,MAAM,GAAG,EAAE;QAC1CkP,aAAaJ,MAAM,CAAC;YAACE;YAAQC;SAAO,EAAEE,UAAU,CAACA;IACnD;IAEA,kGAAkG;IAClG,+EAA+E;IAC/E,OAAOD,aAAatQ;AACtB;AAEA,MAAMsH,oBAAoB,CAACC,UAA4CjK;IACrE,OAAQiK;QACN,KAAK;YACH,OAAO5J,MAAML;QACf,KAAK;YACH,OAAOA,IAAI8D,MAAM,KAAK,IAAI,IAAIzD,MAAML,OAAOA,IAAI8D,MAAM;QACvD,KAAK;gBACIvD;YAAP,OAAOA,CAAAA,SAAAA,MAAMP,kBAANO,oBAAAA,SAAc;QACvB,KAAK;gBACIE;YAAP,OAAOA,CAAAA,SAAAA,MAAMT,kBAANS,oBAAAA,SAAc;QACvB;YACE,OAAOT,IAAI8D,MAAM;IACrB;AACF;AAEA,MAAMoG,oBAAoB,CACxBC,UACAvD,OACAgD,OACA0J,IACAC,KAAa,CAAC;IAEd,OAAQpJ;QACN,KAAK;YACH,OAAOP,UAAU,IAAI,IAAI,AAAChD,QAAQgD,QAAS;QAC7C,KAAK;YACH,OAAOA,UAAU,IAAI,IAAIhD,QAAQgD;QACnC,KAAK;YACH,OAAO0J,KAAKC,OAAO,IAAI,IAAI3M,QAAS0M,CAAAA,KAAKC,EAAC;QAC5C,KAAK;YACH,OAAO3J,QAAQ0J,KAAKC,OAAO,IAAI,IAAI3M,QAASgD,CAAAA,QAAQ0J,KAAKC,EAAC;QAC5D;YACE,OAAO3M;IACX;AACF"}
1
+ {"version":3,"sources":["PlotlySchemaAdapter.ts"],"sourcesContent":["/* eslint-disable one-var */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-var */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport {\n bin as d3Bin,\n extent as d3Extent,\n sum as d3Sum,\n min as d3Min,\n max as d3Max,\n range as d3Range,\n Bin,\n} from 'd3-array';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\nimport { DonutChartProps } from '../DonutChart/index';\nimport {\n ChartDataPoint,\n ChartProps,\n HorizontalBarChartWithAxisDataPoint,\n LineChartPoints,\n VerticalStackedChartProps,\n HeatMapChartData,\n HeatMapChartDataPoint,\n GroupedVerticalBarChartData,\n VerticalBarChartDataPoint,\n SankeyChartData,\n LineChartLineOptions,\n} from '../../types/DataPoint';\nimport { SankeyChartProps } from '../SankeyChart/index';\nimport { VerticalStackedBarChartProps } from '../VerticalStackedBarChart/index';\nimport { HorizontalBarChartWithAxisProps } from '../HorizontalBarChartWithAxis/index';\nimport { LineChartProps } from '../LineChart/index';\nimport { AreaChartProps } from '../AreaChart/index';\nimport { HeatMapChartProps } from '../HeatMapChart/index';\nimport { DataVizPalette, getColorFromToken, getNextColor } from '../../utilities/colors';\nimport { GaugeChartProps, GaugeChartSegment } from '../GaugeChart/index';\nimport { GroupedVerticalBarChartProps } from '../GroupedVerticalBarChart/index';\nimport { VerticalBarChartProps } from '../VerticalBarChart/index';\nimport { findNumericMinMaxOfY } from '../../utilities/utilities';\nimport type {\n Datum,\n Layout,\n PlotlySchema,\n PieData,\n PlotData,\n SankeyData,\n ScatterLine,\n TypedArray,\n} from '@fluentui/chart-utilities';\nimport {\n isArrayOfType,\n isArrayOrTypedArray,\n isDate,\n isDateArray,\n isNumberArray,\n isYearArray,\n} from '@fluentui/chart-utilities';\nimport { timeParse } from 'd3-time-format';\nimport { curveCardinal as d3CurveCardinal } from 'd3-shape';\n\ninterface SecondaryYAxisValues {\n secondaryYAxistitle?: string;\n secondaryYScaleOptions?: { yMinValue?: number; yMaxValue?: number };\n}\n\nconst dashOptions = {\n dot: {\n strokeDasharray: '1, 5',\n strokeLinecap: 'round',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n dash: {\n strokeDasharray: '5, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n longdash: {\n strokeDasharray: '10, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n dashdot: {\n strokeDasharray: '5, 5, 1, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n longdashdot: {\n strokeDasharray: '10, 5, 1, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n solid: {\n strokeDasharray: '0',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n} as const;\n\nconst isMonth = (possiblyMonthValue: any): boolean => {\n const parseFullMonth = timeParse('%B');\n const parseShortMonth = timeParse('%b');\n return parseFullMonth(possiblyMonthValue) !== null || parseShortMonth(possiblyMonthValue) !== null;\n};\n\nexport const isMonthArray = (data: Datum[] | Datum[][] | TypedArray): boolean => {\n return isArrayOfType(data, isMonth);\n};\n\nconst getLegend = (series: Partial<PlotData>, index: number): string => {\n return series.name || `Series ${index + 1}`;\n};\n\nfunction getTitles(layout: Partial<Layout> | undefined) {\n const titles = {\n chartTitle: typeof layout?.title === 'string' ? layout.title : layout?.title?.text ?? '',\n xAxisTitle: typeof layout?.xaxis?.title === 'string' ? layout?.xaxis?.title : layout?.xaxis?.title?.text ?? '',\n yAxisTitle: typeof layout?.yaxis?.title === 'string' ? layout?.yaxis?.title : layout?.yaxis?.title?.text ?? '',\n };\n return titles;\n}\n\nexport const correctYearMonth = (xValues: Datum[] | Datum[][] | TypedArray): any[] => {\n const presentYear = new Date().getFullYear();\n if (xValues.length > 0 && Array.isArray(xValues[0])) {\n throw new Error('updateXValues:: 2D array not supported');\n }\n const dates = (xValues as Datum[]).map(possiblyMonthValue => {\n const parsedDate = `${possiblyMonthValue} 01, ${presentYear}`;\n return isDate(parsedDate) ? new Date(parsedDate) : null;\n });\n for (let i = dates.length - 1; i > 0; i--) {\n const currentMonth = dates[i]!.getMonth();\n const previousMonth = dates[i - 1]!.getMonth();\n const currentYear = dates[i]!.getFullYear();\n const previousYear = dates[i - 1]!.getFullYear();\n if (previousMonth >= currentMonth) {\n dates[i - 1]!.setFullYear(dates[i]!.getFullYear() - 1);\n } else if (previousYear > currentYear) {\n dates[i - 1]!.setFullYear(currentYear);\n }\n }\n xValues = (xValues as Datum[]).map((month, index) => {\n return `${month} 01, ${dates[index]!.getFullYear()}`;\n });\n return xValues;\n};\n\nexport const getColor = (\n legendLabel: string,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): string => {\n if (!colorMap.current.has(legendLabel)) {\n const nextColor = getNextColor(colorMap.current.size + 1, 0, isDarkTheme);\n colorMap.current.set(legendLabel, nextColor);\n return nextColor;\n }\n\n return colorMap.current.get(legendLabel) as string;\n};\n\nconst getSecondaryYAxisValues = (series: PlotData, layout: Partial<Layout> | undefined) => {\n const secondaryYAxisValues: SecondaryYAxisValues = {};\n if (layout && layout.yaxis2 && series.yaxis === 'y2') {\n secondaryYAxisValues.secondaryYAxistitle =\n typeof layout.yaxis2.title === 'string'\n ? layout.yaxis2.title\n : typeof layout.yaxis2.title?.text === 'string'\n ? layout.yaxis2.title.text\n : '';\n if (layout.yaxis2.range) {\n secondaryYAxisValues.secondaryYScaleOptions = {\n yMinValue: layout.yaxis2.range[0],\n yMaxValue: layout.yaxis2.range[1],\n };\n } else {\n const yValues = series.y as number[];\n if (yValues) {\n secondaryYAxisValues.secondaryYScaleOptions = {\n yMinValue: Math.min(...yValues),\n yMaxValue: Math.max(...yValues),\n };\n }\n }\n }\n secondaryYAxisValues.secondaryYAxistitle =\n secondaryYAxisValues.secondaryYAxistitle !== '' ? secondaryYAxisValues.secondaryYAxistitle : undefined;\n secondaryYAxisValues.secondaryYScaleOptions =\n secondaryYAxisValues.secondaryYScaleOptions && Object.keys(secondaryYAxisValues.secondaryYScaleOptions).length !== 0\n ? secondaryYAxisValues.secondaryYScaleOptions\n : undefined;\n return secondaryYAxisValues;\n};\n\nexport const transformPlotlyJsonToDonutProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): DonutChartProps => {\n const firstData = input.data[0] as PieData;\n\n const mapLegendToDataPoint: Record<string, ChartDataPoint> = {};\n firstData.labels?.forEach((label: string, index: number) => {\n const color = getColor(label, colorMap, isDarkTheme);\n //ToDo how to handle string data?\n const value = typeof firstData.values?.[index] === 'number' ? (firstData.values[index] as number) : 1;\n\n if (!mapLegendToDataPoint[label]) {\n mapLegendToDataPoint[label] = {\n legend: label,\n data: value,\n color,\n };\n } else {\n mapLegendToDataPoint[label].data! += value;\n }\n });\n\n const width: number = input.layout?.width ?? 440;\n const height: number = input.layout?.height ?? 220;\n const hideLabels: boolean = firstData.textinfo\n ? !['value', 'percent', 'label+percent'].includes(firstData.textinfo)\n : false;\n const donutMarginHorizontal: number = hideLabels ? 0 : 80;\n const donutMarginVertical: number = 40 + (hideLabels ? 0 : 40);\n const innerRadius: number = firstData.hole\n ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2)\n : 0;\n const { chartTitle } = getTitles(input.layout);\n\n return {\n data: {\n chartTitle,\n chartData: Object.values(mapLegendToDataPoint),\n },\n hideLegend: input.layout?.showlegend === false ? true : false,\n width: input.layout?.width,\n height,\n innerRadius,\n hideLabels,\n showLabelsInPercent: firstData.textinfo ? ['percent', 'label+percent'].includes(firstData.textinfo) : true,\n };\n};\n\nexport const transformPlotlyJsonToVSBCProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n fallbackVSBC?: boolean,\n): VerticalStackedBarChartProps => {\n const mapXToDataPoints: { [key: string]: VerticalStackedChartProps } = {};\n let yMaxValue = 0;\n let secondaryYAxisValues: SecondaryYAxisValues = {};\n input.data.forEach((series: PlotData, index1: number) => {\n const isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis\n (series.x as Datum[])?.forEach((x: string | number, index2: number) => {\n if (!mapXToDataPoints[x]) {\n mapXToDataPoints[x] = { xAxisPoint: isXYearCategory ? x.toString() : x, chartData: [], lineData: [] };\n }\n const legend: string = getLegend(series, index1);\n const yVal: number = (series.y?.[index2] as number) ?? 0;\n if (series.type === 'bar') {\n const color = getColor(legend, colorMap, isDarkTheme);\n mapXToDataPoints[x].chartData.push({\n legend,\n data: yVal,\n color,\n });\n } else if (series.type === 'scatter' || !!fallbackVSBC) {\n const color = getColor(legend, colorMap, isDarkTheme);\n const lineOptions = getLineOptions(series.line);\n mapXToDataPoints[x].lineData!.push({\n legend,\n y: yVal,\n color,\n ...(lineOptions ? { lineOptions } : {}),\n });\n }\n\n yMaxValue = Math.max(yMaxValue, yVal);\n });\n secondaryYAxisValues = getSecondaryYAxisValues(series, input.layout);\n });\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: Object.values(mapXToDataPoints),\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n barWidth: 'auto',\n yMaxValue,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n mode: 'plotly',\n secondaryYAxistitle: secondaryYAxisValues.secondaryYAxistitle,\n secondaryYScaleOptions: secondaryYAxisValues.secondaryYScaleOptions,\n hideTickOverlap: true,\n };\n};\n\nexport const transformPlotlyJsonToGVBCProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): GroupedVerticalBarChartProps => {\n const mapXToDataPoints: Record<string, GroupedVerticalBarChartData> = {};\n let secondaryYAxisValues: SecondaryYAxisValues = {};\n input.data.forEach((series: PlotData, index1: number) => {\n (series.x as Datum[])?.forEach((x: string | number, index2: number) => {\n if (!mapXToDataPoints[x]) {\n mapXToDataPoints[x] = { name: x.toString(), series: [] };\n }\n if (series.type === 'bar') {\n const legend: string = getLegend(series, index1);\n const color = getColor(legend, colorMap, isDarkTheme);\n\n mapXToDataPoints[x].series.push({\n key: legend,\n data: (series.y?.[index2] as number) ?? 0,\n xAxisCalloutData: x as string,\n color,\n legend,\n });\n }\n });\n secondaryYAxisValues = getSecondaryYAxisValues(series, input.layout);\n });\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: Object.values(mapXToDataPoints),\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n barWidth: 'auto',\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n mode: 'plotly',\n secondaryYAxistitle: secondaryYAxisValues.secondaryYAxistitle,\n secondaryYScaleOptions: secondaryYAxisValues.secondaryYScaleOptions,\n hideTickOverlap: true,\n };\n};\n\nexport const transformPlotlyJsonToVBCProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): VerticalBarChartProps => {\n const vbcData: VerticalBarChartDataPoint[] = [];\n\n input.data.forEach((series: Partial<PlotData>, seriesIdx: number) => {\n if (!series.x) {\n return;\n }\n\n const isXString = isStringArray(series.x);\n const xBins = createBins(series.x, series.xbins?.start, series.xbins?.end, series.xbins?.size);\n const yBins: number[][] = xBins.map(() => []);\n let total = 0;\n\n series.x.forEach((xVal, index) => {\n const binIdx = findBinIndex(xBins, xVal as string | number | null, isXString);\n if (binIdx !== -1) {\n yBins[binIdx].push((series.y?.[index] as number | null | undefined) ?? 1);\n }\n });\n\n const y = yBins.map(bin => {\n const yVal = calculateHistFunc(series.histfunc, bin);\n total += yVal;\n return yVal;\n });\n\n xBins.forEach((bin, index) => {\n const legend: string = getLegend(series, seriesIdx);\n const color: string = getColor(legend, colorMap, isDarkTheme);\n const yVal = calculateHistNorm(\n series.histnorm,\n y[index],\n total,\n isXString ? bin.length : getBinSize(bin as Bin<number, number>),\n );\n\n vbcData.push({\n x: isXString ? bin.join(', ') : getBinCenter(bin as Bin<number, number>),\n y: yVal,\n legend,\n color,\n ...(isXString\n ? {}\n : { xAxisCalloutData: `[${(bin as Bin<number, number>).x0} - ${(bin as Bin<number, number>).x1})` }),\n });\n });\n });\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: vbcData,\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n mode: 'plotly',\n hideTickOverlap: true,\n };\n};\n\nexport const transformPlotlyJsonToScatterChartProps = (\n input: PlotlySchema,\n isAreaChart: boolean,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): LineChartProps | AreaChartProps => {\n let secondaryYAxisValues: SecondaryYAxisValues = {};\n let mode: string = 'tonexty';\n const chartData: LineChartPoints[] = input.data.map((series: PlotData, index: number) => {\n const xValues = series.x as Datum[];\n const isString = typeof xValues[0] === 'string';\n const isXDate = isDateArray(xValues);\n const isXNumber = isNumberArray(xValues);\n const legend: string = getLegend(series, index);\n const lineColor = getColor(legend, colorMap, isDarkTheme);\n secondaryYAxisValues = getSecondaryYAxisValues(series, input.layout);\n mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';\n const lineOptions = getLineOptions(series.line);\n\n return {\n legend,\n data: xValues.map((x, i: number) => ({\n x: isString ? (isXDate ? new Date(x as string) : isXNumber ? parseFloat(x as string) : x) : x,\n y: series.y[i],\n ...(Array.isArray(series.marker?.size)\n ? { markerSize: series.marker.size[i] }\n : typeof series.marker?.size === 'number'\n ? { markerSize: series.marker.size }\n : {}),\n })),\n color: lineColor,\n ...(lineOptions ? { lineOptions } : {}),\n } as LineChartPoints;\n });\n\n const yMinMaxValues = findNumericMinMaxOfY(chartData);\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n const chartProps: ChartProps = {\n chartTitle,\n lineChartData: chartData,\n };\n\n if (isAreaChart) {\n return {\n data: chartProps,\n supportNegativeData: true,\n xAxisTitle,\n yAxisTitle,\n secondaryYAxistitle: secondaryYAxisValues.secondaryYAxistitle,\n secondaryYScaleOptions: secondaryYAxisValues.secondaryYScaleOptions,\n mode,\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n hideTickOverlap: true,\n useUTC: false,\n } as AreaChartProps;\n } else {\n return {\n data: chartProps,\n supportNegativeData: true,\n xAxisTitle,\n yAxisTitle,\n secondaryYAxistitle: secondaryYAxisValues.secondaryYAxistitle,\n secondaryYScaleOptions: secondaryYAxisValues.secondaryYScaleOptions,\n roundedTicks: true,\n yMinValue: yMinMaxValues.startValue,\n yMaxValue: yMinMaxValues.endValue,\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n hideTickOverlap: true,\n enableReflow: false,\n useUTC: false,\n } as LineChartProps;\n }\n};\n\nexport const transformPlotlyJsonToHorizontalBarWithAxisProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): HorizontalBarChartWithAxisProps => {\n const chartData: HorizontalBarChartWithAxisDataPoint[] = input.data\n .map((series: PlotData, index: number) => {\n return (series.y as Datum[]).map((yValue: string, i: number) => {\n const color = getColor(yValue, colorMap, isDarkTheme);\n return {\n x: series.x[i],\n y: yValue,\n legend: yValue,\n color,\n } as HorizontalBarChartWithAxisDataPoint;\n });\n })\n .flat()\n //reversing the order to invert the Y bars order as required by plotly.\n .reverse();\n\n const chartHeight: number = input.layout?.height ?? 450;\n const margin: number = input.layout?.margin?.l ?? 0;\n const padding: number = input.layout?.margin?.pad ?? 0;\n const availableHeight: number = chartHeight - margin - padding;\n const numberOfBars = (input.data[0] as PlotData).y.length;\n const scalingFactor = 0.01;\n const gapFactor = 1 / (1 + scalingFactor * numberOfBars);\n const barHeight = availableHeight / (numberOfBars * (1 + gapFactor));\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: chartData,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n secondaryYAxistitle:\n typeof input.layout?.yaxis2?.title === 'string'\n ? input.layout?.yaxis2?.title\n : input.layout?.yaxis2?.title?.text || '',\n barHeight,\n showYAxisLables: true,\n height: chartHeight,\n width: input.layout?.width,\n hideTickOverlap: true,\n };\n};\n\nexport const transformPlotlyJsonToHeatmapProps = (input: PlotlySchema): HeatMapChartProps => {\n const firstData = input.data[0] as Partial<PlotData>;\n const heatmapDataPoints: HeatMapChartDataPoint[] = [];\n let zMin = Number.POSITIVE_INFINITY;\n let zMax = Number.NEGATIVE_INFINITY;\n\n if (firstData.type === 'histogram2d') {\n const isXString = isStringArray(firstData.x);\n const isYString = isStringArray(firstData.y);\n const xBins = createBins(firstData.x, firstData.xbins?.start, firstData.xbins?.end, firstData.xbins?.size);\n const yBins = createBins(firstData.y, firstData.ybins?.start, firstData.ybins?.end, firstData.ybins?.size);\n const zBins: number[][][] = yBins.map(() => xBins.map(() => []));\n let total = 0;\n\n firstData.x?.forEach((xVal, index) => {\n const xBinIdx = findBinIndex(xBins, xVal as string | number | null, isXString);\n const yBinIdx = findBinIndex(yBins, firstData.y?.[index] as string | number | null | undefined, isYString);\n\n if (xBinIdx !== -1 && yBinIdx !== -1) {\n zBins[yBinIdx][xBinIdx].push((firstData.z?.[index] as number | null | undefined) ?? 1);\n }\n });\n\n const z = zBins.map(row => {\n return row.map(bin => {\n const zVal = calculateHistFunc(firstData.histfunc, bin);\n total += zVal;\n return zVal;\n });\n });\n\n xBins.forEach((xBin, xIdx) => {\n yBins.forEach((yBin, yIdx) => {\n const zVal = calculateHistNorm(\n firstData.histnorm,\n z[yIdx][xIdx],\n total,\n isXString ? xBin.length : getBinSize(xBin as Bin<number, number>),\n isYString ? yBin.length : getBinSize(yBin as Bin<number, number>),\n );\n\n heatmapDataPoints.push({\n x: isXString ? xBin.join(', ') : getBinCenter(xBin as Bin<number, number>),\n y: isYString ? yBin.join(', ') : getBinCenter(yBin as Bin<number, number>),\n value: zVal,\n rectText: zVal,\n });\n\n if (typeof zVal === 'number') {\n zMin = Math.min(zMin, zVal);\n zMax = Math.max(zMax, zVal);\n }\n });\n });\n } else {\n (firstData.x as Datum[])?.forEach((xVal, xIdx: number) => {\n firstData.y?.forEach((yVal: any, yIdx: number) => {\n const zVal = (firstData.z as number[][])?.[yIdx]?.[xIdx];\n\n heatmapDataPoints.push({\n x: input.layout?.xaxis?.type === 'date' ? (xVal as Date) : xVal ?? 0,\n y: input.layout?.yaxis?.type === 'date' ? (yVal as Date) : yVal,\n value: zVal,\n rectText: zVal,\n });\n\n if (typeof zVal === 'number') {\n zMin = Math.min(zMin, zVal);\n zMax = Math.max(zMax, zVal);\n }\n });\n });\n }\n\n const heatmapData: HeatMapChartData = {\n legend: firstData.name ?? '',\n data: heatmapDataPoints,\n value: 0,\n };\n\n // Initialize domain and range to default values\n const defaultDomain = [zMin, (zMax + zMin) / 2, zMax];\n const defaultRange = [\n getColorFromToken(DataVizPalette.color1),\n getColorFromToken(DataVizPalette.color2),\n getColorFromToken(DataVizPalette.color3),\n ];\n const domainValuesForColorScale: number[] = Array.isArray(firstData.colorscale)\n ? (firstData.colorscale as Array<[number, string]>).map(arr => arr[0] * (zMax - zMin) + zMin)\n : defaultDomain;\n\n const rangeValuesForColorScale: string[] = Array.isArray(firstData.colorscale)\n ? (firstData.colorscale as Array<[number, string]>).map(arr => arr[1])\n : defaultRange;\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: [heatmapData],\n domainValuesForColorScale,\n rangeValuesForColorScale,\n hideLegend: true,\n showYAxisLables: true,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n sortOrder: 'none',\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n hideTickOverlap: true,\n };\n};\n\nexport const transformPlotlyJsonToSankeyProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): SankeyChartProps => {\n const { link, node } = input.data[0] as SankeyData;\n const validLinks = (link?.value ?? [])\n .map((val: number, index: number) => ({\n value: val,\n source: link?.source![index],\n target: link?.target![index],\n }))\n // eslint-disable-next-line @typescript-eslint/no-shadow\n // Filter out negative nodes, unequal nodes and self-references (circular links)\n .filter(x => x.source >= 0 && x.target >= 0 && x.source !== x.target);\n\n const sankeyChartData = {\n nodes: node.label?.map((label: string, index: number) => {\n const color = getColor(label, colorMap, isDarkTheme);\n\n return {\n nodeId: index,\n name: label,\n color,\n };\n }),\n links: validLinks.map((validLink: any, index: number) => {\n return {\n ...validLink,\n };\n }),\n } as SankeyChartData;\n\n // const styles: SankeyChartProps['styles'] = {\n // root: {\n // ...(input.layout?.font?.size ? { fontSize: input.layout.font?.size } : {}),\n // },\n // };\n\n const { chartTitle } = getTitles(input.layout);\n\n return {\n data: {\n chartTitle,\n SankeyChartData: sankeyChartData,\n },\n width: input.layout?.width,\n height: input.layout?.height ?? 468,\n // TODO\n // styles,\n enableReflow: true,\n };\n};\n\nexport const transformPlotlyJsonToGaugeProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): GaugeChartProps => {\n const firstData = input.data[0] as PlotData;\n\n const segments = firstData.gauge?.steps?.length\n ? firstData.gauge.steps.map((step: any, index: number): GaugeChartSegment => {\n const legend = step.name || `Segment ${index + 1}`;\n const color = getColor(legend, colorMap, isDarkTheme);\n return {\n legend,\n size: step.range?.[1] - step.range?.[0],\n color,\n };\n })\n : [\n {\n legend: 'Current',\n size: firstData.value ?? 0 - (firstData.gauge?.axis?.range?.[0] ?? 0),\n color: getColor('Current', colorMap, isDarkTheme),\n },\n {\n legend: 'Target',\n size: (firstData.gauge?.axis?.range?.[1] ?? 100) - (firstData.value ?? 0),\n color: DataVizPalette.disabled,\n },\n ];\n\n let sublabel: string | undefined;\n // let sublabelColor: string | undefined;\n if (firstData.delta?.reference) {\n const diff = firstData.value - firstData.delta.reference;\n if (diff >= 0) {\n sublabel = `\\u25B2 ${diff}`;\n // const color = getColorFromToken(DataVizPalette.success, isDarkTheme);\n // sublabelColor = color;\n } else {\n sublabel = `\\u25BC ${Math.abs(diff)}`;\n // const color = getColorFromToken(DataVizPalette.error, isDarkTheme);\n // sublabelColor = color;\n }\n }\n\n // const styles: GaugeChartProps['styles'] = {\n // sublabel: {\n // fill: sublabelColor,\n // },\n // };\n\n const { chartTitle } = getTitles(input.layout);\n\n return {\n segments,\n chartValue: firstData.value ?? 0,\n chartTitle,\n sublabel,\n // range values can be null\n minValue: typeof firstData.gauge?.axis?.range?.[0] === 'number' ? firstData.gauge?.axis?.range?.[0] : undefined,\n maxValue: typeof firstData.gauge?.axis?.range?.[1] === 'number' ? firstData.gauge?.axis?.range?.[1] : undefined,\n chartValueFormat: () => firstData.value?.toString() ?? '',\n // FIXME\n // width: input.layout?.width,\n // height: input.layout?.height ?? 220,\n // TODO\n // styles,\n variant: firstData.gauge?.steps?.length ? 'multiple-segments' : 'single-segment',\n };\n};\n\nfunction isPlainObject(obj: any) {\n return (\n Object.prototype.toString.call(obj) === '[object Object]' &&\n Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty')\n );\n}\n\nvar arrayAttributes: any[] = [];\nvar stack: any[] = [];\nvar isArrayStack: any[] = [];\nvar baseContainer: any, baseAttrName: any;\n/**\n * Interate iteratively through the trace object and find all the array attributes.\n * 1 trace record = 1 series of data\n * @param trace\n */\nexport function findArrayAttributes(trace: any) {\n // Init basecontainer and baseAttrName\n crawlIntoTrace(baseContainer, 0, '');\n}\n\nfunction crawlIntoTrace(container: any, i: number, astrPartial: any) {\n var item = container[stack[i]];\n var newAstrPartial = astrPartial + stack[i];\n if (i === stack.length - 1) {\n if (isArrayOrTypedArray(item)) {\n arrayAttributes.push(baseAttrName + newAstrPartial);\n }\n } else {\n if (isArrayStack[i]) {\n if (Array.isArray(item)) {\n for (var j = 0; j < item.length; j++) {\n if (isPlainObject(item[j])) {\n crawlIntoTrace(item[j], i + 1, newAstrPartial + '[' + j + '].');\n }\n }\n }\n } else if (isPlainObject(item)) {\n crawlIntoTrace(item, i + 1, newAstrPartial + '.');\n }\n }\n}\n\nfunction getLineOptions(line: Partial<ScatterLine> | undefined): LineChartLineOptions | undefined {\n if (!line) {\n return;\n }\n\n let lineOptions: LineChartLineOptions = {};\n if (line.dash) {\n lineOptions = { ...lineOptions, ...dashOptions[line.dash] };\n }\n\n switch (line.shape) {\n case 'spline':\n const smoothing = typeof line.smoothing === 'number' ? line.smoothing : 1;\n lineOptions.curve = d3CurveCardinal.tension(1 - smoothing / 1.3);\n break;\n case 'hv':\n lineOptions.curve = 'stepAfter';\n break;\n case 'vh':\n lineOptions.curve = 'stepBefore';\n break;\n case 'hvh':\n lineOptions.curve = 'step';\n break;\n default:\n lineOptions.curve = 'linear';\n }\n\n return Object.keys(lineOptions).length > 0 ? lineOptions : undefined;\n}\n\nconst isStringArray = (arr: any) => {\n return isArrayOfType(arr, (value: any) => typeof value === 'string');\n};\n\n// TODO: Use binary search to find the appropriate bin for numeric value.\nconst findBinIndex = (\n bins: string[][] | Bin<number, number>[],\n value: string | number | null | undefined,\n isString: boolean,\n) => {\n if (typeof value === 'undefined' || value === null) {\n return -1;\n }\n\n return isString\n ? (bins as string[][]).findIndex(bin => bin.includes(value as string))\n : (bins as Bin<number, number>[]).findIndex(bin => (value as number) >= bin.x0! && (value as number) < bin.x1!);\n};\n\nconst getBinSize = (bin: Bin<number, number>) => {\n return bin.x1! - bin.x0!;\n};\n\nconst getBinCenter = (bin: Bin<number, number>) => {\n return (bin.x1! + bin.x0!) / 2;\n};\n\n// TODO: Add support for date axes\nconst createBins = (\n data: TypedArray | Datum[] | Datum[][] | undefined,\n binStart?: number | string,\n binEnd?: number | string,\n binSize?: number | string,\n) => {\n if (!data || data.length === 0) {\n return [];\n }\n\n if (isStringArray(data)) {\n const categories = Array.from(new Set(data as string[]));\n const start = typeof binStart === 'number' ? Math.ceil(binStart) : 0;\n const stop = typeof binEnd === 'number' ? Math.floor(binEnd) + 1 : categories.length;\n const step = typeof binSize === 'number' ? binSize : 1;\n\n return d3Range(start, stop, step).map(i => categories.slice(i, i + step));\n }\n\n const scale = d3ScaleLinear()\n .domain(d3Extent<number>(data as number[]) as [number, number])\n .nice();\n let [minVal, maxVal] = scale.domain();\n\n minVal = typeof binStart === 'number' ? binStart : minVal;\n maxVal = typeof binEnd === 'number' ? binEnd : maxVal;\n\n const binGenerator = d3Bin().domain([minVal, maxVal]);\n\n if (typeof binSize === 'number') {\n const thresholds: number[] = [];\n let th = minVal;\n const tolerance = 1 / Math.pow(10, binSize.toString().split('.')[1]?.length ?? 0);\n\n while (maxVal + binSize - th > tolerance) {\n thresholds.push(th);\n th += binSize;\n }\n\n minVal = thresholds[0];\n maxVal = thresholds[thresholds.length - 1];\n binGenerator.domain([minVal, maxVal]).thresholds(thresholds);\n }\n\n // NOTE: The last bin generated by d3Bin often has identical x0 and x1 values (both inclusive) and\n // can be ignored if the highest value is already included in the previous bin.\n return binGenerator(data as number[]);\n};\n\nconst calculateHistFunc = (histfunc: PlotData['histfunc'] | undefined, bin: number[]) => {\n switch (histfunc) {\n case 'sum':\n return d3Sum(bin);\n case 'avg':\n return bin.length === 0 ? 0 : d3Sum(bin) / bin.length;\n case 'min':\n return d3Min(bin) ?? 0;\n case 'max':\n return d3Max(bin) ?? 0;\n default:\n return bin.length;\n }\n};\n\nconst calculateHistNorm = (\n histnorm: PlotData['histnorm'] | undefined,\n value: number,\n total: number,\n dx: number,\n dy: number = 1,\n) => {\n switch (histnorm) {\n case 'percent':\n return total === 0 ? 0 : (value / total) * 100;\n case 'probability':\n return total === 0 ? 0 : value / total;\n case 'density':\n return dx * dy === 0 ? 0 : value / (dx * dy);\n case 'probability density':\n return total * dx * dy === 0 ? 0 : value / (total * dx * dy);\n default:\n return value;\n }\n};\n"],"names":["React","bin","d3Bin","extent","d3Extent","sum","d3Sum","min","d3Min","max","d3Max","range","d3Range","scaleLinear","d3ScaleLinear","DataVizPalette","getColorFromToken","getNextColor","findNumericMinMaxOfY","isArrayOfType","isArrayOrTypedArray","isDate","isDateArray","isNumberArray","isYearArray","timeParse","curveCardinal","d3CurveCardinal","dashOptions","dot","strokeDasharray","strokeLinecap","strokeWidth","lineBorderWidth","dash","longdash","dashdot","longdashdot","solid","isMonth","possiblyMonthValue","parseFullMonth","parseShortMonth","isMonthArray","data","getLegend","series","index","name","getTitles","layout","titles","chartTitle","title","text","xAxisTitle","xaxis","yAxisTitle","yaxis","correctYearMonth","xValues","presentYear","Date","getFullYear","length","Array","isArray","Error","dates","map","parsedDate","i","currentMonth","getMonth","previousMonth","currentYear","previousYear","setFullYear","month","getColor","legendLabel","colorMap","isDarkTheme","current","has","nextColor","size","set","get","getSecondaryYAxisValues","secondaryYAxisValues","yaxis2","secondaryYAxistitle","secondaryYScaleOptions","yMinValue","yMaxValue","yValues","y","Math","undefined","Object","keys","transformPlotlyJsonToDonutProps","input","firstData","mapLegendToDataPoint","labels","forEach","label","color","value","values","legend","width","height","hideLabels","textinfo","includes","donutMarginHorizontal","donutMarginVertical","innerRadius","hole","chartData","hideLegend","showlegend","showLabelsInPercent","transformPlotlyJsonToVSBCProps","fallbackVSBC","mapXToDataPoints","index1","isXYearCategory","x","index2","xAxisPoint","toString","lineData","yVal","type","push","lineOptions","getLineOptions","line","barWidth","mode","hideTickOverlap","transformPlotlyJsonToGVBCProps","key","xAxisCalloutData","transformPlotlyJsonToVBCProps","vbcData","seriesIdx","isXString","isStringArray","xBins","createBins","xbins","start","end","yBins","total","xVal","binIdx","findBinIndex","calculateHistFunc","histfunc","calculateHistNorm","histnorm","getBinSize","join","getBinCenter","x0","x1","transformPlotlyJsonToScatterChartProps","isAreaChart","isString","isXDate","isXNumber","lineColor","fill","parseFloat","marker","markerSize","yMinMaxValues","chartProps","lineChartData","supportNegativeData","useUTC","roundedTicks","startValue","endValue","enableReflow","transformPlotlyJsonToHorizontalBarWithAxisProps","yValue","flat","reverse","chartHeight","margin","l","padding","pad","availableHeight","numberOfBars","scalingFactor","gapFactor","barHeight","showYAxisLables","transformPlotlyJsonToHeatmapProps","heatmapDataPoints","zMin","Number","POSITIVE_INFINITY","zMax","NEGATIVE_INFINITY","isYString","ybins","zBins","xBinIdx","yBinIdx","z","row","zVal","xBin","xIdx","yBin","yIdx","rectText","heatmapData","defaultDomain","defaultRange","color1","color2","color3","domainValuesForColorScale","colorscale","arr","rangeValuesForColorScale","sortOrder","transformPlotlyJsonToSankeyProps","node","link","validLinks","val","source","target","filter","sankeyChartData","nodes","nodeId","links","validLink","SankeyChartData","transformPlotlyJsonToGaugeProps","segments","gauge","steps","step","axis","disabled","sublabel","delta","reference","diff","abs","chartValue","minValue","maxValue","chartValueFormat","variant","isPlainObject","obj","prototype","call","getPrototypeOf","hasOwnProperty","arrayAttributes","stack","isArrayStack","baseContainer","baseAttrName","findArrayAttributes","trace","crawlIntoTrace","container","astrPartial","item","newAstrPartial","j","shape","smoothing","curve","tension","bins","findIndex","binStart","binEnd","binSize","categories","from","Set","ceil","stop","floor","slice","scale","domain","nice","minVal","maxVal","binGenerator","thresholds","th","tolerance","pow","split","dx","dy"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAK;YACH,OAAO5J,QAAQ2J,KAAKC,OAAO,IAAI,IAAI7M,QAASiD,CAAAA,QAAQ2J,KAAKC,EAAC;QAC5D;YACE,OAAO7M;IACX;AACF"}
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { arc as d3Arc } from 'd3-shape';
3
3
  import { useArcStyles } from './useArcStyles.styles';
4
4
  import { format as d3Format } from 'd3-format';
5
- import { formatValueWithSIPrefix, useRtl } from '../../../utilities/index';
5
+ import { formatScientificLimitWidth, useRtl } from '../../../utilities/index';
6
6
  // Create a Arc within Donut Chart variant which uses these default styles and this styled subcomponent.
7
7
  /**
8
8
  * Arc component within Donut Chart.
@@ -59,7 +59,7 @@ import { formatValueWithSIPrefix, useRtl } from '../../../utilities/index';
59
59
  dominantBaseline: angle > Math.PI / 2 && angle < 3 * Math.PI / 2 ? 'hanging' : 'auto',
60
60
  className: className,
61
61
  "aria-hidden": true
62
- }, showLabelsInPercent ? d3Format('.0%')(totalValue === 0 ? 0 : arcValue / totalValue) : formatValueWithSIPrefix(arcValue));
62
+ }, showLabelsInPercent ? d3Format('.0%')(totalValue === 0 ? 0 : arcValue / totalValue) : formatScientificLimitWidth(arcValue));
63
63
  }
64
64
  function _updateChart(newProps) {
65
65
  if (newProps.arc && newProps.innerRadius && newProps.outerRadius) {
@@ -1 +1 @@
1
- {"version":3,"sources":["Arc.tsx"],"sourcesContent":["import * as React from 'react';\nimport { arc as d3Arc } from 'd3-shape';\nimport { useArcStyles } from './useArcStyles.styles';\nimport { ChartDataPoint } from '../index';\nimport { ArcProps } from './index';\nimport { format as d3Format } from 'd3-format';\nimport { formatValueWithSIPrefix, useRtl } from '../../../utilities/index';\n\n// Create a Arc within Donut Chart variant which uses these default styles and this styled subcomponent.\n/**\n * Arc component within Donut Chart.\n * {@docCategory ArcDonutChart}\n */\nexport const Arc: React.FunctionComponent<ArcProps> = React.forwardRef<HTMLDivElement, ArcProps>(\n (props, forwardedRef) => {\n const arc = d3Arc();\n const currentRef = React.createRef<SVGPathElement>();\n const _isRTL: boolean = useRtl();\n const classes = useArcStyles(props);\n\n React.useEffect(() => {\n _updateChart(props);\n }, [props]);\n\n function _onFocus(data: ChartDataPoint, id: string): void {\n props.onFocusCallback!(data, id, currentRef.current);\n }\n\n function _hoverOn(data: ChartDataPoint, mouseEvent: React.MouseEvent<SVGPathElement>): void {\n mouseEvent.persist();\n props.hoverOnCallback!(data, mouseEvent);\n }\n\n function _hoverOff(): void {\n props.hoverLeaveCallback!();\n }\n\n function _onBlur(): void {\n props.onBlurCallback!();\n }\n\n function _getAriaLabel(): string {\n const point = props.data!.data;\n const legend = point.xAxisCalloutData || point.legend;\n const yValue = point.yAxisCalloutData || point.data || 0;\n return point.callOutAccessibilityData?.ariaLabel || (legend ? `${legend}, ` : '') + `${yValue}.`;\n }\n\n function _renderArcLabel(className: string) {\n const { data, innerRadius, outerRadius, showLabelsInPercent, totalValue, hideLabels, activeArc } = props;\n\n if (\n hideLabels ||\n Math.abs(data!.endAngle - data!.startAngle) < Math.PI / 12 ||\n (activeArc !== data!.data.legend && activeArc !== '')\n ) {\n return null;\n }\n\n const [base, perp] = arc.centroid({ ...data!, innerRadius, outerRadius });\n const hyp = Math.sqrt(base * base + perp * perp);\n const labelRadius = Math.max(innerRadius!, outerRadius!) + 2;\n const angle = (data!.startAngle + data!.endAngle) / 2;\n const arcValue = data!.value;\n\n return (\n <text\n x={(hyp === 0 ? 0 : base / hyp) * labelRadius}\n y={(hyp === 0 ? 0 : perp / hyp) * labelRadius}\n textAnchor={angle > Math.PI !== _isRTL ? 'end' : 'start'}\n dominantBaseline={angle > Math.PI / 2 && angle < (3 * Math.PI) / 2 ? 'hanging' : 'auto'}\n className={className}\n aria-hidden={true}\n >\n {showLabelsInPercent\n ? d3Format('.0%')(totalValue! === 0 ? 0 : arcValue / totalValue!)\n : formatValueWithSIPrefix(arcValue)}\n </text>\n );\n }\n\n function _updateChart(newProps: ArcProps): void {\n if (newProps.arc && newProps.innerRadius && newProps.outerRadius) {\n newProps.arc.innerRadius(newProps.innerRadius);\n newProps.arc.outerRadius(newProps.outerRadius);\n }\n }\n\n const { href, focusedArcId } = props;\n //TO DO 'replace' is throwing error\n const id =\n props.uniqText! +\n (typeof props.data!.data.legend === 'string' ? props.data!.data.legend.replace(/\\s+/g, '') : '') +\n props.data!.data.data;\n const opacity: number = props.activeArc === props.data!.data.legend || props.activeArc === '' ? 1 : 0.1;\n return (\n <g ref={currentRef}>\n {!!focusedArcId && focusedArcId === id && (\n // TODO innerradius and outerradius were absent\n <path\n id={id + 'focusRing'}\n d={arc({ ...props.focusData!, innerRadius: props.innerRadius, outerRadius: props.outerRadius })!}\n className={classes.focusRing}\n />\n )}\n <path\n // TODO innerradius and outerradius were absent\n id={id}\n d={arc({ ...props.data!, innerRadius: props.innerRadius, outerRadius: props.outerRadius })!}\n className={classes.root}\n style={{ fill: props.color, cursor: href ? 'pointer' : 'default' }}\n onFocus={_onFocus.bind(this, props.data!.data, id)}\n data-is-focusable={props.activeArc === props.data!.data.legend || props.activeArc === ''}\n onMouseOver={_hoverOn.bind(this, props.data!.data)}\n onMouseMove={_hoverOn.bind(this, props.data!.data)}\n onMouseLeave={_hoverOff}\n onBlur={_onBlur}\n opacity={opacity}\n onClick={props.data?.data.onClick}\n aria-label={_getAriaLabel()}\n role=\"img\"\n />\n {_renderArcLabel(classes.arcLabel)}\n </g>\n );\n },\n);\nArc.displayName = 'Arc';\n"],"names":["React","arc","d3Arc","useArcStyles","format","d3Format","formatValueWithSIPrefix","useRtl","Arc","forwardRef","props","forwardedRef","currentRef","createRef","_isRTL","classes","useEffect","_updateChart","_onFocus","data","id","onFocusCallback","current","_hoverOn","mouseEvent","persist","hoverOnCallback","_hoverOff","hoverLeaveCallback","_onBlur","onBlurCallback","_getAriaLabel","point","legend","xAxisCalloutData","yValue","yAxisCalloutData","callOutAccessibilityData","ariaLabel","_renderArcLabel","className","innerRadius","outerRadius","showLabelsInPercent","totalValue","hideLabels","activeArc","Math","abs","endAngle","startAngle","PI","base","perp","centroid","hyp","sqrt","labelRadius","max","angle","arcValue","value","text","x","y","textAnchor","dominantBaseline","aria-hidden","newProps","href","focusedArcId","uniqText","replace","opacity","g","ref","path","d","focusData","focusRing","root","style","fill","color","cursor","onFocus","bind","data-is-focusable","onMouseOver","onMouseMove","onMouseLeave","onBlur","onClick","aria-label","role","arcLabel","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,OAAOC,KAAK,QAAQ,WAAW;AACxC,SAASC,YAAY,QAAQ,wBAAwB;AAGrD,SAASC,UAAUC,QAAQ,QAAQ,YAAY;AAC/C,SAASC,uBAAuB,EAAEC,MAAM,QAAQ,2BAA2B;AAE3E,wGAAwG;AACxG;;;CAGC,GACD,OAAO,MAAMC,oBAAyCR,MAAMS,UAAU,CACpE,CAACC,OAAOC;QAwGSD;IAvGf,MAAMT,MAAMC;IACZ,MAAMU,2BAAaZ,MAAMa,SAAS;IAClC,MAAMC,SAAkBP;IACxB,MAAMQ,UAAUZ,aAAaO;IAE7BV,MAAMgB,SAAS,CAAC;QACdC,aAAaP;IACf,GAAG;QAACA;KAAM;IAEV,SAASQ,SAASC,IAAoB,EAAEC,EAAU;QAChDV,MAAMW,eAAe,CAAEF,MAAMC,IAAIR,WAAWU,OAAO;IACrD;IAEA,SAASC,SAASJ,IAAoB,EAAEK,UAA4C;QAClFA,WAAWC,OAAO;QAClBf,MAAMgB,eAAe,CAAEP,MAAMK;IAC/B;IAEA,SAASG;QACPjB,MAAMkB,kBAAkB;IAC1B;IAEA,SAASC;QACPnB,MAAMoB,cAAc;IACtB;IAEA,SAASC;YAIAC;QAHP,MAAMA,QAAQtB,MAAMS,IAAI,CAAEA,IAAI;QAC9B,MAAMc,SAASD,MAAME,gBAA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AahC,MAAMgC,WAAW;QAAC;QACxFF,WAAWzB,QAAQiE,IAAI;QACvBC,OAAO;YAAEC,MAAMxE,MAAMyE,KAAK;YAAEC,QAAQf,OAAO,YAAY;QAAU;QACjEgB,SAASnE,SAASoE,IAAI,CAAC,IAAI,EAAE5E,MAAMS,IAAI,CAAEA,IAAI,EAAEC;QAC/CmE,qBAAmB7E,MAAMoC,SAAS,KAAKpC,MAAMS,IAAI,CAAEA,IAAI,CAACc,MAAM,IAAIvB,MAAMoC,SAAS,KAAK;QACtF0C,aAAajE,SAAS+D,IAAI,CAAC,IAAI,EAAE5E,MAAMS,IAAI,CAAEA,IAAI;QACjDsE,aAAalE,SAAS+D,IAAI,CAAC,IAAI,EAAE5E,MAAMS,IAAI,CAAEA,IAAI;QACjDuE,cAAc/D;QACdgE,QAAQ9D;QACR4C,SAASA;QACTmB,OAAO,GAAElF,cAAAA,MAAMS,IAAI,cAAVT,kCAAAA,YAAYS,IAAI,CAACyE,OAAO;QACjCC,cAAY9D;QACZ+D,MAAK;QAENvD,gBAAgBxB,QAAQgF,QAAQ;AAGvC,GACA;AACFvF,IAAIwF,WAAW,GAAG"}
1
+ {"version":3,"sources":["Arc.tsx"],"sourcesContent":["import * as React from 'react';\nimport { arc as d3Arc } from 'd3-shape';\nimport { useArcStyles } from './useArcStyles.styles';\nimport { ChartDataPoint } from '../index';\nimport { ArcProps } from './index';\nimport { format as d3Format } from 'd3-format';\nimport { formatScientificLimitWidth, useRtl } from '../../../utilities/index';\n\n// Create a Arc within Donut Chart variant which uses these default styles and this styled subcomponent.\n/**\n * Arc component within Donut Chart.\n * {@docCategory ArcDonutChart}\n */\nexport const Arc: React.FunctionComponent<ArcProps> = React.forwardRef<HTMLDivElement, ArcProps>(\n (props, forwardedRef) => {\n const arc = d3Arc();\n const currentRef = React.createRef<SVGPathElement>();\n const _isRTL: boolean = useRtl();\n const classes = useArcStyles(props);\n\n React.useEffect(() => {\n _updateChart(props);\n }, [props]);\n\n function _onFocus(data: ChartDataPoint, id: string): void {\n props.onFocusCallback!(data, id, currentRef.current);\n }\n\n function _hoverOn(data: ChartDataPoint, mouseEvent: React.MouseEvent<SVGPathElement>): void {\n mouseEvent.persist();\n props.hoverOnCallback!(data, mouseEvent);\n }\n\n function _hoverOff(): void {\n props.hoverLeaveCallback!();\n }\n\n function _onBlur(): void {\n props.onBlurCallback!();\n }\n\n function _getAriaLabel(): string {\n const point = props.data!.data;\n const legend = point.xAxisCalloutData || point.legend;\n const yValue = point.yAxisCalloutData || point.data || 0;\n return point.callOutAccessibilityData?.ariaLabel || (legend ? `${legend}, ` : '') + `${yValue}.`;\n }\n\n function _renderArcLabel(className: string) {\n const { data, innerRadius, outerRadius, showLabelsInPercent, totalValue, hideLabels, activeArc } = props;\n\n if (\n hideLabels ||\n Math.abs(data!.endAngle - data!.startAngle) < Math.PI / 12 ||\n (activeArc !== data!.data.legend && activeArc !== '')\n ) {\n return null;\n }\n\n const [base, perp] = arc.centroid({ ...data!, innerRadius, outerRadius });\n const hyp = Math.sqrt(base * base + perp * perp);\n const labelRadius = Math.max(innerRadius!, outerRadius!) + 2;\n const angle = (data!.startAngle + data!.endAngle) / 2;\n const arcValue = data!.value;\n\n return (\n <text\n x={(hyp === 0 ? 0 : base / hyp) * labelRadius}\n y={(hyp === 0 ? 0 : perp / hyp) * labelRadius}\n textAnchor={angle > Math.PI !== _isRTL ? 'end' : 'start'}\n dominantBaseline={angle > Math.PI / 2 && angle < (3 * Math.PI) / 2 ? 'hanging' : 'auto'}\n className={className}\n aria-hidden={true}\n >\n {showLabelsInPercent\n ? d3Format('.0%')(totalValue! === 0 ? 0 : arcValue / totalValue!)\n : formatScientificLimitWidth(arcValue)}\n </text>\n );\n }\n\n function _updateChart(newProps: ArcProps): void {\n if (newProps.arc && newProps.innerRadius && newProps.outerRadius) {\n newProps.arc.innerRadius(newProps.innerRadius);\n newProps.arc.outerRadius(newProps.outerRadius);\n }\n }\n\n const { href, focusedArcId } = props;\n //TO DO 'replace' is throwing error\n const id =\n props.uniqText! +\n (typeof props.data!.data.legend === 'string' ? props.data!.data.legend.replace(/\\s+/g, '') : '') +\n props.data!.data.data;\n const opacity: number = props.activeArc === props.data!.data.legend || props.activeArc === '' ? 1 : 0.1;\n return (\n <g ref={currentRef}>\n {!!focusedArcId && focusedArcId === id && (\n // TODO innerradius and outerradius were absent\n <path\n id={id + 'focusRing'}\n d={arc({ ...props.focusData!, innerRadius: props.innerRadius, outerRadius: props.outerRadius })!}\n className={classes.focusRing}\n />\n )}\n <path\n // TODO innerradius and outerradius were absent\n id={id}\n d={arc({ ...props.data!, innerRadius: props.innerRadius, outerRadius: props.outerRadius })!}\n className={classes.root}\n style={{ fill: props.color, cursor: href ? 'pointer' : 'default' }}\n onFocus={_onFocus.bind(this, props.data!.data, id)}\n data-is-focusable={props.activeArc === props.data!.data.legend || props.activeArc === ''}\n onMouseOver={_hoverOn.bind(this, props.data!.data)}\n onMouseMove={_hoverOn.bind(this, props.data!.data)}\n onMouseLeave={_hoverOff}\n onBlur={_onBlur}\n opacity={opacity}\n onClick={props.data?.data.onClick}\n aria-label={_getAriaLabel()}\n role=\"img\"\n />\n {_renderArcLabel(classes.arcLabel)}\n </g>\n );\n },\n);\nArc.displayName = 'Arc';\n"],"names":["React","arc","d3Arc","useArcStyles","format","d3Format","formatScientificLimitWidth","useRtl","Arc","forwardRef","props","forwardedRef","currentRef","createRef","_isRTL","classes","useEffect","_updateChart","_onFocus","data","id","onFocusCallback","current","_hoverOn","mouseEvent","persist","hoverOnCallback","_hoverOff","hoverLeaveCallback","_onBlur","onBlurCallback","_getAriaLabel","point","legend","xAxisCalloutData","yValue","yAxisCalloutData","callOutAccessibilityData","ariaLabel","_renderArcLabel","className","innerRadius","outerRadius","showLabelsInPercent","totalValue","hideLabels","activeArc","Math","abs","endAngle","startAngle","PI","base","perp","centroid","hyp","sqrt","labelRadius","max","angle","arcValue","value","text","x","y","textAnchor","dominantBaseline","aria-hidden","newProps","href","focusedArcId","uniqText","replace","opacity","g","ref","path","d","focusData","focusRing","root","style","fill","color","cursor","onFocus","bind","data-is-focusable","onMouseOver","onMouseMove","onMouseLeave","onBlur","onClick","aria-label","role","arcLabel","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,OAAOC,KAAK,QAAQ,WAAW;AACxC,SAASC,YAAY,QAAQ,wBAAwB;AAGrD,SAASC,UAAUC,QAAQ,QAAQ,YAAY;AAC/C,SAASC,0BAA0B,EAAEC,MAAM,QAAQ,2BAA2B;AAE9E,wGAAwG;AACxG;;;CAGC,GACD,OAAO,MAAMC,oBAAyCR,MAAMS,UAAU,CACpE,CAACC,OAAOC;QAwGSD;IAvGf,MAAMT,MAAMC;IACZ,MAAMU,2BAAaZ,MAAMa,SAAS;IAClC,MAAMC,SAAkBP;IACxB,MAAMQ,UAAUZ,aAAaO;IAE7BV,MAAMgB,SAAS,CAAC;QACdC,aAAaP;IACf,GAAG;QAACA;KAAM;IAEV,SAASQ,SAASC,IAAoB,EAAEC,EAAU;QAChDV,MAAMW,eAAe,CAAEF,MAAMC,IAAIR,WAAWU,OAAO;IACrD;IAEA,SAASC,SAASJ,IAAoB,EAAEK,UAA4C;QAClFA,WAAWC,OAAO;QAClBf,MAAMgB,eAAe,CAAEP,MAAMK;IAC/B;IAEA,SAASG;QACPjB,MAAMkB,kBAAkB;IAC1B;IAEA,SAASC;QACPnB,MAAMoB,cAAc;IACtB;IAEA,SAASC;YAIAC;QAHP,MAAMA,QAAQtB,MAAMS,IAAI,CAAEA,IAAI;QAC9B,MAAMc,SAASD,MAAME,gBAAgB,IAAIF,MAAMC,MAAM;QACrD,MAAME,SAASH,MAAMI,gBAAgB,IAAIJ,MAAMb,IAAI,IAAI;QACvD,OAAOa,EAAAA,kCAAA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,OAAO,YAAY;QAAU;QACjEgB,SAASnE,SAASoE,IAAI,CAAC,IAAI,EAAE5E,MAAMS,IAAI,CAAEA,IAAI,EAAEC;QAC/CmE,qBAAmB7E,MAAMoC,SAAS,KAAKpC,MAAMS,IAAI,CAAEA,IAAI,CAACc,MAAM,IAAIvB,MAAMoC,SAAS,KAAK;QACtF0C,aAAajE,SAAS+D,IAAI,CAAC,IAAI,EAAE5E,MAAMS,IAAI,CAAEA,IAAI;QACjDsE,aAAalE,SAAS+D,IAAI,CAAC,IAAI,EAAE5E,MAAMS,IAAI,CAAEA,IAAI;QACjDuE,cAAc/D;QACdgE,QAAQ9D;QACR4C,SAASA;QACTmB,OAAO,GAAElF,cAAAA,MAAMS,IAAI,cAAVT,kCAAAA,YAAYS,IAAI,CAACyE,OAAO;QACjCC,cAAY9D;QACZ+D,MAAK;QAENvD,gBAAgBxB,QAAQgF,QAAQ;AAGvC,GACA;AACFvF,IAAIwF,WAAW,GAAG"}
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable react/jsx-no-bind */ import * as React from 'react';
2
2
  import { Pie } from './Pie/index';
3
3
  import { useDonutChartStyles } from './useDonutChartStyles.styles';
4
- import { convertToLocaleString } from '../../utilities/locale-util';
4
+ import { formatToLocaleString } from '@fluentui/chart-utilities';
5
5
  import { getColorFromToken, getNextColor } from '../../utilities/index';
6
6
  import { Legends } from '../../index';
7
7
  import { useId } from '@fluentui/react-utilities';
@@ -147,7 +147,7 @@ const MIN_LEGEND_CONTAINER_HEIGHT = 40;
147
147
  }
148
148
  }
149
149
  function _toLocaleString(data) {
150
- const localeString = convertToLocaleString(data, props.culture);
150
+ const localeString = formatToLocaleString(data, props.culture);
151
151
  if (!localeString) {
152
152
  return data;
153
153
  }