@fluentui/react-charting 5.24.26 → 5.24.28

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 (41) hide show
  1. package/CHANGELOG.json +31 -1
  2. package/CHANGELOG.md +20 -2
  3. package/dist/react-charting.d.ts +7 -0
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +1 -0
  7. package/lib/components/DeclarativeChart/DeclarativeChart.js +16 -5
  8. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  9. package/lib/components/DeclarativeChart/PlotlyColorAdapter.d.ts +8 -4
  10. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +70 -19
  11. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  12. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +109 -154
  13. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  14. package/lib/components/DonutChart/DonutChart.base.js +7 -2
  15. package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
  16. package/lib/components/DonutChart/DonutChart.types.d.ts +7 -0
  17. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  18. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +16 -5
  19. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  20. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +8 -4
  21. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +71 -20
  22. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  23. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +109 -154
  24. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  25. package/lib-amd/components/DonutChart/DonutChart.base.js +7 -2
  26. package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
  27. package/lib-amd/components/DonutChart/DonutChart.types.d.ts +7 -0
  28. package/lib-amd/components/DonutChart/DonutChart.types.js.map +1 -1
  29. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +16 -5
  30. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  31. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +8 -4
  32. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +71 -20
  33. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  34. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +109 -154
  35. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  36. package/lib-commonjs/components/DonutChart/DonutChart.base.js +7 -2
  37. package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
  38. package/lib-commonjs/components/DonutChart/DonutChart.types.d.ts +7 -0
  39. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  40. package/package.json +1 -1
  41. package/src/components/DonutChart/DonutChart.types.ts +8 -0
