@fluentui/react-charts 9.2.0 → 9.2.2

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 (103) hide show
  1. package/CHANGELOG.md +38 -3
  2. package/dist/index.d.ts +84 -5
  3. package/lib/ChartTable.js +1 -0
  4. package/lib/ChartTable.js.map +1 -0
  5. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  6. package/lib/components/ChartTable/ChartTable.js +57 -0
  7. package/lib/components/ChartTable/ChartTable.js.map +1 -0
  8. package/lib/components/ChartTable/ChartTable.types.js +1 -0
  9. package/lib/components/ChartTable/ChartTable.types.js.map +1 -0
  10. package/lib/components/ChartTable/index.js +3 -0
  11. package/lib/components/ChartTable/index.js.map +1 -0
  12. package/lib/components/ChartTable/useChartTableStyles.styles.js +93 -0
  13. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
  14. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +55 -0
  15. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
  16. package/lib/components/CommonComponents/CartesianChart.js +110 -81
  17. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  18. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  19. package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
  20. package/lib/components/DeclarativeChart/DeclarativeChart.js +20 -10
  21. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  22. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +95 -0
  23. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
  24. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +204 -87
  25. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  26. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  27. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  28. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  29. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  30. package/lib/components/GanttChart/GanttChart.js.map +1 -1
  31. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +161 -141
  32. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  33. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  34. package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  35. package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
  36. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  37. package/lib/components/Legends/Legends.js.map +1 -1
  38. package/lib/components/Legends/OverflowMenu.js.map +1 -1
  39. package/lib/components/LineChart/LineChart.js.map +1 -1
  40. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  41. package/lib/components/VerticalBarChart/VerticalBarChart.js +12 -11
  42. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  43. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +57 -51
  44. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  45. package/lib/index.js +1 -0
  46. package/lib/index.js.map +1 -1
  47. package/lib/types/DataPoint.js.map +1 -1
  48. package/lib/utilities/FocusableTooltipText.js.map +1 -1
  49. package/lib/utilities/utilities.js +26 -37
  50. package/lib/utilities/utilities.js.map +1 -1
  51. package/lib/utilities/vbc-utils.js +24 -0
  52. package/lib/utilities/vbc-utils.js.map +1 -1
  53. package/lib-commonjs/ChartTable.js +6 -0
  54. package/lib-commonjs/ChartTable.js.map +1 -0
  55. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  56. package/lib-commonjs/components/ChartTable/ChartTable.js +68 -0
  57. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -0
  58. package/lib-commonjs/components/ChartTable/ChartTable.types.js +6 -0
  59. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -0
  60. package/lib-commonjs/components/ChartTable/index.js +8 -0
  61. package/lib-commonjs/components/ChartTable/index.js.map +1 -0
  62. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +196 -0
  63. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
  64. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +69 -0
  65. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
  66. package/lib-commonjs/components/CommonComponents/CartesianChart.js +109 -80
  67. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  68. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  69. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -1
  70. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +19 -9
  71. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  72. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +120 -0
  73. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
  74. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +204 -87
  75. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  76. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  77. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  78. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  79. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  80. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
  81. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +159 -139
  82. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  83. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  84. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  85. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
  86. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  87. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  88. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
  89. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  90. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  91. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +11 -10
  92. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  93. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +56 -50
  94. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  95. package/lib-commonjs/index.js +1 -0
  96. package/lib-commonjs/index.js.map +1 -1
  97. package/lib-commonjs/types/DataPoint.js.map +1 -1
  98. package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
  99. package/lib-commonjs/utilities/utilities.js +29 -37
  100. package/lib-commonjs/utilities/utilities.js.map +1 -1
  101. package/lib-commonjs/utilities/vbc-utils.js +27 -0
  102. package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
  103. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/DeclarativeChart/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 Data,\n} from '@fluentui/chart-utilities';\nimport {\n isArrayOfType,\n isArrayOrTypedArray,\n isDate,\n isDateArray,\n isNumberArray,\n isYearArray,\n} from '@fluentui/chart-utilities';\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 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 usesSecondaryYScale = (series: Partial<PlotData>): boolean => {\n return series.yaxis === 'y2';\n};\n\nconst getSecondaryYAxisValues = (\n data: Data[],\n layout: Partial<Layout> | undefined,\n maxAllowedMinY?: number,\n minAllowedMaxY?: number,\n): SecondaryYAxisValues => {\n let containsSecondaryYAxis = false;\n let yMinValue: number | undefined;\n let yMaxValue: number | undefined;\n\n data.forEach((series: Partial<PlotData>) => {\n if (usesSecondaryYScale(series)) {\n containsSecondaryYAxis = true;\n const yValues = series.y as number[];\n if (yValues) {\n yMinValue = Math.min(...yValues);\n yMaxValue = Math.max(...yValues);\n }\n }\n });\n\n if (!containsSecondaryYAxis) {\n return {};\n }\n\n if (typeof yMinValue === 'number' && typeof maxAllowedMinY === 'number') {\n yMinValue = Math.min(yMinValue, maxAllowedMinY);\n }\n if (typeof yMaxValue === 'number' && typeof minAllowedMaxY === 'number') {\n yMaxValue = Math.max(yMaxValue, minAllowedMaxY);\n }\n if (layout?.yaxis2?.range) {\n yMinValue = layout.yaxis2.range[0];\n yMaxValue = layout.yaxis2.range[1];\n }\n\n return {\n secondaryYAxistitle:\n typeof layout?.yaxis2?.title === 'string'\n ? layout.yaxis2.title\n : typeof layout?.yaxis2?.title?.text === 'string'\n ? layout.yaxis2.title.text\n : undefined,\n secondaryYScaleOptions: {\n yMinValue,\n yMaxValue,\n },\n };\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 const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);\n let yMinValue = 0;\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 yMaxValue = Math.max(yMaxValue, yVal);\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 useSecondaryYScale: usesSecondaryYScale(series),\n });\n if (!usesSecondaryYScale(series)) {\n yMaxValue = Math.max(yMaxValue, yVal);\n }\n }\n\n yMaxValue = Math.max(yMaxValue, yVal);\n yMinValue = Math.min(yMinValue, yVal);\n });\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 yMinValue,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n mode: 'plotly',\n ...secondaryYAxisValues,\n hideTickOverlap: true,\n barGapMax: 2,\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 const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);\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 useSecondaryYScale: usesSecondaryYScale(series),\n });\n }\n });\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 ...secondaryYAxisValues,\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 // TODO: In case of a single bin, add an empty bin of the same size to prevent the\n // default bar width from being used and ensure the bar spans the full intended range.\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: 'histogram',\n hideTickOverlap: true,\n maxBarWidth: 50,\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 const secondaryYAxisValues = getSecondaryYAxisValues(\n input.data,\n input.layout,\n isAreaChart ? 0 : undefined,\n isAreaChart ? 0 : undefined,\n );\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 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 useSecondaryYScale: usesSecondaryYScale(series),\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 ...secondaryYAxisValues,\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 ...secondaryYAxisValues,\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 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 legendName = series.name ?? yValue;\n const color = getColor(legendName, colorMap, isDarkTheme);\n return {\n x: series.x[i],\n y: yValue,\n legend: legendName,\n color,\n } as HorizontalBarChartWithAxisDataPoint;\n });\n })\n .reverse()\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 numberOfRows = new Set(chartData.map(d => d.y)).size || 1;\n const scalingFactor = 0.01;\n const gapFactor = 1 / (1 + scalingFactor * numberOfRows);\n const barHeight = availableHeight / (numberOfRows * (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 noOfCharsToTruncate: 20,\n showYAxisLablesTooltip: 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 noOfCharsToTruncate: 20,\n showYAxisLablesTooltip: 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 };\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 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\nexport const projectPolarToCartesian = (input: PlotlySchema): PlotlySchema => {\n const projection: PlotlySchema = { ...input };\n for (let sindex = 0; sindex < input.data.length; sindex++) {\n const series: PlotData = input.data[sindex] as PlotData;\n series.x = [];\n series.y = [];\n for (let ptindex = 0; ptindex < series.r.length; ptindex++) {\n const thetaRad = ((series.theta[ptindex] as number) * Math.PI) / 180;\n const radius = series.r[ptindex] as number;\n series.x[ptindex] = radius * Math.cos(thetaRad);\n series.y[ptindex] = radius * Math.sin(thetaRad);\n }\n projection.data[sindex] = series;\n }\n\n return projection;\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(\n (bin, index) =>\n (value as number) >= bin.x0! &&\n (index === bins.length - 1 ? (value as number) <= bin.x1! : (value as number) < bin.x1!),\n );\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' && binSize > 0) {\n const thresholds: number[] = [];\n const precision = Math.max(getPrecision(minVal), getPrecision(binSize));\n let th = precisionRound(minVal, precision);\n\n while (th < precisionRound(maxVal + binSize, precision)) {\n thresholds.push(th);\n th = precisionRound(th + binSize, precision);\n }\n\n minVal = thresholds[0];\n maxVal = thresholds[thresholds.length - 1];\n binGenerator.domain([minVal, maxVal]).thresholds(thresholds);\n\n // When the domain ends at the last threshold (maxVal), d3Bin creates an extra final bin where\n // both x0 and x1 are equal to maxVal and inclusive. The previous bin also has x1 equal to maxVal,\n // but it is exclusive. To maintain consistent bin widths, remove the final bin,\n // making the previous bin the last one, with both x0 and x1 inclusive.\n return binGenerator(data as number[]).slice(0, -1);\n }\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\nconst getPrecision = (value: number) => {\n return value.toString().split('.')[1]?.length ?? 0;\n};\n\nconst precisionRound = (value: number, precision: number) => {\n const factor = Math.pow(10, precision);\n return Math.round(value * factor) / factor;\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","curveCardinal","d3CurveCardinal","dashOptions","dot","strokeDasharray","strokeLinecap","strokeWidth","lineBorderWidth","dash","longdash","dashdot","longdashdot","solid","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","possiblyMonthValue","parsedDate","i","currentMonth","getMonth","previousMonth","currentYear","previousYear","setFullYear","month","getColor","legendLabel","colorMap","isDarkTheme","current","has","nextColor","size","set","get","usesSecondaryYScale","getSecondaryYAxisValues","data","maxAllowedMinY","minAllowedMaxY","containsSecondaryYAxis","yMinValue","yMaxValue","forEach","yValues","y","Math","yaxis2","secondaryYAxistitle","undefined","secondaryYScaleOptions","transformPlotlyJsonToDonutProps","input","firstData","mapLegendToDataPoint","labels","label","color","value","values","legend","width","height","hideLabels","textinfo","includes","donutMarginHorizontal","donutMarginVertical","innerRadius","hole","chartData","Object","hideLegend","showlegend","showLabelsInPercent","transformPlotlyJsonToVSBCProps","fallbackVSBC","mapXToDataPoints","secondaryYAxisValues","index1","isXYearCategory","x","index2","xAxisPoint","toString","lineData","yVal","type","push","lineOptions","getLineOptions","line","useSecondaryYScale","barWidth","mode","hideTickOverlap","barGapMax","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","maxBarWidth","transformPlotlyJsonToScatterChartProps","isAreaChart","isString","isXDate","isXNumber","lineColor","fill","parseFloat","marker","markerSize","yMinMaxValues","chartProps","lineChartData","supportNegativeData","useUTC","roundedTicks","startValue","endValue","transformPlotlyJsonToHorizontalBarWithAxisProps","yValue","legendName","reverse","flat","chartHeight","margin","l","padding","pad","availableHeight","numberOfRows","Set","d","scalingFactor","gapFactor","barHeight","showYAxisLables","noOfCharsToTruncate","showYAxisLablesTooltip","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","projectPolarToCartesian","projection","sindex","ptindex","r","thetaRad","theta","PI","radius","cos","sin","isPlainObject","obj","prototype","call","getPrototypeOf","hasOwnProperty","arrayAttributes","stack","isArrayStack","baseContainer","baseAttrName","findArrayAttributes","trace","crawlIntoTrace","container","astrPartial","item","newAstrPartial","j","shape","smoothing","curve","tension","keys","bins","findIndex","binStart","binEnd","binSize","categories","from","ceil","stop","floor","slice","scale","domain","nice","minVal","maxVal","binGenerator","thresholds","precision","getPrecision","th","precisionRound","dx","dy","split","factor","pow","round"],"mappings":"AAAA,0BAA0B,GAC1B,8BAA8B,GAC9B,yBAAyB,GACzB,qDAAqD,GACrD,YAAYA,WAAW,QAAQ;AAC/B,SACEC,OAAOC,KAAK,EACZC,UAAUC,QAAQ,EAClBC,OAAOC,KAAK,EACZC,OAAOC,KAAK,EACZC,OAAOC,K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H,OAAO9J,MAAML;QACf,KAAK;YACH,OAAOA,IAAIwD,MAAM,KAAK,IAAI,IAAInD,MAAML,OAAOA,IAAIwD,MAAM;QACvD,KAAK;gBACIjD;YAAP,OAAOA,CAAAA,SAAAA,MAAMP,kBAANO,oBAAAA,SAAc;QACvB,KAAK;gBACIE;YAAP,OAAOA,CAAAA,SAAAA,MAAMT,kBAANS,oBAAAA,SAAc;QACvB;YACE,OAAOT,IAAIwD,MAAM;IACrB;AACF;AAEA,MAAM4G,oBAAoB,CACxBC,UACA5D,OACAqD,OACA2K,IACAC,KAAa,CAAC;IAEd,OAAQrK;QACN,KAAK;YACH,OAAOP,UAAU,IAAI,IAAI,AAACrD,QAAQqD,QAAS;QAC7C,KAAK;YACH,OAAOA,UAAU,IAAI,IAAIrD,QAAQqD;QACnC,KAAK;YACH,OAAO2K,KAAKC,OAAO,IAAI,IAAIjO,QAASgO,CAAAA,KAAKC,EAAC;QAC5C,KAAK;YACH,OAAO5K,QAAQ2K,KAAKC,OAAO,IAAI,IAAIjO,QAASqD,CAAAA,QAAQ2K,KAAKC,EAAC;QAC5D;YACE,OAAOjO;IACX;AACF;AAEA,MAAM6N,eAAe,CAAC7N;QACbA;QAAAA;IAAP,OAAOA,CAAAA,iCAAAA,yBAAAA,MAAM0B,QAAQ,GAAGwM,KAAK,CAAC,IAAI,CAAC,EAAE,cAA9BlO,6CAAAA,uBAAgCjD,MAAM,cAAtCiD,2CAAAA,gCAA0C;AACnD;AAEA,MAAM+N,iBAAiB,CAAC/N,OAAe4N;IACrC,MAAMO,SAAS/O,KAAKgP,GAAG,CAAC,IAAIR;IAC5B,OAAOxO,KAAKiP,KAAK,CAACrO,QAAQmO,UAAUA;AACtC"}