@@ -1 +1 @@
1
- {"version":3,"file":"PlotlyColorAdapter.js","sourceRoot":"../src/","sources":["components/DeclarativeChart/PlotlyColorAdapter.ts"],"names":[],"mappings":";;;AACA,qCAA4C;AAE5C,6DAAgE;AAChE,uDAA2D;AAC3D,iDAAyF;AACzF,qCAAwD;AAQxD,IAAM,uBAAuB,GAAG;IAC9B,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,IAAI;CAChB,CAAC;AAEF,IAAM,iCAAiC,GAAG;IACxC,uBAAc,CAAC,MAAM,EAAE,GAAG;IAC1B,uBAAc,CAAC,OAAO,EAAE,GAAG;IAC3B,uBAAc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G,CAAC,CAAC,CAAA,KAAK,QAAQ,EAC1D,CAAC;QACD,IAAM,KAAK,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,0CAAE,UAAqC,CAAC;QACvE,IAAM,WAAW,GAAG,MAAA,MAAM,CAAC,MAAM,0CAAE,KAAiB,CAAC;QAC/C,IAAA,KAAe;YACnB,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,0CAAE,IAAI,mCAAI,IAAI,CAAC,GAAG,OAAR,IAAI,EAAQ,WAAW,CAAC;YACnD,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,0CAAE,IAAI,mCAAI,IAAI,CAAC,GAAG,OAAR,IAAI,EAAQ,WAAW,CAAC;SACpD,EAHM,MAAI,QAAA,EAAE,MAAI,QAGhB,CAAC;QAEF,oDAAoD;QACpD,IAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,UAAC,EAAK;gBAAJ,GAAG,QAAA;YAAM,OAAA,MAAI,GAAG,GAAG,GAAG,CAAC,MAAI,GAAG,MAAI,CAAC;QAA1B,CAA0B,CAAC,CAAC;QACrE,IAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,CAAC,CAAC,EAAP,CAAO,CAAC,CAAC;QAE/C,OAAO,IAAA,sBAAa,GAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAzBW,QAAA,gBAAgB,oBAyB3B","sourcesContent":["import * as React from 'react';\nimport { color as d3Color } from 'd3-color';\nimport type { PieColors, Color, PlotData, Layout } from '@fluentui/chart-utilities';\nimport { isArrayOrTypedArray } from '@fluentui/chart-utilities';\nimport { areArraysEqual } from '../../utilities/utilities';\nimport { DataVizPalette, getColorFromToken, getNextColor } from '../../utilities/colors';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\n\ntype PlotlyColorway = 'plotly' | 'others';\n\n// The color sequences in plotly express are defined here:\n// https://plotly.com/python/discrete-color/#:~:text=Join%20now.-,Color%20Sequences%20in%20Plotly%20Express,-By%20default%2C%20Plotly\nexport type ColorwayType = 'default' | 'builtin' | 'others' | undefined;\n\nconst DEFAULT_PLOTLY_COLORWAY = [\n '#636efa', //1\n '#ef553b', //2\n '#00cc96', //3\n '#ab63fa', //4\n '#ffa15a', //5\n '#19d3f3', //6\n '#ff6692', //7\n '#b6e880', //8\n '#ff97ff', //9\n '#fecb52', //10\n];\n\nconst PLOTLY_FLUENTVIZ_COLORWAY_MAPPING = [\n DataVizPalette.color1, //1\n DataVizPalette.warning, //2\n DataVizPalette.color8, //3\n DataVizPalette.color4, //4\n DataVizPalette.color7, //5\n DataVizPalette.color6, //6\n DataVizPalette.color2, //7\n DataVizPalette.color5, //8\n DataVizPalette.color9, //9\n DataVizPalette.color10, //10\n];\n\nfunction getPlotlyColorway(colorway: string[] | undefined): PlotlyColorway {\n const isPlotlyColorway =\n isArrayOrTypedArray(colorway) &&\n areArraysEqual(\n colorway?.map(c => c.toLowerCase()),\n DEFAULT_PLOTLY_COLORWAY,\n );\n\n return isPlotlyColorway ? 'plotly' : 'others';\n}\n\nfunction tryMapFluentDataViz(hexColor: string, templateColorway: PlotlyColorway, isDarkTheme?: boolean): string {\n if (templateColorway !== 'plotly') {\n return hexColor;\n }\n const index = DEFAULT_PLOTLY_COLORWAY.indexOf(hexColor.toLowerCase());\n if (index !== -1) {\n return getColorFromToken(PLOTLY_FLUENTVIZ_COLORWAY_MAPPING[index], isDarkTheme);\n }\n return hexColor;\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 let nextColor: string;\n if (colorMap.current.size < PLOTLY_FLUENTVIZ_COLORWAY_MAPPING.length) {\n // Get first 10 colors from plotly-fluentviz colorway mapping\n nextColor = getColorFromToken(PLOTLY_FLUENTVIZ_COLORWAY_MAPPING[colorMap.current.size], isDarkTheme);\n } else {\n nextColor = getNextColor(colorMap.current.size, 0, isDarkTheme);\n }\n colorMap.current.set(legendLabel, nextColor);\n return nextColor;\n }\n\n return colorMap.current.get(legendLabel) as string;\n};\n\nexport const getSchemaColors = (\n colorway: string[] | undefined,\n colors: PieColors | Color | Color[] | string | null | undefined,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): string[] | string | undefined => {\n const hexColors: string[] = [];\n if (!colors) {\n return undefined;\n }\n const templateColorway = getPlotlyColorway(colorway);\n if (isArrayOrTypedArray(colors)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (colors as any[]).forEach((element, index) => {\n const colorString = element?.toString().trim();\n const nextFluentColor = getColor(`Label_${index}`, colorMap, isDarkTheme);\n if (colorString) {\n const parsedColor = d3Color(colorString);\n hexColors.push(\n parsedColor ? tryMapFluentDataViz(parsedColor.formatHex(), templateColorway, isDarkTheme) : nextFluentColor,\n );\n } else {\n hexColors.push(nextFluentColor);\n }\n });\n } else if (typeof colors === 'string') {\n const parsedColor = d3Color(colors);\n return parsedColor\n ? tryMapFluentDataViz(parsedColor.formatHex(), templateColorway, isDarkTheme)\n : getColor('Label_0', colorMap, isDarkTheme);\n }\n return hexColors;\n};\n\nexport const extractColor = (\n colorway: string[] | undefined,\n colorwayType: ColorwayType,\n colors: PieColors | Color | Color[] | string | null | undefined,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): string | string[] | undefined => {\n return colorwayType === 'default' && colors ? getSchemaColors(colorway, colors, colorMap, isDarkTheme) : undefined;\n};\n\nexport const resolveColor = (\n extractedColors: string[] | string | null | undefined,\n index: number,\n legend: string,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): string => {\n let color = '';\n if (extractedColors && isArrayOrTypedArray(extractedColors) && extractedColors.length > 0) {\n color = extractedColors[index % extractedColors.length];\n } else if (typeof extractedColors === 'string') {\n color = extractedColors;\n } else {\n color = getColor(legend, colorMap, isDarkTheme);\n }\n return color;\n};\n\nexport const getOpacity = (series: Partial<PlotData>, index: number): number => {\n return series.marker?.opacity\n ? isArrayOrTypedArray(series.marker?.opacity)\n ? (series.marker?.opacity as number[])[index % (series.marker?.opacity as number[]).length]\n : (series.marker?.opacity as number)\n : series.opacity ?? 1;\n};\n\nexport const createColorScale = (\n layout: Partial<Layout> | undefined,\n series: Partial<PlotData>,\n currentColorScale: ((value: number) => string) | undefined,\n) => {\n if (\n layout?.coloraxis?.colorscale?.length &&\n isArrayOrTypedArray(series.marker?.color) &&\n (series.marker?.color as Color[]).length > 0 &&\n typeof (series.marker?.color as Color[])?.[0] === 'number'\n ) {\n const scale = layout?.coloraxis?.colorscale as Array<[number, string]>;\n const colorValues = series.marker?.color as number[];\n const [dMin, dMax] = [\n layout?.coloraxis?.cmin ?? Math.min(...colorValues),\n layout?.coloraxis?.cmax ?? Math.max(...colorValues),\n ];\n\n // Normalize colorscale domain to actual data domain\n const scaleDomain = scale.map(([pos]) => dMin + pos * (dMax - dMin));\n const scaleColors = scale.map(item => item[1]);\n\n return d3ScaleLinear<string>().domain(scaleDomain).range(scaleColors);\n }\n return currentColorScale;\n};\n"]}
1
+ {"version":3,"file":"PlotlyColorAdapter.js","sourceRoot":"../src/","sources":["components/DeclarativeChart/PlotlyColorAdapter.ts"],"names":[],"mappings":";;;AACA,qCAA4C;AAE5C,6DAAgE;AAChE,uDAA2D;AAC3D,iDAAyF;AACzF,qCAAwD;AAQxD,IAAM,uBAAuB,GAAG;IAC9B,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;I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AEF,oDAAoD;QACpD,IAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,UAAC,EAAK;gBAAJ,GAAG,QAAA;YAAM,OAAA,MAAI,GAAG,GAAG,GAAG,CAAC,MAAI,GAAG,MAAI,CAAC;QAA1B,CAA0B,CAAC,CAAC;QACrE,IAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,CAAC,CAAC,EAAP,CAAO,CAAC,CAAC;QAE/C,OAAO,IAAA,sBAAa,GAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAzBW,QAAA,gBAAgB,oBAyB3B","sourcesContent":["import * as React from 'react';\nimport { color as d3Color } from 'd3-color';\nimport type { PieColors, Color, PlotData, Layout } from '@fluentui/chart-utilities';\nimport { isArrayOrTypedArray } from '@fluentui/chart-utilities';\nimport { areArraysEqual } from '../../utilities/utilities';\nimport { DataVizPalette, getColorFromToken, getNextColor } from '../../utilities/colors';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\n\ntype PlotlyColorway = 'plotly' | 'd3' | 'others';\n\n// The color sequences in plotly express are defined here:\n// https://plotly.com/python/discrete-color/#:~:text=Join%20now.-,Color%20Sequences%20in%20Plotly%20Express,-By%20default%2C%20Plotly\nexport type ColorwayType = 'default' | 'builtin' | 'others' | undefined;\n\nconst DEFAULT_PLOTLY_COLORWAY = [\n '#636efa', //1\n '#ef553b', //2\n '#00cc96', //3\n '#ab63fa', //4\n '#ffa15a', //5\n '#19d3f3', //6\n '#ff6692', //7\n '#b6e880', //8\n '#ff97ff', //9\n '#fecb52', //10\n];\n\n// Default D3 qualitative colorway (Category10), matching Plotly Express px.colors.qualitative.D3\n// Source: https://plotly.com/python/discrete-color/#:~:text=Join%20now.-,Color%20Sequences%20in%20Plotly%20Express,-By%20default%2C%20Plotly\nexport const DEFAULT_D3_COLORWAY = [\n '#1f77b4', //1\n '#ff7f0e', //2\n '#2ca02c', //3\n '#d62728', //4\n '#9467bd', //5\n '#8c564b', //6\n '#e377c2', //7\n '#7f7f7f', //8\n '#bcbd22', //9\n '#17becf', //10\n];\n\nconst PLOTLY_FLUENTVIZ_COLORWAY_MAPPING = [\n DataVizPalette.color1, //1\n DataVizPalette.warning, //2\n DataVizPalette.color8, //3\n DataVizPalette.color4, //4\n DataVizPalette.color7, //5\n DataVizPalette.color6, //6\n DataVizPalette.color2, //7\n DataVizPalette.color5, //8\n DataVizPalette.color9, //9\n DataVizPalette.color10, //10\n];\n\n// Mapping from D3 Category10 order to Fluent DataViz tokens (light/dark handled via getColorFromToken)\n// D3: [blue, orange, green, red, purple, brown, pink, gray, olive, cyan]\nexport const D3_FLUENTVIZ_COLORWAY_MAPPING: string[] = [\n DataVizPalette.color26, // blue -> lightBlue.shade10\n DataVizPalette.warning, // orange -> semantic warning\n DataVizPalette.color5, // green -> lightGreen.primary\n DataVizPalette.error, // red -> semantic error\n DataVizPalette.color4, // purple -> orchid.tint10\n DataVizPalette.color17, // brown -> pumpkin.shade20\n DataVizPalette.color22, // pink -> hotPink.tint20\n DataVizPalette.disabled, // gray -> semantic disabled\n DataVizPalette.color10, // olive/yellow-green -> gold.shade10\n DataVizPalette.color3, // cyan/teal -> teal.tint20\n];\n\nfunction getPlotlyColorway(colorway: string[] | undefined, isDonut: boolean = false): PlotlyColorway {\n if (!colorway || !isArrayOrTypedArray(colorway)) {\n return 'others';\n }\n const lower = colorway.map(c => c.toLowerCase());\n if (isDonut && areArraysEqual(lower, D3_FLUENTVIZ_COLORWAY_MAPPING)) {\n return 'd3';\n }\n if (areArraysEqual(lower, DEFAULT_PLOTLY_COLORWAY)) {\n return 'plotly';\n }\n return 'others';\n}\n\nfunction tryMapFluentDataViz(\n hexColor: string,\n templateColorway: PlotlyColorway,\n isDarkTheme?: boolean,\n isDonut?: boolean,\n): string {\n if (templateColorway !== 'plotly') {\n return hexColor;\n }\n let defaultColorway: string[] = DEFAULT_PLOTLY_COLORWAY;\n let defaultMapping: string[] = PLOTLY_FLUENTVIZ_COLORWAY_MAPPING;\n if (isDonut) {\n defaultColorway = templateColorway === 'plotly' ? DEFAULT_PLOTLY_COLORWAY : DEFAULT_D3_COLORWAY;\n defaultMapping = templateColorway === 'plotly' ? PLOTLY_FLUENTVIZ_COLORWAY_MAPPING : D3_FLUENTVIZ_COLORWAY_MAPPING;\n }\n const idx = defaultColorway.indexOf(hexColor.toLowerCase());\n if (idx !== -1) {\n return getColorFromToken(defaultMapping[idx], !!isDarkTheme);\n }\n return hexColor;\n}\n\nexport const getColor = (\n legendLabel: string,\n colorMap: React.MutableRefObject<Map<string, string>>,\n templateColorway: PlotlyColorway,\n isDarkTheme?: boolean,\n isDonut?: boolean,\n): string => {\n if (!colorMap.current.has(legendLabel)) {\n let nextColor: string;\n const defaultColorMapping = isDonut\n ? templateColorway === 'plotly'\n ? PLOTLY_FLUENTVIZ_COLORWAY_MAPPING\n : D3_FLUENTVIZ_COLORWAY_MAPPING\n : PLOTLY_FLUENTVIZ_COLORWAY_MAPPING;\n if (colorMap.current.size < defaultColorMapping.length) {\n // Get first 10 colors from plotly-fluentviz colorway mapping\n nextColor = getColorFromToken(defaultColorMapping[colorMap.current.size], isDarkTheme);\n } else {\n nextColor = getNextColor(colorMap.current.size, 0, isDarkTheme);\n }\n colorMap.current.set(legendLabel, nextColor);\n return nextColor;\n }\n\n return colorMap.current.get(legendLabel) as string;\n};\n\nexport const getSchemaColors = (\n colorway: string[] | undefined,\n colors: PieColors | Color | Color[] | string | null | undefined,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n isDonut?: boolean,\n): string[] | string | undefined => {\n const hexColors: string[] = [];\n if (!colors) {\n return undefined;\n }\n const templateColorway = getPlotlyColorway(colorway, isDonut);\n if (isArrayOrTypedArray(colors)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (colors as any[]).forEach((element, index) => {\n const colorString = element?.toString().trim();\n const nextFluentColor = getColor(`Label_${index}`, colorMap, templateColorway, isDarkTheme, isDonut);\n if (colorString) {\n const parsedColor = d3Color(colorString);\n hexColors.push(\n parsedColor ? tryMapFluentDataViz(parsedColor.formatHex(), templateColorway, isDarkTheme) : nextFluentColor,\n );\n } else {\n hexColors.push(nextFluentColor);\n }\n });\n } else if (typeof colors === 'string') {\n const parsedColor = d3Color(colors);\n return parsedColor\n ? tryMapFluentDataViz(parsedColor.formatHex(), templateColorway, isDarkTheme)\n : getColor('Label_0', colorMap, templateColorway, isDarkTheme, isDonut);\n }\n return hexColors;\n};\n\nexport const extractColor = (\n colorway: string[] | undefined,\n colorwayType: ColorwayType,\n colors: PieColors | Color | Color[] | string | null | undefined,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n isDonut?: boolean,\n): string | string[] | undefined => {\n return colorwayType === 'default' && colors\n ? getSchemaColors(colorway, colors, colorMap, isDarkTheme, isDonut)\n : undefined;\n};\n\nexport const resolveColor = (\n extractedColors: string[] | string | null | undefined,\n index: number,\n legend: string,\n colorMap: React.MutableRefObject<Map<string, string>>,\n colorway: string[] | undefined,\n isDarkTheme?: boolean,\n isDonut?: boolean,\n): string => {\n let color = '';\n const templateColorway = getPlotlyColorway(colorway, isDonut);\n if (extractedColors && isArrayOrTypedArray(extractedColors) && extractedColors.length > 0) {\n color = extractedColors[index % extractedColors.length];\n } else if (typeof extractedColors === 'string') {\n color = extractedColors;\n } else {\n color = getColor(legend, colorMap, templateColorway, isDarkTheme, isDonut);\n }\n return color;\n};\n\nexport const getOpacity = (series: Partial<PlotData>, index: number): number => {\n return series.marker?.opacity\n ? isArrayOrTypedArray(series.marker?.opacity)\n ? (series.marker?.opacity as number[])[index % (series.marker?.opacity as number[]).length]\n : (series.marker?.opacity as number)\n : series.opacity ?? 1;\n};\n\nexport const createColorScale = (\n layout: Partial<Layout> | undefined,\n series: Partial<PlotData>,\n currentColorScale: ((value: number) => string) | undefined,\n) => {\n if (\n layout?.coloraxis?.colorscale?.length &&\n isArrayOrTypedArray(series.marker?.color) &&\n (series.marker?.color as Color[]).length > 0 &&\n typeof (series.marker?.color as Color[])?.[0] === 'number'\n ) {\n const scale = layout?.coloraxis?.colorscale as Array<[number, string]>;\n const colorValues = series.marker?.color as number[];\n const [dMin, dMax] = [\n layout?.coloraxis?.cmin ?? Math.min(...colorValues),\n layout?.coloraxis?.cmax ?? Math.max(...colorValues),\n ];\n\n // Normalize colorscale domain to actual data domain\n const scaleDomain = scale.map(([pos]) => dMin + pos * (dMax - dMin));\n const scaleColors = scale.map(item => item[1]);\n\n return d3ScaleLinear<string>().domain(scaleDomain).range(scaleColors);\n }\n return currentColorScale;\n};\n"]}
@@ -188,7 +188,7 @@ var getSecondaryYAxisValues = function (data, layout, maxAllowedMinY, minAllowed
188
188
  };