1
+ {"version":3,"sources":["../src/components/DeclarativeChart/PlotlySchemaAdapter.ts"],"sourcesContent":["/* eslint-disable one-var */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-var */\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 } from '../../utilities/colors';\nimport { GaugeChartProps, GaugeChartSegment } from '../GaugeChart/index';\nimport { GroupedVerticalBarChartProps } from '../GroupedVerticalBarChart/index';\nimport { VerticalBarChartProps } from '../VerticalBarChart/index';\nimport { ChartTableProps } from '../ChartTable/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 Data,\n TableData,\n Color,\n} from '@fluentui/chart-utilities';\nimport {\n isArrayOfType,\n isArrayOrTypedArray,\n isDate,\n isDateArray,\n isNumberArray,\n isYearArray,\n} from '@fluentui/chart-utilities';\nimport { curveCardinal as d3CurveCardinal } from 'd3-shape';\nimport type { ColorwayType } from './PlotlyColorAdapter';\nimport { extractColor, resolveColor } from './PlotlyColorAdapter';\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\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\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\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\nconst usesSecondaryYScale = (series: Partial<PlotData>): boolean => {\n return series.yaxis === 'y2';\n};\n\nconst getSecondaryYAxisValues = (\n data: Data[],\n layout: Partial<Layout> | undefined,\n maxAllowedMinY?: number,\n minAllowedMaxY?: number,\n): SecondaryYAxisValues => {\n let containsSecondaryYAxis = false;\n let yMinValue: number | undefined;\n let yMaxValue: number | undefined;\n\n data.forEach((series: Partial<PlotData>) => {\n if (usesSecondaryYScale(series)) {\n containsSecondaryYAxis = true;\n const yValues = series.y as number[];\n if (yValues) {\n yMinValue = Math.min(...yValues);\n yMaxValue = Math.max(...yValues);\n }\n }\n });\n\n if (!containsSecondaryYAxis) {\n return {};\n }\n\n if (typeof yMinValue === 'number' && typeof maxAllowedMinY === 'number') {\n yMinValue = Math.min(yMinValue, maxAllowedMinY);\n }\n if (typeof yMaxValue === 'number' && typeof minAllowedMaxY === 'number') {\n yMaxValue = Math.max(yMaxValue, minAllowedMaxY);\n }\n if (layout?.yaxis2?.range) {\n yMinValue = layout.yaxis2.range[0];\n yMaxValue = layout.yaxis2.range[1];\n }\n\n return {\n secondaryYAxistitle:\n typeof layout?.yaxis2?.title === 'string'\n ? layout.yaxis2.title\n : typeof layout?.yaxis2?.title?.text === 'string'\n ? layout.yaxis2.title.text\n : undefined,\n secondaryYScaleOptions: {\n yMinValue,\n yMaxValue,\n },\n };\n};\n\nexport const _getGaugeAxisColor = (\n colorway: string[] | undefined,\n colorwayType: ColorwayType,\n color: Color | undefined,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): string => {\n const extractedColors = extractColor(colorway, colorwayType, color, colorMap, isDarkTheme);\n return resolveColor(extractedColors, 0, '', colorMap, isDarkTheme);\n};\n\nexport const transformPlotlyJsonToDonutProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n colorwayType: ColorwayType,\n isDarkTheme?: boolean,\n): DonutChartProps => {\n const firstData = input.data[0] as PieData;\n // extract colors for each series only once\n const colors: string[] | string | null | undefined = extractColor(\n input.layout?.template?.layout?.colorway,\n colorwayType,\n firstData?.marker?.colors,\n colorMap,\n isDarkTheme,\n );\n const mapLegendToDataPoint: Record<string, ChartDataPoint> = {};\n firstData.labels?.forEach((label: string, index: number) => {\n // resolve color for each legend from the extracted colors\n const color: string = resolveColor(colors, index, label, colorMap, isDarkTheme);\n\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 roundCorners: true,\n };\n};\n\nexport const transformPlotlyJsonToVSBCProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n colorwayType: ColorwayType,\n isDarkTheme?: boolean,\n fallbackVSBC?: boolean,\n): VerticalStackedBarChartProps => {\n const mapXToDataPoints: { [key: string]: VerticalStackedChartProps } = {};\n let yMaxValue = 0;\n const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);\n const { legends, hideLegend } = getLegendProps(input.data, input.layout);\n let yMinValue = 0;\n input.data.forEach((series: PlotData, index1: number) => {\n const isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis\n // extract bar colors for each series only once\n const extractedBarColors = extractColor(\n input.layout?.template?.layout?.colorway,\n colorwayType,\n series.marker?.color,\n colorMap,\n isDarkTheme,\n ) as string[] | string | undefined;\n // extract line colors for each series only once\n const extractedLineColors = extractColor(\n input.layout?.template?.layout?.colorway,\n colorwayType,\n series.line?.color,\n colorMap,\n isDarkTheme,\n ) as string[] | string | undefined;\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 = legends[index1];\n // resolve color for each legend's bars from the extracted colors\n const color = resolveColor(extractedBarColors, index1, legend, colorMap, isDarkTheme);\n const yVal: number = (series.y?.[index2] as number) ?? 0;\n if (series.type === 'bar') {\n mapXToDataPoints[x].chartData.push({\n legend,\n data: yVal,\n color,\n });\n yMaxValue = Math.max(yMaxValue, yVal);\n } else if (series.type === 'scatter' || !!fallbackVSBC) {\n const lineColor = resolveColor(extractedLineColors, index1, legend, colorMap, isDarkTheme);\n const lineOptions = getLineOptions(series.line);\n const dashType = series.line?.dash || 'solid';\n const legendShape =\n dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';\n mapXToDataPoints[x].lineData!.push({\n legend,\n legendShape,\n y: yVal,\n color: lineColor,\n ...(lineOptions ? { lineOptions } : {}),\n useSecondaryYScale: usesSecondaryYScale(series),\n });\n if (!usesSecondaryYScale(series)) {\n yMaxValue = Math.max(yMaxValue, yVal);\n }\n }\n\n yMaxValue = Math.max(yMaxValue, yVal);\n yMinValue = Math.min(yMinValue, yVal);\n });\n });\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n const vsbcData = Object.values(mapXToDataPoints);\n\n return {\n data: vsbcData,\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n barWidth: 'auto',\n yMaxValue,\n yMinValue,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n mode: 'plotly',\n ...secondaryYAxisValues,\n wrapXAxisLables: typeof vsbcData[0]?.xAxisPoint === 'string',\n hideTickOverlap: true,\n barGapMax: 2,\n hideLegend,\n roundCorners: true,\n };\n};\n\nexport const transformPlotlyJsonToGVBCProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n colorwayType: ColorwayType,\n isDarkTheme?: boolean,\n): GroupedVerticalBarChartProps => {\n const mapXToDataPoints: Record<string, GroupedVerticalBarChartData> = {};\n const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);\n const { legends, hideLegend } = getLegendProps(input.data, input.layout);\n input.data.forEach((series: PlotData, index1: number) => {\n // extract colors for each series only once\n const extractedColors = extractColor(\n input.layout?.template?.layout?.colorway,\n colorwayType,\n series.marker?.color,\n colorMap,\n isDarkTheme,\n ) as string[] | string | undefined;\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 = legends[index1];\n // resolve color for each legend's bars from the extracted colors\n const color = resolveColor(extractedColors, index1, 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 useSecondaryYScale: usesSecondaryYScale(series),\n });\n }\n });\n });\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n const gvbcData = Object.values(mapXToDataPoints);\n\n return {\n data: gvbcData,\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n barWidth: 'auto',\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n mode: 'plotly',\n ...secondaryYAxisValues,\n hideTickOverlap: true,\n wrapXAxisLables: typeof gvbcData[0]?.name === 'string',\n hideLegend,\n roundCorners: true,\n };\n};\n\nexport const transformPlotlyJsonToVBCProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n colorwayType: ColorwayType,\n isDarkTheme?: boolean,\n): VerticalBarChartProps => {\n const vbcData: VerticalBarChartDataPoint[] = [];\n const { legends, hideLegend } = getLegendProps(input.data, input.layout);\n\n input.data.forEach((series: Partial<PlotData>, seriesIdx: number) => {\n if (!series.x) {\n return;\n }\n\n // extract colors for each series only once\n const extractedColors = extractColor(\n input.layout?.template?.layout?.colorway,\n colorwayType,\n series.marker?.color,\n colorMap,\n isDarkTheme,\n ) as string[] | string | undefined;\n const isXString = isStringArray(series.x);\n // TODO: In case of a single bin, add an empty bin of the same size to prevent the\n // default bar width from being used and ensure the bar spans the full intended range.\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 = legends[seriesIdx];\n // resolve color for each legend's bars from the extracted colors\n const color = resolveColor(extractedColors, seriesIdx, 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: 'histogram',\n hideTickOverlap: true,\n wrapXAxisLables: typeof vbcData[0]?.x === 'string',\n maxBarWidth: 50,\n hideLegend,\n roundCorners: true,\n };\n};\n\nexport const transformPlotlyJsonToScatterChartProps = (\n input: PlotlySchema,\n isAreaChart: boolean,\n isScatterMarkers: boolean,\n colorMap: React.MutableRefObject<Map<string, string>>,\n colorwayType: ColorwayType,\n isDarkTheme?: boolean,\n): LineChartProps | AreaChartProps => {\n const secondaryYAxisValues = getSecondaryYAxisValues(\n input.data,\n input.layout,\n isAreaChart ? 0 : undefined,\n isAreaChart ? 0 : undefined,\n );\n let mode: string = 'tonexty';\n const { legends, hideLegend } = getLegendProps(input.data, input.layout);\n const chartData: LineChartPoints[] = input.data.map((series: PlotData, index: number) => {\n // extract colors for each series only once\n const extractedColors = extractColor(\n input.layout?.template?.layout?.colorway,\n colorwayType,\n isScatterMarkers ? series.marker?.color : series.line?.color,\n colorMap,\n isDarkTheme,\n ) as string[] | string | undefined;\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 = legends[index];\n // resolve color for each legend's lines from the extracted colors\n const seriesColor = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);\n mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';\n const lineOptions = getLineOptions(series.line);\n const dashType = series.line?.dash || 'solid';\n const legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';\n\n return {\n legend,\n legendShape,\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: seriesColor,\n ...(lineOptions ? { lineOptions } : {}),\n useSecondaryYScale: usesSecondaryYScale(series),\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 ...secondaryYAxisValues,\n mode,\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n hideTickOverlap: true,\n useUTC: false,\n hideLegend,\n } as AreaChartProps;\n } else {\n return {\n data: chartProps,\n supportNegativeData: true,\n xAxisTitle,\n yAxisTitle,\n ...secondaryYAxisValues,\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 useUTC: false,\n hideLegend,\n } as LineChartProps;\n }\n};\n\nexport const transformPlotlyJsonToHorizontalBarWithAxisProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n colorwayType: ColorwayType,\n isDarkTheme?: boolean,\n): HorizontalBarChartWithAxisProps => {\n const { legends, hideLegend } = getLegendProps(input.data, input.layout);\n const chartData: HorizontalBarChartWithAxisDataPoint[] = input.data\n .map((series: PlotData, index: number) => {\n // extract colors for each series only once\n const extractedColors = extractColor(\n input.layout?.template?.layout?.colorway,\n colorwayType,\n series.marker?.color,\n colorMap,\n isDarkTheme,\n ) as string[] | string | undefined;\n const legend = legends[index];\n // resolve color for each legend's bars from the extracted colors\n const color = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);\n return (series.y as Datum[]).map((yValue: string, i: number) => {\n return {\n x: series.x[i],\n y: yValue,\n legend,\n color,\n } as HorizontalBarChartWithAxisDataPoint;\n });\n })\n .reverse()\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 numberOfRows = new Set(chartData.map(d => d.y)).size || 1;\n const scalingFactor = 0.01;\n const gapFactor = 1 / (1 + scalingFactor * numberOfRows);\n const barHeight = availableHeight / (numberOfRows * (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 noOfCharsToTruncate: 20,\n showYAxisLablesTooltip: true,\n hideLegend,\n roundCorners: 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 noOfCharsToTruncate: 20,\n showYAxisLablesTooltip: true,\n wrapXAxisLables: true,\n };\n};\n\nexport const transformPlotlyJsonToSankeyProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n colorwayType: ColorwayType,\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 // 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 extractedNodeColors = extractColor(\n input.layout?.template?.layout?.colorway,\n colorwayType,\n node?.color,\n colorMap,\n isDarkTheme,\n );\n const sankeyChartData = {\n nodes: node.label?.map((label: string, index: number) => {\n const color = resolveColor(extractedNodeColors, index, label, colorMap, isDarkTheme);\n\n return {\n nodeId: index,\n name: label,\n color,\n };\n }),\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 };\n};\n\nexport const transformPlotlyJsonToGaugeProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n colorwayType: ColorwayType,\n isDarkTheme?: boolean,\n): GaugeChartProps => {\n const firstData = input.data[0] as PlotData;\n const stepsColors = firstData.gauge?.steps ? firstData.gauge.steps.map(step => step.color) : undefined;\n const extractedColors = extractColor(\n input.layout?.template?.layout?.colorway,\n colorwayType,\n stepsColors,\n colorMap,\n isDarkTheme,\n );\n\n const segments = firstData.gauge?.steps?.length\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\n firstData.gauge.steps.map((step: any, index: number): GaugeChartSegment => {\n const legend = step.name || `Segment ${index + 1}`;\n const color = resolveColor(extractedColors, index, 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: _getGaugeAxisColor(\n input.layout?.template?.layout?.colorway,\n colorwayType,\n firstData.gauge?.axis?.color,\n colorMap,\n isDarkTheme,\n ),\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 extractedIncreasingDeltaColors = extractColor(\n input.layout?.template?.layout?.colorway,\n colorwayType,\n firstData.delta?.increasing?.color,\n colorMap,\n isDarkTheme,\n );\n const color = resolveColor(extractedIncreasingDeltaColors, 0, '', colorMap, isDarkTheme);\n sublabelColor = color;\n } else {\n sublabel = `\\u25BC ${Math.abs(diff)}`;\n const extractedDecreasingDeltaColors = extractColor(\n input.layout?.template?.layout?.colorway,\n colorwayType,\n firstData.delta?.decreasing?.color,\n colorMap,\n isDarkTheme,\n );\n const color = resolveColor(extractedDecreasingDeltaColors, 0, '', colorMap, isDarkTheme);\n sublabelColor = color;\n }\n }\n\n const styles = {\n sublabel: sublabelColor,\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 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 styles,\n roundCorners: true,\n };\n};\n\nconst cleanText = (text: string): string => {\n return text\n .replace(/&lt;[^&]*?&gt;/g, '')\n .replace(/<[^>]*>/g, '')\n .replace(/&lt;br&gt;|\\\\u003cbr\\\\u003e|<br>/gi, '')\n .replace(/\\$[^$]*\\$/g, '$')\n .trim();\n};\n\nexport const transformPlotlyJsonToChartTableProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): ChartTableProps => {\n const tableData = input.data[0] as TableData;\n\n const normalizeHeaders = (\n values: (string | number | boolean | null)[] | (string | number | boolean | null)[][],\n ): (string | number | boolean | null)[] => {\n // Case: values is array of arrays\n if (Array.isArray(values[0])) {\n return (values as string[][]).map(row =>\n row\n .map(cell => cleanText(cell))\n .filter(Boolean)\n .join(' '),\n );\n }\n\n // Case: values is 1d array\n return (values as string[]).map(cell => cleanText(cell));\n };\n const columns = tableData.cells?.values ?? [];\n const rows = columns[0].map((_, rowIndex: number) =>\n columns.map(col => {\n const cell = col[rowIndex];\n return { value: typeof cell === 'string' ? cleanText(cell) : cell };\n }),\n );\n\n const styles: ChartTableProps['styles'] = {\n root: {\n ...(input.layout?.font?.size ? { fontSize: input.layout.font.size } : {}),\n },\n };\n\n return {\n headers: normalizeHeaders(tableData.header?.values ?? []).map(value => ({ value })),\n rows,\n width: input.layout?.width,\n height: input.layout?.height,\n styles,\n };\n};\n\nexport const projectPolarToCartesian = (input: PlotlySchema): PlotlySchema => {\n const projection: PlotlySchema = { ...input };\n for (let sindex = 0; sindex < input.data.length; sindex++) {\n const series: PlotData = input.data[sindex] as PlotData;\n series.x = [];\n series.y = [];\n for (let ptindex = 0; ptindex < series.r.length; ptindex++) {\n const thetaRad = ((series.theta[ptindex] as number) * Math.PI) / 180;\n const radius = series.r[ptindex] as number;\n series.x[ptindex] = radius * Math.cos(thetaRad);\n series.y[ptindex] = radius * Math.sin(thetaRad);\n }\n projection.data[sindex] = series;\n }\n\n return projection;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction isPlainObject(obj: any) {\n return (\n Object.prototype.toString.call(obj) === '[object Object]' &&\n Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty')\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nvar arrayAttributes: any[] = [];\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nvar stack: any[] = [];\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nvar isArrayStack: any[] = [];\n// eslint-disable-next-line @typescript-eslint/no-explicit-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 */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function findArrayAttributes(trace: any) {\n // Init basecontainer and baseAttrName\n crawlIntoTrace(baseContainer, 0, '');\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\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\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isStringArray = (arr: any) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-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(\n (bin, index) =>\n (value as number) >= bin.x0! &&\n (index === bins.length - 1 ? (value as number) <= bin.x1! : (value as number) < bin.x1!),\n );\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' && binSize > 0) {\n const thresholds: number[] = [];\n const precision = Math.max(getPrecision(minVal), getPrecision(binSize));\n let th = precisionRound(minVal, precision);\n\n while (th < precisionRound(maxVal + binSize, precision)) {\n thresholds.push(th);\n th = precisionRound(th + binSize, precision);\n }\n\n minVal = thresholds[0];\n maxVal = thresholds[thresholds.length - 1];\n binGenerator.domain([minVal, maxVal]).thresholds(thresholds);\n\n // When the domain ends at the last threshold (maxVal), d3Bin creates an extra final bin where\n // both x0 and x1 are equal to maxVal and inclusive. The previous bin also has x1 equal to maxVal,\n // but it is exclusive. To maintain consistent bin widths, remove the final bin,\n // making the previous bin the last one, with both x0 and x1 inclusive.\n return binGenerator(data as number[]).slice(0, -1);\n }\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\nconst getPrecision = (value: number) => {\n return value.toString().split('.')[1]?.length ?? 0;\n};\n\nconst precisionRound = (value: number, precision: number) => {\n const factor = Math.pow(10, precision);\n return Math.round(value * factor) / factor;\n};\n\nconst getLegendProps = (data: Data[], layout: Partial<Layout> | undefined) => {\n const legends: string[] = [];\n if (data.length === 1) {\n legends.push(data[0].name || '');\n } else {\n data.forEach((series, index) => {\n legends.push(series.name || `Series ${index + 1}`);\n });\n }\n\n const hideLegends = data.every((series: Partial<PlotData>) => series.showlegend === false);\n\n return {\n legends,\n hideLegend: layout?.showlegend === false ? true : hideLegends,\n };\n};\n"],"names":["React","bin","d3Bin","extent","d3Extent","sum","d3Sum","min","d3Min","max","d3Max","range","d3Range","scaleLinear","d3ScaleLinear","DataVizPalette","getColorFromToken","findNumericMinMaxOfY","isArrayOfType","isArrayOrTypedArray","isDate","isDateArray","isNumberArray","isYearArray","curveCardinal","d3CurveCardinal","extractColor","resolveColor","dashOptions","dot","strokeDasharray","strokeLinecap","strokeWidth","lineBorderWidth","dash","longdash","dashdot","longdashdot","solid","getTitles","layout","titles","chartTitle","title","text","xAxisTitle","xaxis","yAxisTitle","yaxis","correctYearMonth","xValues","presentYear","Date","getFullYear","length","Array","isArray","Error","dates","map","possiblyMonthValue","parsedDate","i","currentMonth","getMonth","previousMonth","currentYear","previousYear","setFullYear","month","index","usesSecondaryYScale","series","getSecondaryYAxisValues","data","maxAllowedMinY","minAllowedMaxY","containsSecondaryYAxis","yMinValue","yMaxValue","forEach","yValues","y","Math","yaxis2","secondaryYAxistitle","undefined","secondaryYScaleOptions","_getGaugeAxisColor","colorway","colorwayType","color","colorMap","isDarkTheme","extractedColors","transformPlotlyJsonToDonutProps","input","firstData","colors","template","marker","mapLegendToDataPoint","labels","label","value","values","legend","width","height","hideLabels","textinfo","includes","donutMarginHorizontal","donutMarginVertical","innerRadius","hole","chartData","Object","hideLegend","showlegend","showLabelsInPercent","roundCorners","transformPlotlyJsonToVSBCProps","fallbackVSBC","vsbcData","mapXToDataPoints","secondaryYAxisValues","legends","getLegendProps","index1","isXYearCategory","x","extractedBarColors","extractedLineColors","line","index2","xAxisPoint","toString","lineData","yVal","type","push","lineColor","lineOptions","getLineOptions","dashType","legendShape","useSecondaryYScale","barWidth","mode","wrapXAxisLables","hideTickOverlap","barGapMax","transformPlotlyJsonToGVBCProps","gvbcData","name","key","xAxisCalloutData","transformPlotlyJsonToVBCProps","vbcData","seriesIdx","isXString","isStringArray","xBins","createBins","xbins","start","end","size","yBins","total","xVal","binIdx","findBinIndex","calculateHistFunc","histfunc","calculateHistNorm","histnorm","getBinSize","join","getBinCenter","x0","x1","maxBarWidth","transformPlotlyJsonToScatterChartProps","isAreaChart","isScatterMarkers","isString","isXDate","isXNumber","seriesColor","fill","parseFloat","markerSize","yMinMaxValues","chartProps","lineChartData","supportNegativeData","useUTC","roundedTicks","startValue","endValue","transformPlotlyJsonToHorizontalBarWithAxisProps","yValue","reverse","flat","chartHeight","margin","l","padding","pad","availableHeight","numberOfRows","Set","d","scalingFactor","gapFactor","barHeight","showYAxisLables","noOfCharsToTruncate","showYAxisLablesTooltip","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","extractedNodeColors","sankeyChartData","nodes","nodeId","links","validLink","SankeyChartData","transformPlotlyJsonToGaugeProps","stepsColors","gauge","steps","step","segments","axis","disabled","sublabel","sublabelColor","delta","reference","diff","extractedIncreasingDeltaColors","increasing","abs","extractedDecreasingDeltaColors","decreasing","styles","chartValue","minValue","maxValue","chartValueFormat","variant","cleanText","replace","trim","transformPlotlyJsonToChartTableProps","tableData","normalizeHeaders","cell","Boolean","columns","cells","rows","_","rowIndex","col","root","font","fontSize","headers","header","projectPolarToCartesian","projection","sindex","ptindex","r","thetaRad","theta","PI","radius","cos","sin","isPlainObject","obj","prototype","call","getPrototypeOf","hasOwnProperty","arrayAttributes","stack","isArrayStack","baseContainer","baseAttrName","findArrayAttributes","trace","crawlIntoTrace","container","astrPartial","item","newAstrPartial","j","shape","smoothing","curve","tension","keys","bins","findIndex","binStart","binEnd","binSize","categories","from","ceil","stop","floor","slice","scale","domain","nice","minVal","maxVal","binGenerator","thresholds","precision","getPrecision","th","precisionRound","dx","dy","split","factor","pow","round","hideLegends","every"],"mappings":"AAAA,0BAA0B,GAC1B,8BAA8B,GAC9B,yBAAyB,GACzB,YAAYA,WAAW,QAAQ;AAC/B,SACEC,OAAOC,KAAK,EACZC,UAAUC,QAAQ,EAClBC,OAAOC,KAAK,EACZC,OAAOC,KAAK,EACZC,OAAOC,KAAK,EACZC,SAASC,OAAO,QAEX,WAAW;AAClB,SAASC,eAAeC,aAAa,QAAQ,WAAW;AAqBxD,SAASC,cAAc,EAAEC,iBAAiB,QAAQ,yBAAyB;AAK3E,SAASC,oBAAoB,QAAQ,4BAA4B;AAcjE,SACEC,aAAa,EACbC,mBAAmB,EACnBC,MAAM,EACNC,WAAW,EACXC,aAAa,EACbC,WAAW,QACN,4BAA4B;AACnC,SAASC,iBAAiBC,eAAe,QAAQ,WAAW;AAE5D,SAASC,YAAY,EAAEC,YAAY,QAAQ,uBAAuB;AAOlE,MAAMC,cAAc;IAClBC,KAAK;QACHC,iBAAiB;QACjBC,eAAe;QACfC,aAAa;QACbC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KAAKC,EAAC;QAC5C,KAAK;YACH,OAAOtM,QAAQqM,KAAKC,OAAO,IAAI,IAAIxQ,QAASkE,CAAAA,QAAQqM,KAAKC,EAAC;QAC5D;YACE,OAAOxQ;IACX;AACF;AAEA,MAAMoQ,eAAe,CAACpQ;QACbA;QAAAA;IAAP,OAAOA,CAAAA,iCAAAA,yBAAAA,MAAMiC,QAAQ,GAAGwO,KAAK,CAAC,IAAI,CAAC,EAAE,cAA9BzQ,6CAAAA,uBAAgClD,MAAM,cAAtCkD,2CAAAA,gCAA0C;AACnD;AAEA,MAAMsQ,iBAAiB,CAACtQ,OAAemQ;IACrC,MAAMO,SAAS/R,KAAKgS,GAAG,CAAC,IAAIR;IAC5B,OAAOxR,KAAKiS,KAAK,CAAC5Q,QAAQ0Q,UAAUA;AACtC;AAEA,MAAMlP,iBAAiB,CAACtD,MAAclC;IACpC,MAAMuF,UAAoB,EAAE;IAC5B,IAAIrD,KAAKpB,MAAM,KAAK,GAAG;QACrByE,QAAQc,IAAI,CAACnE,IAAI,CAAC,EAAE,CAACiF,IAAI,IAAI;IAC/B,OAAO;QACLjF,KAAKM,OAAO,CAAC,CAACR,QAAQF;YACpByD,QAAQc,IAAI,CAACrE,OAAOmF,IAAI,IAAI,CAAC,OAAO,EAAErF,QAAQ,GAAG;QACnD;IACF;IAEA,MAAM+S,cAAc3S,KAAK4S,KAAK,CAAC,CAAC9S,SAA8BA,OAAO+C,UAAU,KAAK;IAEpF,OAAO;QACLQ;QACAT,YAAY9E,CAAAA,mBAAAA,6BAAAA,OAAQ+E,UAAU,MAAK,QAAQ,OAAO8P;IACpD;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/DonutChart/DonutChart.tsx"],"sourcesContent":["/* eslint-disable react/jsx-no-bind */\nimport * as React from 'react';\nimport { Pie } from './Pie/index';\nimport { DonutChartProps } from './DonutChart.types';\nimport { useDonutChartStyles } from './useDonutChartStyles.styles';\nimport { ChartDataPoint } from '../../DonutChart';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { getColorFromToken, getNextColor, useRtl } from '../../utilities/index';\nimport { Legend, Legends, LegendContainer } from '../../index';\nimport { useId } from '@fluentui/react-utilities';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { ImageExportOptions } from '../../types/index';\nimport { toImage } from '../../utilities/image-export-utils';\n\nconst MIN_LEGEND_CONTAINER_HEIGHT = 40;\n\n// Create a DonutChart variant which uses these default styles and this styled subcomponent.\n/**\n * Donutchart component.\n * {@docCategory DonutChart}\n */\nexport const DonutChart: React.FunctionComponent<DonutChartProps> = React.forwardRef<HTMLDivElement, DonutChartProps>(\n (props, forwardedRef) => {\n const _rootElem = React.useRef<HTMLDivElement | null>(null);\n const _uniqText: string = useId('_Pie_');\n /* eslint-disable @typescript-eslint/no-explicit-any */\n let _calloutAnchorPoint: ChartDataPoint | null;\n let _emptyChartId: string | null;\n const legendContainer = React.useRef<HTMLDivElement | null>(null);\n const prevSize = React.useRef<{ width?: number; height?: number }>({});\n\n const [value, setValue] = React.useState<string | undefined>('');\n const [legend, setLegend] = React.useState<string | undefined>('');\n const [_width, setWidth] = React.useState<number | undefined>(props.width || 200);\n const [_height, setHeight] = React.useState<number | undefined>(props.height || 200);\n const [activeLegend, setActiveLegend] = React.useState<string>('');\n const [color, setColor] = React.useState<string | undefined>('');\n const [xCalloutValue, setXCalloutValue] = React.useState<string>('');\n const [yCalloutValue, setYCalloutValue] = React.useState<string>('');\n const [selectedLegend, setSelectedLegend] = React.useState<string>('');\n const [focusedArcId, setFocusedArcId] = React.useState<string>('');\n const [dataPointCalloutProps, setDataPointCalloutProps] = React.useState<ChartDataPoint | undefined>();\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const _legendsRef = React.useRef<LegendContainer>(null);\n const _isRTL: boolean = useRtl();\n\n React.useEffect(() => {\n _fitParentContainer();\n }, []);\n\n React.useEffect(() => {\n if (prevSize.current.height !== props.height || prevSize.current.width !== props.width) {\n _fitParentContainer();\n }\n prevSize.current.height = props.height;\n prevSize.current.width = props.width;\n }, [props.width, props.height]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: _rootElem.current,\n toImage: (opts?: ImageExportOptions): Promise<string> => {\n return toImage(_rootElem.current, _legendsRef.current?.toSVG, _isRTL, opts);\n },\n }),\n [],\n );\n\n function _elevateToMinimums(data: ChartDataPoint[]) {\n let sumOfData = 0;\n const minPercent = 0.01;\n const elevatedData: ChartDataPoint[] = [];\n data.forEach(item => {\n sumOfData += item.data!;\n });\n data.forEach(item => {\n elevatedData.push(\n minPercent * sumOfData > item.data! && item.data! > 0\n ? {\n ...item,\n data: minPercent * sumOfData,\n yAxisCalloutData:\n item.yAxisCalloutData === undefined ? item.data!.toLocaleString() : item.yAxisCalloutData,\n }\n : item,\n );\n });\n return elevatedData;\n }\n function _createLegends(chartData: ChartDataPoint[]): JSX.Element {\n const legendDataItems = chartData.map((point: ChartDataPoint, index: number) => {\n const color: string = point.color!;\n // mapping data to the format Legends component needs\n const legend: Legend = {\n title: point.legend!,\n color,\n action: () => {\n if (selectedLegend === point.legend) {\n setSelectedLegend('');\n } else {\n setSelectedLegend(point.legend!);\n }\n },\n hoverAction: () => {\n _handleChartMouseLeave();\n setActiveLegend(point.legend!);\n },\n onMouseOutAction: () => {\n setActiveLegend('');\n },\n };\n return legend;\n });\n const legends = (\n <Legends\n legends={legendDataItems}\n centerLegends\n overflowText={props.legendsOverflowText}\n {...props.legendProps}\n legendRef={_legendsRef}\n />\n );\n return legends;\n }\n\n function _focusCallback(data: ChartDataPoint, id: string, e: React.FocusEvent<SVGPathElement>): void {\n let cx = 0;\n let cy = 0;\n\n const targetRect = (e.target as SVGPathElement).getBoundingClientRect();\n cx = targetRect.left + targetRect.width / 2;\n cy = targetRect.top + targetRect.height / 2;\n updatePosition(cx, cy);\n setPopoverOpen(selectedLegend === '' || selectedLegend === data.legend);\n setValue(data.data!.toString());\n setLegend(data.legend);\n setColor(data.color!);\n setXCalloutValue(data.xAxisCalloutData!);\n setYCalloutValue(data.yAxisCalloutData!);\n setFocusedArcId(id);\n setDataPointCalloutProps(data);\n }\n\n function _hoverCallback(data: ChartDataPoint, e: React.MouseEvent<SVGPathElement>): void {\n if (_calloutAnchorPoint !== data) {\n _calloutAnchorPoint = data;\n setPopoverOpen(selectedLegend === '' || selectedLegend === data.legend);\n setValue(data.data!.toString());\n setLegend(data.legend);\n setColor(data.color!);\n setXCalloutValue(data.xAxisCalloutData!);\n setYCalloutValue(data.yAxisCalloutData!);\n setDataPointCalloutProps(data);\n updatePosition(e.clientX, e.clientY);\n }\n }\n function _onBlur(): void {\n setFocusedArcId('');\n }\n\n function _hoverLeave(): void {\n /**/\n }\n\n function _handleChartMouseLeave() {\n _calloutAnchorPoint = null;\n setPopoverOpen(false);\n }\n\n function _valueInsideDonut(valueInsideDonut: string | number | undefined, data: ChartDataPoint[]) {\n const highlightedLegend = _getHighlightedLegend();\n if (valueInsideDonut !== undefined && (highlightedLegend !== '' || isPopoverOpen)) {\n let legendValue = valueInsideDonut;\n data!.map((point: ChartDataPoint, index: number) => {\n if (point.legend === highlightedLegend || (isPopoverOpen && point.legend === legend)) {\n legendValue = point.yAxisCalloutData ? point.yAxisCalloutData : point.data!;\n }\n return;\n });\n return legendValue;\n } else {\n return valueInsideDonut;\n }\n }\n\n function _toLocaleString(data: string | number | undefined) {\n const localeString = formatToLocaleString(data, props.culture);\n if (!localeString) {\n return data;\n }\n return localeString?.toString();\n }\n\n /**\n * This function returns\n * the selected legend if there is one\n * or the hovered legend if none of the legends is selected.\n * Note: This won't work in case of multiple legends selection.\n */\n function _getHighlightedLegend() {\n return selectedLegend || activeLegend;\n }\n\n function _isChartEmpty(): boolean {\n return !(\n props.data &&\n props.data.chartData &&\n props.data.chartData!.filter((d: ChartDataPoint) => d.data! > 0).length > 0\n );\n }\n\n function _addDefaultColors(donutChartDataPoint?: ChartDataPoint[]): ChartDataPoint[] {\n return donutChartDataPoint\n ? donutChartDataPoint.map((item, index) => {\n let defaultColor: string;\n if (typeof item.color === 'undefined') {\n defaultColor = getNextColor(index, 0);\n } else {\n defaultColor = getColorFromToken(item.color);\n }\n return { ...item, defaultColor };\n })\n : [];\n }\n\n function updatePosition(newX: number, newY: number) {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\n }\n }\n\n /**\n * When screen resizes, along with screen, chart also auto adjusted.\n * This method used to adjust height and width of the charts.\n */\n function _fitParentContainer(): void {\n //_reqID = requestAnimationFrame(() => {\n let legendContainerHeight;\n if (props.hideLegend) {\n // If there is no legend, need not to allocate some space from total chart space.\n legendContainerHeight = 0;\n } else {\n const legendContainerComputedStyles = legendContainer.current && getComputedStyle(legendContainer.current);\n legendContainerHeight =\n ((legendContainer.current && legendContainer.current.getBoundingClientRect().height) ||\n MIN_LEGEND_CONTAINER_HEIGHT) +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginTop) || '0') +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginBottom) || '0');\n }\n if (props.parentRef || _rootElem.current) {\n const container = props.parentRef ? props.parentRef : _rootElem.current!;\n const currentContainerWidth = container.getBoundingClientRect().width;\n const currentContainerHeight =\n container.getBoundingClientRect().height > legendContainerHeight\n ? container.getBoundingClientRect().height\n : 200;\n const shouldResize =\n _width !== currentContainerWidth || _height !== currentContainerHeight - legendContainerHeight;\n if (shouldResize) {\n setWidth(currentContainerWidth);\n setHeight(currentContainerHeight - legendContainerHeight);\n }\n }\n //});\n }\n\n const { data, hideLegend = false } = props;\n const points = _addDefaultColors(data?.chartData);\n\n const classes = useDonutChartStyles(props);\n\n const legendBars = _createLegends(points);\n const donutMarginHorizontal = props.hideLabels ? 0 : 80;\n const donutMarginVertical = props.hideLabels ? 0 : 40;\n const outerRadius = Math.min(_width! - donutMarginHorizontal, _height! - donutMarginVertical) / 2;\n const chartData = _elevateToMinimums(points.filter((d: ChartDataPoint) => d.data! >= 0));\n const valueInsideDonut = props.innerRadius !== 0 ? _valueInsideDonut(props.valueInsideDonut!, chartData!) : '';\n const focusAttributes = useFocusableGroup();\n return !_isChartEmpty() ? (\n <div\n className={classes.root}\n ref={(rootElem: HTMLDivElement | null) => (_rootElem.current = rootElem)}\n onMouseLeave={_handleChartMouseLeave}\n >\n <div className={classes.chartWrapper} {...focusAttributes}>\n <svg className={classes.chart} aria-label={data?.chartTitle} width={_width} height={_height}>\n <Pie\n width={_width!}\n height={_height!}\n outerRadius={outerRadius}\n innerRadius={props.innerRadius!}\n data={chartData!}\n onFocusCallback={_focusCallback}\n hoverOnCallback={_hoverCallback}\n hoverLeaveCallback={_hoverLeave}\n uniqText={_uniqText}\n onBlurCallback={_onBlur}\n activeArc={_getHighlightedLegend()}\n focusedArcId={focusedArcId || ''}\n href={props.href!}\n valueInsideDonut={_toLocaleString(valueInsideDonut)}\n showLabelsInPercent={props.showLabelsInPercent}\n hideLabels={props.hideLabels}\n />\n </svg>\n </div>\n <ChartPopover\n xCalloutValue={xCalloutValue}\n yCalloutValue={yCalloutValue}\n culture={props.culture ?? 'en-us'}\n clickPosition={clickPosition}\n isPopoverOpen={!props.hideTooltip && isPopoverOpen}\n legend={legend!}\n YValue={value!}\n color={color}\n isCalloutForStack={false}\n customCallout={{\n customizedCallout: props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps!)\n : undefined,\n customCalloutProps: props.calloutPropsPerDataPoint\n ? props.calloutPropsPerDataPoint(dataPointCalloutProps!)\n : undefined,\n }}\n isCartesian={false}\n />\n {!hideLegend && (\n <div ref={(e: HTMLDivElement) => (legendContainer.current = e)} className={classes.legendContainer}>\n {legendBars}\n </div>\n )}\n </div>\n ) : (\n <div id={_emptyChartId!} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n },\n);\n\nDonutChart.displayName = 'DonutChart';\nDonutChart.defaultProps = {\n innerRadius: 0,\n hideLabels: true,\n};\n"],"names":["React","Pie","useDonutChartStyles","formatToLocaleString","getColorFromToken","getNextColor","useRtl","Legends","useId","useFocusableGroup","ChartPopover","toImage","MIN_LEGEND_CONTAINER_HEIGHT","DonutChart","forwardRef","props","forwardedRef","_rootElem","useRef","_uniqText","_calloutAnchorPoint","_emptyChartId","legendContainer","prevSize","value","setValue","useState","legend","setLegend","_width","setWidth","width","_height","setHeight","height","activeLegend","setActiveLegend","color","setColor","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","selectedLegend","setSelectedLegend","focusedArcId","setFocusedArcId","dataPointCalloutProps","setDataPointCalloutProps","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","_legendsRef","_isRTL","useEffect","_fitParentContainer","current","useImperativeHandle","componentRef","chartContainer","opts","toSVG","_elevateToMinimums","data","sumOfData","minPercent","elevatedData","forEach","item","push","yAxisCalloutData","undefined","toLocaleString","_createLegends","chartData","legendDataItems","map","point","index","title","action","hoverAction","_handleChartMouseLeave","onMouseOutAction","legends","centerLegends","overflowText","legendsOverflowText","legendProps","legendRef","_focusCallback","id","e","cx","cy","targetRect","target","getBoundingClientRect","left","top","updatePosition","toString","xAxisCalloutData","_hoverCallback","clientX","clientY","_onBlur","_hoverLeave","_valueInsideDonut","valueInsideDonut","highlightedLegend","_getHighlightedLegend","legendValue","_toLocaleString","localeString","culture","_isChartEmpty","filter","d","length","_addDefaultColors","donutChartDataPoint","defaultColor","newX","newY","threshold","distance","Math","sqrt","pow","legendContainerHeight","hideLegend","legendContainerComputedStyles","getComputedStyle","parseFloat","marginTop","marginBottom","parentRef","container","currentContainerWidth","currentContainerHeight","shouldResize","points","classes","legendBars","donutMarginHorizontal","hideLabels","donutMarginVertical","outerRadius","min","innerRadius","focusAttributes","div","className","root","ref","rootElem","onMouseLeave","chartWrapper","svg","chart","aria-label","chartTitle","onFocusCallback","hoverOnCallback","hoverLeaveCallback","uniqText","onBlurCallback","activeArc","href","showLabelsInPercent","hideTooltip","YValue","isCalloutForStack","customCallout","customizedCallout","onRenderCalloutPerDataPoint","customCalloutProps","calloutPropsPerDataPoint","isCartesian","role","style","opacity","displayName","defaultProps"],"mappings":"AAAA,oCAAoC,GACpC,YAAYA,WAAW,QAAQ;AAC/B,SAASC,GAAG,QAAQ,cAAc;AAElC,SAASC,mBAAmB,QAAQ,+BAA+B;AAEnE,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,iBAAiB,EAAEC,YAAY,EAAEC,MAAM,QAAQ,wBAAwB;AAChF,SAAiBC,OAAO,QAAyB,cAAc;AAC/D,SAASC,KAAK,QAAQ,4BAA4B;AAClD,SAASC,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,YAAY,QAAQ,mCAAmC;AAEhE,SAASC,OAAO,QAAQ,qCAAqC;AAE7D,MAAMC,8BAA8B;AAEpC,4FAA4F;AAC5F;;;CAGC,GACD,OAAO,MAAMC,2BAAuDb,MAAMc,UAAU,CAClF,CAACC,OAAOC;IACN,MAAMC,YAAYjB,MAAMkB,MAAM,CAAwB;IACtD,MAAMC,YAAoBX,MAAM;IAChC,qDAAqD,GACrD,IAAIY;IACJ,IAAIC;IACJ,MAAMC,kBAAkBtB,MAAMkB,MAAM,CAAwB;IAC5D,MAAMK,WAAWvB,MAAMkB,MAAM,CAAsC,CAAC;IAEpE,MAAM,CAACM,OAAOC,SAAS,GAAGzB,MAAM0B,QAAQ,CAAqB;IAC7D,MAAM,CAACC,QAAQC,UAAU,GAAG5B,MAAM0B,QAAQ,CAAqB;IAC/D,MAAM,CAACG,QAAQC,SAAS,GAAG9B,MAAM0B,QAAQ,CAAqBX,MAAMgB,KAAK,IAAI;IAC7E,MAAM,CAACC,SAASC,UAAU,GAAGjC,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4BAAAA,iBAAiB;QAC1BkC,eAAeA;QACfI,eAAe,CAACtC,MAAM+J,WAAW,IAAIzH;QACrC1B,QAAQA;QACRoJ,QAAQvJ;QACRa,OAAOA;QACP2I,mBAAmB;QACnBC,eAAe;YACbC,mBAAmBnK,MAAMoK,2BAA2B,GAChDpK,MAAMoK,2BAA2B,CAACpI,yBAClC2B;YACJ0G,oBAAoBrK,MAAMsK,wBAAwB,GAC9CtK,MAAMsK,wBAAwB,CAACtI,yBAC/B2B;QACN;QACA4G,aAAa;QAEd,CAAChD,4BACA,oBAACqB;QAAIG,KAAK,CAAC/D,IAAuBzE,gBAAgBqC,OAAO,GAAGoC;QAAI6D,WAAWV,QAAQ5H,eAAe;OAC/F6H,6BAKP,oBAACQ;QAAI7D,IAAIzE;QAAgBkK,MAAM;QAASC,OAAO;YAAEC,SAAS;QAAI;QAAGrB,cAAY;;AAEjF,GACA;AAEFvJ,WAAW6K,WAAW,GAAG;AACzB7K,WAAW8K,YAAY,GAAG;IACxBlC,aAAa;IACbJ,YAAY;AACd"}
1
+ {"version":3,"sources":["../src/components/DonutChart/DonutChart.tsx"],"sourcesContent":["/* eslint-disable react/jsx-no-bind */\nimport * as React from 'react';\nimport { Pie } from './Pie/index';\nimport { DonutChartProps } from './DonutChart.types';\nimport { useDonutChartStyles } from './useDonutChartStyles.styles';\nimport { ChartDataPoint } from '../../DonutChart';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { getColorFromToken, getNextColor, useRtl } from '../../utilities/index';\nimport { Legend, Legends, LegendContainer } from '../../index';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { ImageExportOptions } from '../../types/index';\nimport { toImage } from '../../utilities/image-export-utils';\n\nconst MIN_LEGEND_CONTAINER_HEIGHT = 40;\n\n// Create a DonutChart variant which uses these default styles and this styled subcomponent.\n/**\n * Donutchart component.\n * {@docCategory DonutChart}\n */\nexport const DonutChart: React.FunctionComponent<DonutChartProps> = React.forwardRef<HTMLDivElement, DonutChartProps>(\n (props, forwardedRef) => {\n const _rootElem = React.useRef<HTMLDivElement | null>(null);\n const _uniqText: string = useId('_Pie_');\n /* eslint-disable @typescript-eslint/no-explicit-any */\n let _calloutAnchorPoint: ChartDataPoint | null;\n let _emptyChartId: string | null;\n const legendContainer = React.useRef<HTMLDivElement | null>(null);\n const prevSize = React.useRef<{ width?: number; height?: number }>({});\n\n const [value, setValue] = React.useState<string | undefined>('');\n const [legend, setLegend] = React.useState<string | undefined>('');\n const [_width, setWidth] = React.useState<number | undefined>(props.width || 200);\n const [_height, setHeight] = React.useState<number | undefined>(props.height || 200);\n const [activeLegend, setActiveLegend] = React.useState<string>('');\n const [color, setColor] = React.useState<string | undefined>('');\n const [xCalloutValue, setXCalloutValue] = React.useState<string>('');\n const [yCalloutValue, setYCalloutValue] = React.useState<string>('');\n const [selectedLegend, setSelectedLegend] = React.useState<string>('');\n const [focusedArcId, setFocusedArcId] = React.useState<string>('');\n const [dataPointCalloutProps, setDataPointCalloutProps] = React.useState<ChartDataPoint | undefined>();\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const _legendsRef = React.useRef<LegendContainer>(null);\n const _isRTL: boolean = useRtl();\n\n React.useEffect(() => {\n _fitParentContainer();\n }, []);\n\n React.useEffect(() => {\n if (prevSize.current.height !== props.height || prevSize.current.width !== props.width) {\n _fitParentContainer();\n }\n prevSize.current.height = props.height;\n prevSize.current.width = props.width;\n }, [props.width, props.height]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: _rootElem.current,\n toImage: (opts?: ImageExportOptions): Promise<string> => {\n return toImage(_rootElem.current, _legendsRef.current?.toSVG, _isRTL, opts);\n },\n }),\n [],\n );\n\n function _elevateToMinimums(data: ChartDataPoint[]) {\n let sumOfData = 0;\n const minPercent = 0.01;\n const elevatedData: ChartDataPoint[] = [];\n data.forEach(item => {\n sumOfData += item.data!;\n });\n data.forEach(item => {\n elevatedData.push(\n minPercent * sumOfData > item.data! && item.data! > 0\n ? {\n ...item,\n data: minPercent * sumOfData,\n yAxisCalloutData:\n item.yAxisCalloutData === undefined ? item.data!.toLocaleString() : item.yAxisCalloutData,\n }\n : item,\n );\n });\n return elevatedData;\n }\n function _createLegends(chartData: ChartDataPoint[]): JSXElement {\n const legendDataItems = chartData.map((point: ChartDataPoint, index: number) => {\n const color: string = point.color!;\n // mapping data to the format Legends component needs\n const legend: Legend = {\n title: point.legend!,\n color,\n action: () => {\n if (selectedLegend === point.legend) {\n setSelectedLegend('');\n } else {\n setSelectedLegend(point.legend!);\n }\n },\n hoverAction: () => {\n _handleChartMouseLeave();\n setActiveLegend(point.legend!);\n },\n onMouseOutAction: () => {\n setActiveLegend('');\n },\n };\n return legend;\n });\n const legends = (\n <Legends\n legends={legendDataItems}\n centerLegends\n overflowText={props.legendsOverflowText}\n {...props.legendProps}\n legendRef={_legendsRef}\n />\n );\n return legends;\n }\n\n function _focusCallback(data: ChartDataPoint, id: string, e: React.FocusEvent<SVGPathElement>): void {\n let cx = 0;\n let cy = 0;\n\n const targetRect = (e.target as SVGPathElement).getBoundingClientRect();\n cx = targetRect.left + targetRect.width / 2;\n cy = targetRect.top + targetRect.height / 2;\n updatePosition(cx, cy);\n setPopoverOpen(selectedLegend === '' || selectedLegend === data.legend);\n setValue(data.data!.toString());\n setLegend(data.legend);\n setColor(data.color!);\n setXCalloutValue(data.xAxisCalloutData!);\n setYCalloutValue(data.yAxisCalloutData!);\n setFocusedArcId(id);\n setDataPointCalloutProps(data);\n }\n\n function _hoverCallback(data: ChartDataPoint, e: React.MouseEvent<SVGPathElement>): void {\n if (_calloutAnchorPoint !== data) {\n _calloutAnchorPoint = data;\n setPopoverOpen(selectedLegend === '' || selectedLegend === data.legend);\n setValue(data.data!.toString());\n setLegend(data.legend);\n setColor(data.color!);\n setXCalloutValue(data.xAxisCalloutData!);\n setYCalloutValue(data.yAxisCalloutData!);\n setDataPointCalloutProps(data);\n updatePosition(e.clientX, e.clientY);\n }\n }\n function _onBlur(): void {\n setFocusedArcId('');\n }\n\n function _hoverLeave(): void {\n /**/\n }\n\n function _handleChartMouseLeave() {\n _calloutAnchorPoint = null;\n setPopoverOpen(false);\n }\n\n function _valueInsideDonut(valueInsideDonut: string | number | undefined, data: ChartDataPoint[]) {\n const highlightedLegend = _getHighlightedLegend();\n if (valueInsideDonut !== undefined && (highlightedLegend !== '' || isPopoverOpen)) {\n let legendValue = valueInsideDonut;\n data!.map((point: ChartDataPoint, index: number) => {\n if (point.legend === highlightedLegend || (isPopoverOpen && point.legend === legend)) {\n legendValue = point.yAxisCalloutData ? point.yAxisCalloutData : point.data!;\n }\n return;\n });\n return legendValue;\n } else {\n return valueInsideDonut;\n }\n }\n\n function _toLocaleString(data: string | number | undefined) {\n const localeString = formatToLocaleString(data, props.culture);\n if (!localeString) {\n return data;\n }\n return localeString?.toString();\n }\n\n /**\n * This function returns\n * the selected legend if there is one\n * or the hovered legend if none of the legends is selected.\n * Note: This won't work in case of multiple legends selection.\n */\n function _getHighlightedLegend() {\n return selectedLegend || activeLegend;\n }\n\n function _isChartEmpty(): boolean {\n return !(\n props.data &&\n props.data.chartData &&\n props.data.chartData!.filter((d: ChartDataPoint) => d.data! > 0).length > 0\n );\n }\n\n function _addDefaultColors(donutChartDataPoint?: ChartDataPoint[]): ChartDataPoint[] {\n return donutChartDataPoint\n ? donutChartDataPoint.map((item, index) => {\n let defaultColor: string;\n if (typeof item.color === 'undefined') {\n defaultColor = getNextColor(index, 0);\n } else {\n defaultColor = getColorFromToken(item.color);\n }\n return { ...item, defaultColor };\n })\n : [];\n }\n\n function updatePosition(newX: number, newY: number) {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\n }\n }\n\n /**\n * When screen resizes, along with screen, chart also auto adjusted.\n * This method used to adjust height and width of the charts.\n */\n function _fitParentContainer(): void {\n //_reqID = requestAnimationFrame(() => {\n let legendContainerHeight;\n if (props.hideLegend) {\n // If there is no legend, need not to allocate some space from total chart space.\n legendContainerHeight = 0;\n } else {\n const legendContainerComputedStyles = legendContainer.current && getComputedStyle(legendContainer.current);\n legendContainerHeight =\n ((legendContainer.current && legendContainer.current.getBoundingClientRect().height) ||\n MIN_LEGEND_CONTAINER_HEIGHT) +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginTop) || '0') +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginBottom) || '0');\n }\n if (props.parentRef || _rootElem.current) {\n const container = props.parentRef ? props.parentRef : _rootElem.current!;\n const currentContainerWidth = container.getBoundingClientRect().width;\n const currentContainerHeight =\n container.getBoundingClientRect().height > legendContainerHeight\n ? container.getBoundingClientRect().height\n : 200;\n const shouldResize =\n _width !== currentContainerWidth || _height !== currentContainerHeight - legendContainerHeight;\n if (shouldResize) {\n setWidth(currentContainerWidth);\n setHeight(currentContainerHeight - legendContainerHeight);\n }\n }\n //});\n }\n\n const { data, hideLegend = false } = props;\n const points = _addDefaultColors(data?.chartData);\n\n const classes = useDonutChartStyles(props);\n\n const legendBars = _createLegends(points);\n const donutMarginHorizontal = props.hideLabels ? 0 : 80;\n const donutMarginVertical = props.hideLabels ? 0 : 40;\n const outerRadius = Math.min(_width! - donutMarginHorizontal, _height! - donutMarginVertical) / 2;\n const chartData = _elevateToMinimums(points.filter((d: ChartDataPoint) => d.data! >= 0));\n const valueInsideDonut = props.innerRadius !== 0 ? _valueInsideDonut(props.valueInsideDonut!, chartData!) : '';\n const focusAttributes = useFocusableGroup();\n return !_isChartEmpty() ? (\n <div\n className={classes.root}\n ref={(rootElem: HTMLDivElement | null) => (_rootElem.current = rootElem)}\n onMouseLeave={_handleChartMouseLeave}\n >\n <div className={classes.chartWrapper} {...focusAttributes}>\n <svg className={classes.chart} aria-label={data?.chartTitle} width={_width} height={_height}>\n <Pie\n width={_width!}\n height={_height!}\n outerRadius={outerRadius}\n innerRadius={props.innerRadius!}\n data={chartData!}\n onFocusCallback={_focusCallback}\n hoverOnCallback={_hoverCallback}\n hoverLeaveCallback={_hoverLeave}\n uniqText={_uniqText}\n onBlurCallback={_onBlur}\n activeArc={_getHighlightedLegend()}\n focusedArcId={focusedArcId || ''}\n href={props.href!}\n valueInsideDonut={_toLocaleString(valueInsideDonut)}\n showLabelsInPercent={props.showLabelsInPercent}\n hideLabels={props.hideLabels}\n />\n </svg>\n </div>\n <ChartPopover\n xCalloutValue={xCalloutValue}\n yCalloutValue={yCalloutValue}\n culture={props.culture ?? 'en-us'}\n clickPosition={clickPosition}\n isPopoverOpen={!props.hideTooltip && isPopoverOpen}\n legend={legend!}\n YValue={value!}\n color={color}\n isCalloutForStack={false}\n customCallout={{\n customizedCallout: props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps!)\n : undefined,\n customCalloutProps: props.calloutPropsPerDataPoint\n ? props.calloutPropsPerDataPoint(dataPointCalloutProps!)\n : undefined,\n }}\n isCartesian={false}\n />\n {!hideLegend && (\n <div ref={(e: HTMLDivElement) => (legendContainer.current = e)} className={classes.legendContainer}>\n {legendBars}\n </div>\n )}\n </div>\n ) : (\n <div id={_emptyChartId!} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n },\n);\n\nDonutChart.displayName = 'DonutChart';\nDonutChart.defaultProps = {\n innerRadius: 0,\n hideLabels: true,\n};\n"],"names":["React","Pie","useDonutChartStyles","formatToLocaleString","getColorFromToken","getNextColor","useRtl","Legends","useId","useFocusableGroup","ChartPopover","toImage","MIN_LEGEND_CONTAINER_HEIGHT","DonutChart","forwardRef","props","forwardedRef","_rootElem","useRef","_uniqText","_calloutAnchorPoint","_emptyChartId","legendContainer","prevSize","value","setValue","useState","legend","setLegend","_width","setWidth","width","_height","setHeight","height","activeLegend","setActiveLegend","color","setColor","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","selectedLegend","setSelectedLegend","focusedArcId","setFocusedArcId","dataPointCalloutProps","setDataPointCalloutProps","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","_legendsRef","_isRTL","useEffect","_fitParentContainer","current","useImperativeHandle","componentRef","chartContainer","opts","toSVG","_elevateToMinimums","data","sumOfData","minPercent","elevatedData","forEach","item","push","yAxisCalloutData","undefined","toLocaleString","_createLegends","chartData","legendDataItems","map","point","index","title","action","hoverAction","_handleChartMouseLeave","onMouseOutAction","legends","centerLegends","overflowText","legendsOverflowText","legendProps","legendRef","_focusCallback","id","e","cx","cy","targetRect","target","getBoundingClientRect","left","top","updatePosition","toString","xAxisCalloutData","_hoverCallback","clientX","clientY","_onBlur","_hoverLeave","_valueInsideDonut","valueInsideDonut","highlightedLegend","_getHighlightedLegend","legendValue","_toLocaleString","localeString","culture","_isChartEmpty","filter","d","length","_addDefaultColors","donutChartDataPoint","defaultColor","newX","newY","threshold","distance","Math","sqrt","pow","legendContainerHeight","hideLegend","legendContainerComputedStyles","getComputedStyle","parseFloat","marginTop","marginBottom","parentRef","container","currentContainerWidth","currentContainerHeight","shouldResize","points","classes","legendBars","donutMarginHorizontal","hideLabels","donutMarginVertical","outerRadius","min","innerRadius","focusAttributes","div","className","root","ref","rootElem","onMouseLeave","chartWrapper","svg","chart","aria-label","chartTitle","onFocusCallback","hoverOnCallback","hoverLeaveCallback","uniqText","onBlurCallback","activeArc","href","showLabelsInPercent","hideTooltip","YValue","isCalloutForStack","customCallout","customizedCallout","onRenderCalloutPerDataPoint","customCalloutProps","calloutPropsPerDataPoint","isCartesian","role","style","opacity","displayName","defaultProps"],"mappings":"AAAA,oCAAoC,GACpC,YAAYA,WAAW,QAAQ;AAC/B,SAASC,GAAG,QAA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,4BACA,oBAACqB;QAAIG,KAAK,CAAC/D,IAAuBzE,gBAAgBqC,OAAO,GAAGoC;QAAI6D,WAAWV,QAAQ5H,eAAe;OAC/F6H,6BAKP,oBAACQ;QAAI7D,IAAIzE;QAAgBkK,MAAM;QAASC,OAAO;YAAEC,SAAS;QAAI;QAAGrB,cAAY;;AAEjF,GACA;AAEFvJ,WAAW6K,WAAW,GAAG;AACzB7K,WAAW8K,YAAY,GAAG;IACxBlC,aAAa;IACbJ,YAAY;AACd"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/DonutChart/DonutChart.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { CartesianChartStyleProps } from '../CommonComponents/index';\nimport { ChartProps, ChartDataPoint, Chart } from './index';\nimport { ChartPopoverProps } from '../CommonComponents/ChartPopover.types';\nimport { LegendsProps } from '../Legends/index';\n\n/**\n * Donut Chart properties.\n * {@docCategory DonutChart}\n */\nexport interface DonutChartProps {\n /**\n * Data to render in the chart.\n */\n data?: ChartProps;\n\n /**\n * inner radius for donut size\n */\n innerRadius?: number;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: DonutChartStyles;\n\n /**\n * props for inside donut value\n */\n valueInsideDonut?: string | number;\n\n /**\n * Define a custom callout renderer for a data point\n */\n onRenderCalloutPerDataPoint?: (dataPointCalloutProps: ChartDataPoint) => JSX.Element | undefined;\n\n /**\n * Define a custom callout props override\n */\n calloutPropsPerDataPoint?: (dataPointCalloutProps: ChartDataPoint) => ChartPopoverProps;\n\n /**\n * props for the callout in the chart\n */\n calloutProps?: ChartPopoverProps;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n\n /**\n * Prop to show the arc labels in percentage format\n * @default false\n */\n showLabelsInPercent?: boolean;\n\n /**\n * Prop to hide the arc labels\n * @default true\n */\n hideLabels?: boolean;\n\n /**\n * Below height used for resizing of the chart\n * Wrap chart in your container and send the updated height and width to these props.\n * These values decide wheather chart re render or not. Please check examples for reference\n */\n height?: number;\n\n /**\n * Below width used for resizing of the chart\n * Wrap chart in your container and send the updated height and width to these props.\n * These values decide wheather chart re render or not. Please check examples for reference\n */\n width?: number;\n\n /**\n * this prop takes its parent as a HTML element to define the width and height of the chart\n */\n parentRef?: HTMLElement | null;\n\n /**\n * Additional CSS class(es) to apply to the Chart.\n */\n className?: string;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n legendsOverflowText?: any;\n\n /*\n * props for the legends in the chart\n */\n legendProps?: Partial<LegendsProps>;\n\n /** decides wether to show/hide legends\n * @defaultvalue false\n */\n hideLegend?: boolean;\n\n /**\n * Url that the data-viz needs to redirect to upon clicking on it\n */\n href?: string;\n\n /**\n * Do not show tooltips in chart\n * @default false\n */\n hideTooltip?: boolean;\n\n /**\n * Optional callback to access the Chart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<Chart>;\n}\n\n/**\n * Donut Chart style properties\n * {@docCategory DonutChart}\n */\nexport interface DonutChartStyleProps extends CartesianChartStyleProps {}\n\n/**\n * Donut Chart styles\n * {@docCategory DonutChart}\n */\nexport interface DonutChartStyles {\n /**\n * Style for the root element.\n */\n root?: string;\n\n /**\n * Style for the chart.\n */\n chart?: string;\n /**\n * Style for the legend container.\n */\n legendContainer: string;\n\n /**\n * Styles for the chart wrapper div\n */\n chartWrapper?: string;\n}\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
1
+ {"version":3,"sources":["../src/components/DonutChart/DonutChart.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { CartesianChartStyleProps } from '../CommonComponents/index';\nimport { ChartProps, ChartDataPoint, Chart } from './index';\nimport { ChartPopoverProps } from '../CommonComponents/ChartPopover.types';\nimport { LegendsProps } from '../Legends/index';\n\n/**\n * Donut Chart properties.\n * {@docCategory DonutChart}\n */\nexport interface DonutChartProps {\n /**\n * Data to render in the chart.\n */\n data?: ChartProps;\n\n /**\n * inner radius for donut size\n */\n innerRadius?: number;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: DonutChartStyles;\n\n /**\n * props for inside donut value\n */\n valueInsideDonut?: string | number;\n\n /**\n * Define a custom callout renderer for a data point\n */\n onRenderCalloutPerDataPoint?: (dataPointCalloutProps: ChartDataPoint) => JSXElement | undefined;\n\n /**\n * Define a custom callout props override\n */\n calloutPropsPerDataPoint?: (dataPointCalloutProps: ChartDataPoint) => ChartPopoverProps;\n\n /**\n * props for the callout in the chart\n */\n calloutProps?: ChartPopoverProps;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n\n /**\n * Prop to show the arc labels in percentage format\n * @default false\n */\n showLabelsInPercent?: boolean;\n\n /**\n * Prop to hide the arc labels\n * @default true\n */\n hideLabels?: boolean;\n\n /**\n * Below height used for resizing of the chart\n * Wrap chart in your container and send the updated height and width to these props.\n * These values decide wheather chart re render or not. Please check examples for reference\n */\n height?: number;\n\n /**\n * Below width used for resizing of the chart\n * Wrap chart in your container and send the updated height and width to these props.\n * These values decide wheather chart re render or not. Please check examples for reference\n */\n width?: number;\n\n /**\n * this prop takes its parent as a HTML element to define the width and height of the chart\n */\n parentRef?: HTMLElement | null;\n\n /**\n * Additional CSS class(es) to apply to the Chart.\n */\n className?: string;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n legendsOverflowText?: any;\n\n /*\n * props for the legends in the chart\n */\n legendProps?: Partial<LegendsProps>;\n\n /** decides wether to show/hide legends\n * @defaultvalue false\n */\n hideLegend?: boolean;\n\n /**\n * Url that the data-viz needs to redirect to upon clicking on it\n */\n href?: string;\n\n /**\n * Do not show tooltips in chart\n * @default false\n */\n hideTooltip?: boolean;\n\n /**\n * Optional callback to access the Chart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<Chart>;\n\n /**\n * Prop to enable the round corners in the chart\n * @default false\n */\n roundCorners?: boolean;\n}\n\n/**\n * Donut Chart style properties\n * {@docCategory DonutChart}\n */\nexport interface DonutChartStyleProps extends CartesianChartStyleProps {}\n\n/**\n * Donut Chart styles\n * {@docCategory DonutChart}\n */\nexport interface DonutChartStyles {\n /**\n * Style for the root element.\n */\n root?: string;\n\n /**\n * Style for the chart.\n */\n chart?: string;\n /**\n * Style for the legend container.\n */\n legendContainer: string;\n\n /**\n * Styles for the chart wrapper div\n */\n chartWrapper?: string;\n}\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/DonutChart/Pie/Pie.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\n/* eslint-disable react/jsx-no-bind */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport { pie as d3Pie } from 'd3-shape';\nimport { PieProps } from './index';\nimport { Arc } from '../Arc/index';\nimport { ChartDataPoint } from '../index';\nimport { usePieStyles } from './usePieStyles.styles';\nimport { wrapTextInsideDonut } from '../../../utilities/index';\nconst TEXT_PADDING: number = 5;\n\n// Create a Pie within Donut Chart variant which uses these default styles and this styled subcomponent.\n/**\n * Pie component within Donut Chart.\n * {@docCategory PieDonutChart}\n */\nexport const Pie: React.FunctionComponent<PieProps> = React.forwardRef<HTMLDivElement, PieProps>(\n (props, forwardedRef) => {\n React.useEffect(() => {\n wrapTextInsideDonut(classes.insideDonutString, props.innerRadius! * 2 - TEXT_PADDING);\n }, []);\n\n let _totalValue: number;\n const classes = usePieStyles(props);\n const pieForFocusRing = d3Pie()\n .sort(null)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .value((d: any) => d.data)\n .padAngle(0);\n\n function _focusCallback(data: ChartDataPoint, id: string, e: React.FocusEvent<SVGPathElement>): void {\n props.onFocusCallback!(data, id, e);\n }\n\n function _hoverCallback(data: ChartDataPoint, e: React.MouseEvent<SVGPathElement>): void {\n props.hoverOnCallback!(data, e);\n }\n\n function _computeTotalValue() {\n let totalValue = 0;\n props.data.forEach((arc: ChartDataPoint) => {\n totalValue += arc.data!;\n });\n return totalValue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function arcGenerator(\n d: any,\n i: number,\n focusData: any,\n href?: string,\n ): // eslint-disable-next-line @typescript-eslint/no-deprecated\n JSX.Element {\n const color = d && d.data && d.data.color;\n return (\n <Arc\n key={i}\n data={d}\n focusData={focusData}\n innerRadius={props.innerRadius}\n outerRadius={props.outerRadius}\n color={color!}\n onFocusCallback={_focusCallback}\n hoverOnCallback={_hoverCallback}\n onBlurCallback={props.onBlurCallback}\n hoverLeaveCallback={props.hoverLeaveCallback}\n uniqText={props.uniqText}\n activeArc={props.activeArc}\n href={href}\n calloutId={props.calloutId}\n valueInsideDonut={props.valueInsideDonut}\n focusedArcId={props.focusedArcId}\n showLabelsInPercent={props.showLabelsInPercent}\n totalValue={_totalValue}\n hideLabels={props.hideLabels}\n />\n );\n }\n\n const { data } = props;\n const focusData = pieForFocusRing(data.map(d => d.data!));\n\n const piechart = d3Pie<ChartDataPoint>()\n .sort(null)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .value((d: any) => d.data)\n .padAngle(0.02)(data);\n const translate = `translate(${props.width / 2}, ${props.height / 2})`;\n\n _totalValue = _computeTotalValue();\n\n return (\n <g transform={translate}>\n {piechart.map((d: any, i: number) => arcGenerator(d, i, focusData[i], props.href))}\n {props.valueInsideDonut && (\n <text y={5} textAnchor=\"middle\" dominantBaseline=\"middle\" className={classes.insideDonutString}>\n {props.valueInsideDonut}\n </text>\n )}\n </g>\n );\n },\n);\nPie.displayName = 'Pie';\n"],"names":["React","pie","d3Pie","Arc","usePieStyles","wrapTextInsideDonut","TEXT_PADDING","Pie","forwardRef","props","forwardedRef","useEffect","classes","insideDonutString","innerRadius","_totalValue","pieForFocusRing","sort","value","d","data","padAngle","_focusCallback","id","e","onFocusCallback","_hoverCallback","hoverOnCallback","_computeTotalValue","totalValue","forEach","arc","arcGenerator","i","focusData","href","color","key","outerRadius","onBlurCallback","hoverLeaveCallback","uniqText","activeArc","calloutId","valueInsideDonut","focusedArcId","showLabelsInPercent","hideLabels","map","piechart","translate","width","height","g","transform","text","y","textAnchor","dominantBaseline","className","displayName"],"mappings":"AAAA,8CAA8C,GAC9C,oCAAoC,GACpC,qDAAqD,GACrD,YAAYA,WAAW,QAAQ;AAC/B,SAASC,OAAOC,KAAK,QAAQ,WAAW;AAExC,SAASC,GAAG,QAAQ,eAAe;AAEnC,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,mBAAmB,QAAQ,2BAA2B;AAC/D,MAAMC,eAAuB;AAE7B,wGAAwG;AACxG;;;CAGC,GACD,OAAO,MAAMC,oBAAyCP,MAAMQ,UAAU,CACpE,CAACC,OAAOC;IACNV,MAAMW,SAAS,CAAC;QACdN,oBAAoBO,QAAQC,iBAAiB,EAAEJ,MAAMK,WAAW,GAAI,IAAIR;IAC1E,GAAG,EAAE;IAEL,IAAIS;IACJ,MAAMH,UAAUR,aAAaK;IAC7B,MAAMO,kBAAkBd,QACrBe,IAAI,CAAC,KACN,8DAA8D;KAC7DC,KAAK,CAAC,CAACC,IAAWA,EAAEC,IAAI,EACxBC,QAAQ,CAAC;IAEZ,SAASC,eAAeF,IAAoB,EAAEG,EAAU,EAAEC,CAAmC;QAC3Ff,MAAMgB,eAAe,CAAEL,MAAMG,IAAIC;IACnC;IAEA,SAASE,eAAeN,IAAoB,EAAEI,CAAmC;QAC/Ef,MAAMkB,eAAe,CAAEP,MAAMI;IAC/B;IAEA,SAASI;QACP,IAAIC,aAAa;QACjBpB,MAAMW,IAAI,CAACU,OAAO,CAAC,CAACC;YAClBF,cAAcE,IAAIX,IAAI;QACxB;QACA,OAAOS;IACT;IAEA,8DAA8D;IAC9D,SAASG,aACPb,CAAM,EACNc,CAAS,EACTC,SAAc,EACdC,IAAa;QAGb,MAAMC,QAAQjB,KAAKA,EAAEC,IAAI,IAAID,EAAEC,IAAI,CAACgB,KAAK;QACzC,qBACE,oBAACj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pie.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\n/* eslint-disable react/jsx-no-bind */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { pie as d3Pie } from 'd3-shape';\nimport { PieProps } from './index';\nimport { Arc } from '../Arc/index';\nimport { ChartDataPoint } from '../index';\nimport { usePieStyles } from './usePieStyles.styles';\nimport { wrapTextInsideDonut } from '../../../utilities/index';\nconst TEXT_PADDING: number = 5;\n\n// Create a Pie within Donut Chart variant which uses these default styles and this styled subcomponent.\n/**\n * Pie component within Donut Chart.\n * {@docCategory PieDonutChart}\n */\nexport const Pie: React.FunctionComponent<PieProps> = React.forwardRef<HTMLDivElement, PieProps>(\n (props, forwardedRef) => {\n React.useEffect(() => {\n wrapTextInsideDonut(classes.insideDonutString, props.innerRadius! * 2 - TEXT_PADDING);\n }, []);\n\n let _totalValue: number;\n const classes = usePieStyles(props);\n const pieForFocusRing = d3Pie()\n .sort(null)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .value((d: any) => d.data)\n .padAngle(0);\n\n function _focusCallback(data: ChartDataPoint, id: string, e: React.FocusEvent<SVGPathElement>): void {\n props.onFocusCallback!(data, id, e);\n }\n\n function _hoverCallback(data: ChartDataPoint, e: React.MouseEvent<SVGPathElement>): void {\n props.hoverOnCallback!(data, e);\n }\n\n function _computeTotalValue() {\n let totalValue = 0;\n props.data.forEach((arc: ChartDataPoint) => {\n totalValue += arc.data!;\n });\n return totalValue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function arcGenerator(\n d: any,\n i: number,\n focusData: any,\n href?: string,\n ): // eslint-disable-next-line @typescript-eslint/no-deprecated\n JSXElement {\n const color = d && d.data && d.data.color;\n return (\n <Arc\n key={i}\n data={d}\n focusData={focusData}\n innerRadius={props.innerRadius}\n outerRadius={props.outerRadius}\n color={color!}\n onFocusCallback={_focusCallback}\n hoverOnCallback={_hoverCallback}\n onBlurCallback={props.onBlurCallback}\n hoverLeaveCallback={props.hoverLeaveCallback}\n uniqText={props.uniqText}\n activeArc={props.activeArc}\n href={href}\n calloutId={props.calloutId}\n valueInsideDonut={props.valueInsideDonut}\n focusedArcId={props.focusedArcId}\n showLabelsInPercent={props.showLabelsInPercent}\n totalValue={_totalValue}\n hideLabels={props.hideLabels}\n />\n );\n }\n\n const { data } = props;\n const focusData = pieForFocusRing(data.map(d => d.data!));\n\n const piechart = d3Pie<ChartDataPoint>()\n .sort(null)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .value((d: any) => d.data)\n .padAngle(0.02)(data);\n const translate = `translate(${props.width / 2}, ${props.height / 2})`;\n\n _totalValue = _computeTotalValue();\n\n return (\n <g transform={translate}>\n {piechart.map((d: any, i: number) => arcGenerator(d, i, focusData[i], props.href))}\n {props.valueInsideDonut && (\n <text y={5} textAnchor=\"middle\" dominantBaseline=\"middle\" className={classes.insideDonutString}>\n {props.valueInsideDonut}\n </text>\n )}\n </g>\n );\n },\n);\nPie.displayName = 'Pie';\n"],"names":["React","pie","d3Pie","Arc","usePieStyles","wrapTextInsideDonut","TEXT_PADDING","Pie","forwardRef","props","forwardedRef","useEffect","classes","insideDonutString","innerRadius","_totalValue","pieForFocusRing","sort","value","d","data","padAngle","_focusCallback","id","e","onFocusCallback","_hoverCallback","hoverOnCallback","_computeTotalValue","totalValue","forEach","arc","arcGenerator","i","focusData","href","color","key","outerRadius","onBlurCallback","hoverLeaveCallback","uniqText","activeArc","calloutId","valueInsideDonut","focusedArcId","showLabelsInPercent","hideLabels","map","piechart","translate","width","height","g","transform","text","y","textAnchor","dominantBaseline","className","displayName"],"mappings":"AAAA,8CAA8C,GAC9C,oCAAoC,GACpC,qDAAqD,GACrD,YAAYA,WAAW,QAAQ;AAE/B,SAASC,OAAOC,KAAK,QAAQ,WAAW;AAExC,SAASC,GAAG,QAAQ,eAAe;AAEnC,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,mB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