189
189
  var _getGaugeAxisColor = function (colorway, colorwayType, color, colorMap, isDarkTheme) {
190
190
  var extractedColors = (0, PlotlyColorAdapter_1.extractColor)(colorway, colorwayType, color, colorMap, isDarkTheme);
191
- return (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, 0, '', colorMap, isDarkTheme);
191
+ return (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, 0, '', colorMap, colorway, isDarkTheme);
192
192
  };
193
193
  exports._getGaugeAxisColor = _getGaugeAxisColor;
194
194
  var resolveXAxisPoint = function (x, isXYearCategory, isXString, isXDate, isXNumber) {
@@ -336,57 +336,41 @@ var transformPlotlyJsonToDonutProps = function (input, isMultiPlot, colorMap, co
336
336
  // extract colors for each series only once
337
337
  // use piecolorway if available
338
338
  // otherwise, default to colorway from template
339
- var colors = (0, PlotlyColorAdapter_1.extractColor)((_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.piecolorway) !== null && _b !== void 0 ? _b : (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.layout) === null || _e === void 0 ? void 0 : _e.colorway, colorwayType, (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.piecolorway) !== null && _g !== void 0 ? _g : (_h = firstData === null || firstData === void 0 ? void 0 : firstData.marker) === null || _h === void 0 ? void 0 : _h.colors, colorMap, isDarkTheme);
339
+ var colors = (0, PlotlyColorAdapter_1.extractColor)((_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.piecolorway) !== null && _b !== void 0 ? _b : (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.layout) === null || _e === void 0 ? void 0 : _e.colorway, colorwayType, (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.piecolorway) !== null && _g !== void 0 ? _g : (_h = firstData === null || firstData === void 0 ? void 0 : firstData.marker) === null || _h === void 0 ? void 0 : _h.colors, colorMap, isDarkTheme, true);
340
340
  var mapLegendToDataPoint = {};
341
- if (colors) {
342
- (_j = firstData.labels) === null || _j === void 0 ? void 0 : _j.forEach(function (label, index) {
343
- var value = (0, exports.getNumberAtIndexOrDefault)(firstData.values, index);
344
- if ((0, chart_utilities_1.isInvalidValue)(value) || value < 0) {
345
- return;
346
- }
347
- var legend = "".concat(label);
348
- // resolve color for each legend from the extracted colors
349
- var color = (0, PlotlyColorAdapter_1.resolveColor)(colors, index, legend, colorMap, isDarkTheme);
341
+ // clear colorMap for donut chart to reassign colors as the colorMap initially gets assigned by
342
+ // getAllupLegendsProps function without sorting labels by value
343
+ colorMap.current.clear();
344
+ // Sort labels by value descending before mapping
345
+ if (firstData.labels && firstData.values) {
346
+ var markerColors_1 = ((_j = firstData.marker) === null || _j === void 0 ? void 0 : _j.colors) || undefined;
347
+ var hasMarkerColors_1 = Array.isArray(markerColors_1) && markerColors_1.length >= firstData.labels.length;
348
+ var labelValuePairs = firstData.labels.map(function (label, index) { return ({
349
+ label: label,
350
+ value: (0, exports.getNumberAtIndexOrDefault)(firstData.values, index),
351
+ index: index,
352
+ color: hasMarkerColors_1 ? markerColors_1[index] : undefined,
353
+ }); });
354
+ // Filter out invalid values
355
+ var validPairs = labelValuePairs.filter(function (pair) { return !(0, chart_utilities_1.isInvalidValue)(pair.value); });
356
+ // Sort descending by value; when marker colors are present, keep color attached to the label
357
+ validPairs.sort(function (a, b) { return b.value - a.value; });
358
+ validPairs.forEach(function (pair, sortedIdx) {
359
+ var _a, _b, _c, _d, _e, _f;
360
+ var legend = "".concat(pair.label);
361
+ var color = (_a = pair.color) !== null && _a !== void 0 ? _a : (0, PlotlyColorAdapter_1.resolveColor)(colors, sortedIdx, legend, colorMap, (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.piecolorway) !== null && _c !== void 0 ? _c : (_f = (_e = (_d = input.layout) === null || _d === void 0 ? void 0 : _d.template) === null || _e === void 0 ? void 0 : _e.layout) === null || _f === void 0 ? void 0 : _f.colorway, isDarkTheme, true);
350
362
  if (!mapLegendToDataPoint[legend]) {
351
363
  mapLegendToDataPoint[legend] = {
352
364
  legend: legend,
353
- data: value,
365
+ data: pair.value,
354
366
  color: color,
355
367
  };
356
368
  }
357
369
  else {
358
- mapLegendToDataPoint[legend].data += value;
370
+ mapLegendToDataPoint[legend].data += pair.value;
359
371
  }
360
372
  });
361
373
  }
362
- else {
363
- // Sort labels by value descending before mapping
364
- if (firstData.labels && firstData.values) {
365
- var labelValuePairs = firstData.labels.map(function (label, index) { return ({
366
- label: label,
367
- value: (0, exports.getNumberAtIndexOrDefault)(firstData.values, index),
368
- index: index,
369
- }); });
370
- // Filter out invalid values
371
- var validPairs = labelValuePairs.filter(function (pair) { return !(0, chart_utilities_1.isInvalidValue)(pair.value); });
372
- // Sort descending by value
373
- validPairs.sort(function (a, b) { return b.value - a.value; });
374
- validPairs.forEach(function (pair, sortedIdx) {
375
- var legend = "".concat(pair.label);
376
- var color = (0, PlotlyColorAdapter_1.resolveColor)(colors, sortedIdx, legend, colorMap, isDarkTheme);
377
- if (!mapLegendToDataPoint[legend]) {
378
- mapLegendToDataPoint[legend] = {
379
- legend: legend,
380
- data: pair.value,
381
- color: color,
382
- };
383
- }
384
- else {
385
- mapLegendToDataPoint[legend].data += pair.value;
386
- }
387
- });
388
- }
389
- }
390
374
  var width = (_l = (_k = input.layout) === null || _k === void 0 ? void 0 : _k.width) !== null && _l !== void 0 ? _l : 440;
391
375
  var height = (_o = (_m = input.layout) === null || _m === void 0 ? void 0 : _m.height) !== null && _o !== void 0 ? _o : 220;
392
376
  var hideLabels = firstData.textinfo
@@ -398,10 +382,23 @@ var transformPlotlyJsonToDonutProps = function (input, isMultiPlot, colorMap, co
398
382
  ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2)
399
383
  : utilities_1.MIN_DONUT_RADIUS;
400
384
  var chartTitle = getTitles(input.layout).chartTitle;
385
+ // Build anticlockwise order by keeping the first item, reversing the rest
386
+ var legends = Object.keys(mapLegendToDataPoint);
387
+ var reorderedEntries = legends.length > 1
388
+ ? tslib_1.__spreadArray([
389
+ [legends[0], mapLegendToDataPoint[legends[0]]]
390
+ ], legends
391
+ .slice(1)
392
+ .reverse()
393
+ .map(function (key) { return [key, mapLegendToDataPoint[key]]; }), true)
394
+ : legends.map(function (key) { return [key, mapLegendToDataPoint[key]]; });
401
395
  return {
402
396
  data: {
403
397
  chartTitle: chartTitle,
404
- chartData: Object.values(mapLegendToDataPoint),
398
+ chartData: reorderedEntries.map(function (_a) {
399
+ var v = _a[1];
400
+ return v;
401
+ }),
405
402
  },
406
403
  hideLegend: isMultiPlot || ((_p = input.layout) === null || _p === void 0 ? void 0 : _p.showlegend) === false,
407
404
  width: (_q = input.layout) === null || _q === void 0 ? void 0 : _q.width,
@@ -410,6 +407,7 @@ var transformPlotlyJsonToDonutProps = function (input, isMultiPlot, colorMap, co
410
407
  hideLabels: hideLabels,
411
408
  showLabelsInPercent: firstData.textinfo ? ['percent', 'label+percent'].includes(firstData.textinfo) : true,
412
409
  roundCorners: true,
410
+ order: 'sorted',
413
411
  };
414
412
  };
415
413
  exports.transformPlotlyJsonToDonutProps = transformPlotlyJsonToDonutProps;
@@ -440,7 +438,7 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
440
438
  var rangeXValues = series.x.slice(rangeStart, rangeEnd);
441
439
  var rangeYValues = series.y.slice(rangeStart, rangeEnd);
442
440
  rangeXValues.forEach(function (x, index2) {
443
- var _a, _b, _c, _d, _e, _f;
441
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
444
442
  if (!mapXToDataPoints[x]) {
445
443
  mapXToDataPoints[x] = {
446
444
  xAxisPoint: (0, exports.resolveXAxisPoint)(x, isXYearCategory, isXString, isXDate, isXNumber),
@@ -454,7 +452,7 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
454
452
  ? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
455
453
  ? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[index2 % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
456
454
  : 0)
457
- : (0, PlotlyColorAdapter_1.resolveColor)(extractedBarColors, index2, legend, colorMap, isDarkTheme);
455
+ : (0, PlotlyColorAdapter_1.resolveColor)(extractedBarColors, index2, legend, colorMap, (_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, isDarkTheme);
458
456
  var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index2);
459
457
  var yVal = rangeYValues[index2];
460
458
  var yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
@@ -462,7 +460,7 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
462
460
  mapXToDataPoints[x].chartData.push({
463
461
  legend: legend,
464
462
  data: yVal,
465
- color: (_e = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _e !== void 0 ? _e : color,
463
+ color: (_h = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _h !== void 0 ? _h : color,
466
464
  yAxisCalloutData: yAxisCalloutData,
467
465
  });
468
466
  if (typeof yVal === 'number') {
@@ -470,14 +468,14 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
470
468
  }
471
469
  }
472
470
  else if (series.type === 'scatter' || !!fallbackVSBC) {
473
- var lineColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedLineColors, index1, legend, colorMap, isDarkTheme);
471
+ var lineColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedLineColors, index1, legend, colorMap, (_l = (_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.template) === null || _k === void 0 ? void 0 : _k.layout) === null || _l === void 0 ? void 0 : _l.colorway, isDarkTheme);
474
472
  var lineOptions = getLineOptions(series.line);
475
473
  var legendShape = getLegendShape(series);
476
474
  mapXToDataPoints[x].lineData.push({
477
475
  legend: legend + (validXYRanges.length > 1 ? ".".concat(rangeIdx + 1) : ''),
478
476
  legendShape: legendShape,
479
477
  y: yVal,
480
- color: (_f = (0, d3_color_1.rgb)(lineColor).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
478
+ color: (_m = (0, d3_color_1.rgb)(lineColor).copy({ opacity: opacity }).formatHex8()) !== null && _m !== void 0 ? _m : color,
481
479
  lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
482
480
  useSecondaryYScale: usesSecondaryYScale(series, input.layout),
483
481
  yAxisCalloutData: yAxisCalloutData,
@@ -528,7 +526,7 @@ var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, col
528
526
  // extract colors for each series only once
529
527
  var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_c = (_b = (_a = processedInput.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
530
528
  (_e = series.x) === null || _e === void 0 ? void 0 : _e.forEach(function (x, xIndex) {
531
- var _a, _b, _c, _d, _e, _f;
529
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
532
530
  if ((0, chart_utilities_1.isInvalidValue)(x) || (0, chart_utilities_1.isInvalidValue)((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
533
531
  return;
534
532
  }
@@ -542,14 +540,14 @@ var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, col
542
540
  ? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
543
541
  ? (_d = (_c = series.marker) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d[xIndex % ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length]
544
542
  : 0)
545
- : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, xIndex, legend, colorMap, isDarkTheme);
543
+ : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, xIndex, legend, colorMap, (_h = (_g = (_f = processedInput.layout) === null || _f === void 0 ? void 0 : _f.template) === null || _g === void 0 ? void 0 : _g.layout) === null || _h === void 0 ? void 0 : _h.colorway, isDarkTheme);
546
544
  var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, xIndex);
547
545
  var yVal = series.y[xIndex];
548
546
  mapXToDataPoints[x].series.push({
549
547
  key: legend,
550
548
  data: yVal,
551
549
  xAxisCalloutData: x,
552
- color: (_f = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
550
+ color: (_j = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color,
553
551
  legend: legend,
554
552
  useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout),
555
553
  yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
@@ -602,17 +600,17 @@ var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colo
602
600
  return yVal;
603
601
  });
604
602
  xBins.forEach(function (bin, index) {
605
- var _a, _b, _c, _d, _e;
603
+ var _a, _b, _c, _d, _e, _f, _g, _h;
606
604
  var legend = legends[seriesIdx];
607
605
  // resolve color for each legend's bars from the colorscale or extracted colors
608
606
  var color = colorScale
609
607
  ? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
610
608
  ? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[index % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
611
609
  : 0)
612
- : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
610
+ : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, (_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, isDarkTheme);
613
611
  var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
614
612
  var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
615
- vbcData.push(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: (_e = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _e !== void 0 ? _e : color }, (isXString
613
+ vbcData.push(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: (_h = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _h !== void 0 ? _h : color }, (isXString
616
614
  ? {}
617
615
  : { xAxisCalloutData: "[".concat(bin.x0, " - ").concat(bin.x1, ")") })));
618
616
  });
@@ -652,7 +650,7 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
652
650
  var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
653
651
  var chartData = input.data
654
652
  .map(function (series, index) {
655
- var _a, _b, _c, _d, _e, _f, _g, _h;
653
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
656
654
  var colors = isScatterMarkers
657
655
  ? ((_a = series === null || series === void 0 ? void 0 : series.mode) === null || _a === void 0 ? void 0 : _a.includes('line'))
658
656
  ? (_b = series.line) === null || _b === void 0 ? void 0 : _b.color
@@ -667,11 +665,11 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
667
665
  var isXYearCategory = (0, chart_utilities_1.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
668
666
  var legend = legends[index];
669
667
  // resolve color for each legend's lines from the extracted colors
670
- var seriesColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
668
+ var seriesColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, (_k = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.layout) === null || _k === void 0 ? void 0 : _k.colorway, isDarkTheme);
671
669
  var seriesOpacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
672
670
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
673
671
  // if mode contains 'text', we prioritize showing the text over curving the line
674
- var lineOptions = !((_h = series.mode) === null || _h === void 0 ? void 0 : _h.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
672
+ var lineOptions = !((_l = series.mode) === null || _l === void 0 ? void 0 : _l.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
675
673
  var legendShape = getLegendShape(series);
676
674
  var validXYRanges = (0, exports.getValidXYRanges)(series);
677
675
  return validXYRanges.map(function (_a, rangeIdx) {
@@ -745,7 +743,7 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPl
745
743
  var legend = legends[index];
746
744
  return series.y
747
745
  .map(function (yValue, i) {
748
- var _a, _b, _c, _d, _e, _f;
746
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
749
747
  if ((0, chart_utilities_1.isInvalidValue)((_a = series.x) === null || _a === void 0 ? void 0 : _a[i]) || (0, chart_utilities_1.isInvalidValue)(yValue)) {
750
748
  return null;
751
749
  }
@@ -754,13 +752,13 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPl
754
752
  ? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
755
753
  ? (_d = (_c = series.marker) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d[i % ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length]
756
754
  : 0)
757
- : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
755
+ : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, (_h = (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.template) === null || _g === void 0 ? void 0 : _g.layout) === null || _h === void 0 ? void 0 : _h.colorway, isDarkTheme);
758
756
  var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
759
757
  return {
760
758
  x: series.x[i],
761
759
  y: yValue,
762
760
  legend: legend,
763
- color: (_f = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
761
+ color: (_j = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color,
764
762
  };
765
763
  })
766
764
  .filter(function (point) { return point !== null; });
@@ -797,7 +795,7 @@ var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot, colorMa
797
795
  };
798
796
  return series.y
799
797
  .map(function (yVal, i) {
800
- var _a, _b, _c, _d, _e, _f, _g;
798
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
801
799
  if ((0, chart_utilities_1.isInvalidValue)(yVal)) {
802
800
  return null;
803
801
  }
@@ -806,10 +804,10 @@ var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot, colorMa
806
804
  ? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
807
805
  ? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[i % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
808
806
  : 0)
809
- : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
807
+ : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, (_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, isDarkTheme);
810
808
  var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
811
- var base = convertXValueToNumber((_e = series.base) === null || _e === void 0 ? void 0 : _e[i]);
812
- var xVal = convertXValueToNumber((_f = series.x) === null || _f === void 0 ? void 0 : _f[i]);
809
+ var base = convertXValueToNumber((_h = series.base) === null || _h === void 0 ? void 0 : _h[i]);
810
+ var xVal = convertXValueToNumber((_j = series.x) === null || _j === void 0 ? void 0 : _j[i]);
813
811
  return {
814
812
  x: {
815
813
  start: isXDate ? new Date(base) : base,
@@ -817,7 +815,7 @@ var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot, colorMa
817
815
  },
818
816
  y: yVal,
819
817
  legend: legend,
820
- color: (_g = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _g !== void 0 ? _g : color,
818
+ color: (_k = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _k !== void 0 ? _k : color,
821
819
  };
822
820
  })
823
821
  .filter(function (point) { return point !== null; });
@@ -961,7 +959,8 @@ var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot, colorMap, c
961
959
  var extractedNodeColors = (0, PlotlyColorAdapter_1.extractColor)((_d = (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.template) === null || _c === void 0 ? void 0 : _c.layout) === null || _d === void 0 ? void 0 : _d.colorway, colorwayType, node === null || node === void 0 ? void 0 : node.color, colorMap, isDarkTheme);
962
960
  var sankeyChartData = {
963
961
  nodes: (_e = node.label) === null || _e === void 0 ? void 0 : _e.map(function (label, index) {
964
- var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedNodeColors, index, label, colorMap, isDarkTheme);
962
+ var _a, _b, _c;
963
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedNodeColors, index, label, colorMap, (_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, isDarkTheme);
965
964
  return {
966
965
  nodeId: index,
967
966
  name: label,
@@ -990,19 +989,19 @@ var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot, colorMap, c
990
989
  };
991
990
  exports.transformPlotlyJsonToSankeyProps = transformPlotlyJsonToSankeyProps;
992
991
  var transformPlotlyJsonToGaugeProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
993
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25;
992
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31;
994
993
  var firstData = input.data[0];
995
994
  var stepsColors = ((_a = firstData.gauge) === null || _a === void 0 ? void 0 : _a.steps) ? firstData.gauge.steps.map(function (step) { return step.color; }) : undefined;
996
995
  var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_d = (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.template) === null || _c === void 0 ? void 0 : _c.layout) === null || _d === void 0 ? void 0 : _d.colorway, colorwayType, stepsColors, colorMap, isDarkTheme);
997
996
  var segments = ((_f = (_e = firstData.gauge) === null || _e === void 0 ? void 0 : _e.steps) === null || _f === void 0 ? void 0 : _f.length)
998
997
  ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
999
998
  firstData.gauge.steps.map(function (step, index) {
1000
- var _a, _b;
999
+ var _a, _b, _c, _d, _e;
1001
1000
  var legend = step.name || "Segment ".concat(index + 1);
1002
- var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
1001
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, (_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, isDarkTheme);
1003
1002
  return {
1004
1003
  legend: legend,
1005
- size: ((_a = step.range) === null || _a === void 0 ? void 0 : _a[1]) - ((_b = step.range) === null || _b === void 0 ? void 0 : _b[0]),
1004
+ size: ((_d = step.range) === null || _d === void 0 ? void 0 : _d[1]) - ((_e = step.range) === null || _e === void 0 ? void 0 : _e[0]),
1006
1005
  color: color,
1007
1006
  };
1008
1007
  })
@@ -1025,13 +1024,13 @@ var transformPlotlyJsonToGaugeProps = function (input, isMultiPlot, colorMap, co
1025
1024
  if (diff >= 0) {
1026
1025
  sublabel = "\u25B2 ".concat(diff);
1027
1026
  var extractedIncreasingDeltaColors = (0, PlotlyColorAdapter_1.extractColor)((_0 = (_z = (_y = input.layout) === null || _y === void 0 ? void 0 : _y.template) === null || _z === void 0 ? void 0 : _z.layout) === null || _0 === void 0 ? void 0 : _0.colorway, colorwayType, (_2 = (_1 = firstData.delta) === null || _1 === void 0 ? void 0 : _1.increasing) === null || _2 === void 0 ? void 0 : _2.color, colorMap, isDarkTheme);
1028
- var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedIncreasingDeltaColors, 0, '', colorMap, isDarkTheme);
1027
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedIncreasingDeltaColors, 0, '', colorMap, (_5 = (_4 = (_3 = input.layout) === null || _3 === void 0 ? void 0 : _3.template) === null || _4 === void 0 ? void 0 : _4.layout) === null || _5 === void 0 ? void 0 : _5.colorway, isDarkTheme);
1029
1028
  sublabelColor = color;
1030
1029
  }
1031
1030
  else {
1032
1031
  sublabel = "\u25BC ".concat(Math.abs(diff));
1033
- var extractedDecreasingDeltaColors = (0, PlotlyColorAdapter_1.extractColor)((_5 = (_4 = (_3 = input.layout) === null || _3 === void 0 ? void 0 : _3.template) === null || _4 === void 0 ? void 0 : _4.layout) === null || _5 === void 0 ? void 0 : _5.colorway, colorwayType, (_7 = (_6 = firstData.delta) === null || _6 === void 0 ? void 0 : _6.decreasing) === null || _7 === void 0 ? void 0 : _7.color, colorMap, isDarkTheme);
1034
- var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedDecreasingDeltaColors, 0, '', colorMap, isDarkTheme);
1032
+ var extractedDecreasingDeltaColors = (0, PlotlyColorAdapter_1.extractColor)((_8 = (_7 = (_6 = input.layout) === null || _6 === void 0 ? void 0 : _6.template) === null || _7 === void 0 ? void 0 : _7.layout) === null || _8 === void 0 ? void 0 : _8.colorway, colorwayType, (_10 = (_9 = firstData.delta) === null || _9 === void 0 ? void 0 : _9.decreasing) === null || _10 === void 0 ? void 0 : _10.color, colorMap, isDarkTheme);
1033
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedDecreasingDeltaColors, 0, '', colorMap, (_13 = (_12 = (_11 = input.layout) === null || _11 === void 0 ? void 0 : _11.template) === null || _12 === void 0 ? void 0 : _12.layout) === null || _13 === void 0 ? void 0 : _13.colorway, isDarkTheme);
1035
1034
  sublabelColor = color;
1036
1035
  }
1037
1036
  }
@@ -1043,17 +1042,17 @@ var transformPlotlyJsonToGaugeProps = function (input, isMultiPlot, colorMap, co
1043
1042
  var chartTitle = getTitles(input.layout).chartTitle;
1044
1043
  return {
1045
1044
  segments: segments,
1046
- chartValue: (_8 = firstData.value) !== null && _8 !== void 0 ? _8 : 0,
1045
+ chartValue: (_14 = firstData.value) !== null && _14 !== void 0 ? _14 : 0,
1047
1046
  chartTitle: chartTitle,
1048
1047
  sublabel: sublabel,
1049
1048
  // range values can be null
1050
- minValue: typeof ((_11 = (_10 = (_9 = firstData.gauge) === null || _9 === void 0 ? void 0 : _9.axis) === null || _10 === void 0 ? void 0 : _10.range) === null || _11 === void 0 ? void 0 : _11[0]) === 'number' ? (_14 = (_13 = (_12 = firstData.gauge) === null || _12 === void 0 ? void 0 : _12.axis) === null || _13 === void 0 ? void 0 : _13.range) === null || _14 === void 0 ? void 0 : _14[0] : undefined,
1051
- maxValue: typeof ((_17 = (_16 = (_15 = firstData.gauge) === null || _15 === void 0 ? void 0 : _15.axis) === null || _16 === void 0 ? void 0 : _16.range) === null || _17 === void 0 ? void 0 : _17[1]) === 'number' ? (_20 = (_19 = (_18 = firstData.gauge) === null || _18 === void 0 ? void 0 : _18.axis) === null || _19 === void 0 ? void 0 : _19.range) === null || _20 === void 0 ? void 0 : _20[1] : undefined,
1049
+ minValue: typeof ((_17 = (_16 = (_15 = firstData.gauge) === null || _15 === void 0 ? void 0 : _15.axis) === null || _16 === void 0 ? void 0 : _16.range) === null || _17 === void 0 ? void 0 : _17[0]) === 'number' ? (_20 = (_19 = (_18 = firstData.gauge) === null || _18 === void 0 ? void 0 : _18.axis) === null || _19 === void 0 ? void 0 : _19.range) === null || _20 === void 0 ? void 0 : _20[0] : undefined,
1050
+ maxValue: typeof ((_23 = (_22 = (_21 = firstData.gauge) === null || _21 === void 0 ? void 0 : _21.axis) === null || _22 === void 0 ? void 0 : _22.range) === null || _23 === void 0 ? void 0 : _23[1]) === 'number' ? (_26 = (_25 = (_24 = firstData.gauge) === null || _24 === void 0 ? void 0 : _24.axis) === null || _25 === void 0 ? void 0 : _25.range) === null || _26 === void 0 ? void 0 : _26[1] : undefined,
1052
1051
  chartValueFormat: function () { var _a, _b; return (_b = (_a = firstData.value) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''; },
1053
- width: (_21 = input.layout) === null || _21 === void 0 ? void 0 : _21.width,
1054
- height: (_23 = (_22 = input.layout) === null || _22 === void 0 ? void 0 : _22.height) !== null && _23 !== void 0 ? _23 : 220,
1052
+ width: (_27 = input.layout) === null || _27 === void 0 ? void 0 : _27.width,
1053
+ height: (_29 = (_28 = input.layout) === null || _28 === void 0 ? void 0 : _28.height) !== null && _29 !== void 0 ? _29 : 220,
1055
1054
  styles: styles,
1056
- variant: ((_25 = (_24 = firstData.gauge) === null || _24 === void 0 ? void 0 : _24.steps) === null || _25 === void 0 ? void 0 : _25.length) ? index_1.GaugeChartVariant.MultipleSegments : index_1.GaugeChartVariant.SingleSegment,
1055
+ variant: ((_31 = (_30 = firstData.gauge) === null || _30 === void 0 ? void 0 : _30.steps) === null || _31 === void 0 ? void 0 : _31.length) ? index_1.GaugeChartVariant.MultipleSegments : index_1.GaugeChartVariant.SingleSegment,
1057
1056
  roundCorners: true,
1058
1057
  };
1059
1058
  };
@@ -1089,6 +1088,17 @@ var formatValue = function (value, colIndex, cells) {
1089
1088
  }
1090
1089
  return "".concat(prefix !== null && prefix !== void 0 ? prefix : '').concat(formatted).concat(suffix !== null && suffix !== void 0 ? suffix : '');
1091
1090
  };
1091
+ function resolveCellStyle(raw, rowIndex, colIndex) {
1092
+ var _a, _b;
1093
+ if (Array.isArray(raw)) {
1094
+ var rowEntry = (_a = raw[colIndex]) !== null && _a !== void 0 ? _a : raw[0];
1095
+ if (Array.isArray(rowEntry)) {
1096
+ return (_b = rowEntry[rowIndex]) !== null && _b !== void 0 ? _b : rowEntry[0];
1097
+ }
1098
+ return rowEntry;
1099
+ }
1100
+ return raw;
1101
+ }
1092
1102
  var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
1093
1103
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
1094
1104
  var tableData = input.data[0];
@@ -1102,41 +1112,13 @@ var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot, colorMa
1102
1112
  })
1103
1113
  : values.map(function (cell) { return cleanText(cell); });
1104
1114
  return cleanedValues.map(function (value, colIndex) {
1105
- var _a, _b, _c, _d, _e, _f, _g, _h;
1106
- var fontColorRaw = (_a = header === null || header === void 0 ? void 0 : header.font) === null || _a === void 0 ? void 0 : _a.color;
1107
- var fontColor;
1108
- if (Array.isArray(fontColorRaw)) {
1109
- var colorEntry = (_b = fontColorRaw[colIndex]) !== null && _b !== void 0 ? _b : fontColorRaw[0];
1110
- if (Array.isArray(colorEntry)) {
1111
- fontColor = typeof colorEntry[0] === 'string' ? colorEntry[0] : undefined;
1112
- }
1113
- else if (typeof colorEntry === 'string') {
1114
- fontColor = colorEntry;
1115
- }
1116
- }
1117
- else if (typeof fontColorRaw === 'string') {
1118
- fontColor = fontColorRaw;
1119
- }
1120
- var fontSizeRaw = (_c = header === null || header === void 0 ? void 0 : header.font) === null || _c === void 0 ? void 0 : _c.size;
1121
- var fontSize;
1122
- if (Array.isArray(fontSizeRaw)) {
1123
- var fontSizeEntry = (_d = fontSizeRaw[colIndex]) !== null && _d !== void 0 ? _d : fontSizeRaw[0];
1124
- fontSize = Array.isArray(fontSizeRaw[0])
1125
- ? (_e = fontSizeRaw[0][colIndex]) !== null && _e !== void 0 ? _e : fontSizeRaw[0][0]
1126
- : typeof fontSizeEntry === 'number'
1127
- ? fontSizeEntry
1128
- : undefined;
1129
- }
1130
- else if (typeof fontSizeRaw === 'number') {
1131
- fontSize = fontSizeRaw;
1132
- }
1133
- var updatedColIndex = colIndex >= 1 ? 1 : 0;
1134
- var fillColorRaw = (_f = header === null || header === void 0 ? void 0 : header.fill) === null || _f === void 0 ? void 0 : _f.color;
1135
- var backgroundColor = Array.isArray(fillColorRaw)
1136
- ? (_g = fillColorRaw[updatedColIndex]) !== null && _g !== void 0 ? _g : fillColorRaw[0]
1137
- : fillColorRaw;
1138
- var textAlignRaw = header === null || header === void 0 ? void 0 : header.align;
1139
- var textAlign = Array.isArray(textAlignRaw) ? (_h = textAlignRaw[colIndex]) !== null && _h !== void 0 ? _h : textAlignRaw[0] : textAlignRaw;
1115
+ var _a, _b, _c;
1116
+ //headers are at first row only
1117
+ var rowIndex = 0;
1118
+ var fontColor = resolveCellStyle((_a = header === null || header === void 0 ? void 0 : header.font) === null || _a === void 0 ? void 0 : _a.color, rowIndex, colIndex);
1119
+ var fontSize = resolveCellStyle((_b = header === null || header === void 0 ? void 0 : header.font) === null || _b === void 0 ? void 0 : _b.size, rowIndex, colIndex);
1120
+ var backgroundColor = resolveCellStyle((_c = header === null || header === void 0 ? void 0 : header.fill) === null || _c === void 0 ? void 0 : _c.color, rowIndex, colIndex);
1121
+ var textAlign = resolveCellStyle(header === null || header === void 0 ? void 0 : header.align, rowIndex, colIndex);
1140
1122
  var style = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, (typeof fontColor === 'string' ? { color: fontColor } : {})), (typeof fontSize === 'number' ? { fontSize: fontSize } : {})), (typeof backgroundColor === 'string' ? { backgroundColor: backgroundColor } : {})), (textAlign ? { textAlign: textAlign } : {}));
1141
1123
  return { value: value, style: style };
1142
1124
  });
@@ -1147,45 +1129,16 @@ var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot, colorMa
1147
1129
  : (_g = (_f = (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.table) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.cells;
1148
1130
  var rows = columns[0].map(function (_, rowIndex) {
1149
1131
  return columns.map(function (col, colIndex) {
1150
- var _a, _b, _c, _d, _e, _f, _g;
1132
+ var _a, _b, _c;
1151
1133
  var cellValue = col[rowIndex];
1152
1134
  var cleanValue = typeof cellValue === 'string' ? cleanText(cellValue) : cellValue;
1153
1135
  var formattedValue = typeof cleanValue === 'string' || typeof cleanValue === 'number'
1154
1136
  ? formatValue(cleanValue, colIndex, cells)
1155
1137
  : cleanValue;
1156
- var rawFontColor = (_a = cells === null || cells === void 0 ? void 0 : cells.font) === null || _a === void 0 ? void 0 : _a.color;
1157
- var fontColor;
1158
- if (Array.isArray(rawFontColor)) {
1159
- var entry = (_b = rawFontColor[colIndex]) !== null && _b !== void 0 ? _b : rawFontColor[0];
1160
- var colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
1161
- fontColor = typeof colorValue === 'string' ? colorValue : undefined;
1162
- }
1163
- else if (typeof rawFontColor === 'string') {
1164
- fontColor = rawFontColor;
1165
- }
1166
- var rawFontSize = (_c = cells === null || cells === void 0 ? void 0 : cells.font) === null || _c === void 0 ? void 0 : _c.size;
1167
- var fontSize;
1168
- if (Array.isArray(rawFontSize)) {
1169
- var entry = (_d = rawFontSize[colIndex]) !== null && _d !== void 0 ? _d : rawFontSize[0];
1170
- var fontSizeValue = Array.isArray(entry) ? entry[rowIndex] : entry;
1171
- fontSize = typeof fontSizeValue === 'number' ? fontSizeValue : undefined;
1172
- }
1173
- else if (typeof rawFontSize === 'number') {
1174
- fontSize = rawFontSize;
1175
- }
1176
- var updatedColIndex = colIndex >= 1 ? 1 : 0;
1177
- var rawBackgroundColor = (_e = cells === null || cells === void 0 ? void 0 : cells.fill) === null || _e === void 0 ? void 0 : _e.color;
1178
- var backgroundColor;
1179
- if (Array.isArray(rawBackgroundColor)) {
1180
- var entry = (_f = rawBackgroundColor[updatedColIndex]) !== null && _f !== void 0 ? _f : rawBackgroundColor[0];
1181
- var colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
1182
- backgroundColor = typeof colorValue === 'string' ? colorValue : undefined;
1183
- }
1184
- else if (typeof rawBackgroundColor === 'string') {
1185
- backgroundColor = rawBackgroundColor;
1186
- }
1187
- var rawTextAlign = Array.isArray(cells === null || cells === void 0 ? void 0 : cells.align) ? (_g = cells.align[colIndex]) !== null && _g !== void 0 ? _g : cells.align[0] : cells === null || cells === void 0 ? void 0 : cells.align;
1188
- var textAlign = rawTextAlign;
1138
+ var fontColor = resolveCellStyle((_a = cells === null || cells === void 0 ? void 0 : cells.font) === null || _a === void 0 ? void 0 : _a.color, rowIndex, colIndex);
1139
+ var fontSize = resolveCellStyle((_b = cells === null || cells === void 0 ? void 0 : cells.font) === null || _b === void 0 ? void 0 : _b.size, rowIndex, colIndex);
1140
+ var backgroundColor = resolveCellStyle((_c = cells === null || cells === void 0 ? void 0 : cells.fill) === null || _c === void 0 ? void 0 : _c.color, rowIndex, colIndex);
1141
+ var textAlign = resolveCellStyle(cells === null || cells === void 0 ? void 0 : cells.align, rowIndex, colIndex);
1189
1142
  var style = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, (fontColor ? { color: fontColor } : {})), (typeof fontSize === 'number' ? { fontSize: fontSize } : {})), (backgroundColor ? { backgroundColor: backgroundColor } : {})), (textAlign ? { textAlign: textAlign } : {}));
1190
1143
  return {
1191
1144
  value: formattedValue,
@@ -1264,15 +1217,15 @@ var transformPlotlyJsonToFunnelChartProps = function (input, isMultiPlot, colorM
1264
1217
  // Assign a color per series/category and use it for all subValues of that category
1265
1218
  var seriesColors_1 = {};
1266
1219
  input.data.forEach(function (series, seriesIdx) {
1267
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1220
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
1268
1221
  var category = series.name || "Category ".concat(seriesIdx + 1);
1269
1222
  // Use the same color for this category across all stages
1270
1223
  var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_e = (_d = series.marker) === null || _d === void 0 ? void 0 : _d.colors) !== null && _e !== void 0 ? _e : (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color, colorMap, isDarkTheme);
1271
1224
  // Always use the first color for the series/category
1272
- var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, 0, category, colorMap, isDarkTheme);
1225
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, 0, category, colorMap, (_j = (_h = (_g = input.layout) === null || _g === void 0 ? void 0 : _g.template) === null || _h === void 0 ? void 0 : _h.layout) === null || _j === void 0 ? void 0 : _j.colorway, isDarkTheme);
1273
1226
  seriesColors_1[category] = color;
1274
- var labels = (_h = (_g = series.labels) !== null && _g !== void 0 ? _g : series.y) !== null && _h !== void 0 ? _h : series.stage;
1275
- var values = (_k = (_j = series.values) !== null && _j !== void 0 ? _j : series.x) !== null && _k !== void 0 ? _k : series.value;
1227
+ var labels = (_l = (_k = series.labels) !== null && _k !== void 0 ? _k : series.y) !== null && _l !== void 0 ? _l : series.stage;
1228
+ var values = (_o = (_m = series.values) !== null && _m !== void 0 ? _m : series.x) !== null && _o !== void 0 ? _o : series.value;
1276
1229
  if (!(0, chart_utilities_1.isArrayOrTypedArray)(labels) || !(0, chart_utilities_1.isArrayOrTypedArray)(values)) {
1277
1230
  return;
1278
1231
  }
@@ -1306,7 +1259,8 @@ var transformPlotlyJsonToFunnelChartProps = function (input, isMultiPlot, colorM
1306
1259
  }
1307
1260
  var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_e = (_d = series.marker) === null || _d === void 0 ? void 0 : _d.colors) !== null && _e !== void 0 ? _e : (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color, colorMap, isDarkTheme);
1308
1261
  categories.forEach(function (label, i) {
1309
- var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, label, colorMap, isDarkTheme);
1262
+ var _a, _b, _c;
1263
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, label, colorMap, (_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, isDarkTheme);
1310
1264
  var valueNum = Number(values[i]);
1311
1265
  if (isNaN(valueNum)) {
1312
1266
  return;
@@ -1642,11 +1596,12 @@ var getAllupLegendsProps = function (input, colorMap, colorwayType, traceInfo, i
1642
1596
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1643
1597
  if (traceInfo[index].type === 'donut') {
1644
1598
  var pieSeries = series;
1645
- var colors_2 = (0, PlotlyColorAdapter_1.extractColor)((_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.piecolorway) !== null && _b !== void 0 ? _b : (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.layout) === null || _e === void 0 ? void 0 : _e.colorway, colorwayType, (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.piecolorway) !== null && _g !== void 0 ? _g : (_h = pieSeries === null || pieSeries === void 0 ? void 0 : pieSeries.marker) === null || _h === void 0 ? void 0 : _h.colors, colorMap, isDarkTheme);
1599
+ var colors_2 = (0, PlotlyColorAdapter_1.extractColor)((_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.piecolorway) !== null && _b !== void 0 ? _b : (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.layout) === null || _e === void 0 ? void 0 : _e.colorway, colorwayType, (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.piecolorway) !== null && _g !== void 0 ? _g : (_h = pieSeries === null || pieSeries === void 0 ? void 0 : pieSeries.marker) === null || _h === void 0 ? void 0 : _h.colors, colorMap, isDarkTheme, true);
1646
1600
  (_j = pieSeries.labels) === null || _j === void 0 ? void 0 : _j.forEach(function (label, labelIndex) {
1601
+ var _a, _b, _c, _d, _e;
1647
1602
  var legend = "".concat(label);
1648
1603
  // resolve color for each legend from the extracted colors
1649
- var color = (0, PlotlyColorAdapter_1.resolveColor)(colors_2, labelIndex, legend, colorMap, isDarkTheme);
1604
+ var color = (0, PlotlyColorAdapter_1.resolveColor)(colors_2, labelIndex, legend, colorMap, (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.piecolorway) !== null && _b !== void 0 ? _b : (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.layout) === null || _e === void 0 ? void 0 : _e.colorway, isDarkTheme, true);
1650
1605
  if (legend !== '' && allupLegends.some(function (group) { return group.title === legend; }) === false) {
1651
1606
  allupLegends.push({
1652
1607
  title: legend,