@fluentui/react-charting 5.24.25 → 5.24.27

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 +49 -1
  2. package/CHANGELOG.md +23 -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 +96 -65
  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 +96 -65
  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 +96 -65
  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 +4 -4
  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,27 +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
- (_j = firstData.labels) === null || _j === void 0 ? void 0 : _j.forEach(function (label, index) {
342
- var value = (0, exports.getNumberAtIndexOrDefault)(firstData.values, index);
343
- if ((0, chart_utilities_1.isInvalidValue)(value) || value < 0) {
344
- return;
345
- }
346
- var legend = "".concat(label);
347
- // resolve color for each legend from the extracted colors
348
- var color = (0, PlotlyColorAdapter_1.resolveColor)(colors, index, legend, colorMap, isDarkTheme);
349
- if (!mapLegendToDataPoint[legend]) {
350
- mapLegendToDataPoint[legend] = {
351
- legend: legend,
352
- data: value,
353
- color: color,
354
- };
355
- }
356
- else {
357
- mapLegendToDataPoint[legend].data += value;
358
- }
359
- });
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);
362
+ if (!mapLegendToDataPoint[legend]) {
363
+ mapLegendToDataPoint[legend] = {
364
+ legend: legend,
365
+ data: pair.value,
366
+ color: color,
367
+ };
368
+ }
369
+ else {
370
+ mapLegendToDataPoint[legend].data += pair.value;
371
+ }
372
+ });
373
+ }
360
374
  var width = (_l = (_k = input.layout) === null || _k === void 0 ? void 0 : _k.width) !== null && _l !== void 0 ? _l : 440;
361
375
  var height = (_o = (_m = input.layout) === null || _m === void 0 ? void 0 : _m.height) !== null && _o !== void 0 ? _o : 220;
362
376
  var hideLabels = firstData.textinfo
@@ -368,10 +382,23 @@ var transformPlotlyJsonToDonutProps = function (input, isMultiPlot, colorMap, co
368
382
  ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2)
369
383
  : utilities_1.MIN_DONUT_RADIUS;
370
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]]; });
371
395
  return {
372
396
  data: {
373
397
  chartTitle: chartTitle,
374
- chartData: Object.values(mapLegendToDataPoint),
398
+ chartData: reorderedEntries.map(function (_a) {
399
+ var v = _a[1];
400
+ return v;
401
+ }),
375
402
  },
376
403
  hideLegend: isMultiPlot || ((_p = input.layout) === null || _p === void 0 ? void 0 : _p.showlegend) === false,
377
404
  width: (_q = input.layout) === null || _q === void 0 ? void 0 : _q.width,
@@ -380,6 +407,7 @@ var transformPlotlyJsonToDonutProps = function (input, isMultiPlot, colorMap, co
380
407
  hideLabels: hideLabels,
381
408
  showLabelsInPercent: firstData.textinfo ? ['percent', 'label+percent'].includes(firstData.textinfo) : true,
382
409
  roundCorners: true,
410
+ order: 'sorted',
383
411
  };
384
412
  };
385
413
  exports.transformPlotlyJsonToDonutProps = transformPlotlyJsonToDonutProps;
@@ -410,7 +438,7 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
410
438
  var rangeXValues = series.x.slice(rangeStart, rangeEnd);
411
439
  var rangeYValues = series.y.slice(rangeStart, rangeEnd);
412
440
  rangeXValues.forEach(function (x, index2) {
413
- var _a, _b, _c, _d, _e, _f;
441
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
414
442
  if (!mapXToDataPoints[x]) {
415
443
  mapXToDataPoints[x] = {
416
444
  xAxisPoint: (0, exports.resolveXAxisPoint)(x, isXYearCategory, isXString, isXDate, isXNumber),
@@ -424,7 +452,7 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
424
452
  ? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
425
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]
426
454
  : 0)
427
- : (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);
428
456
  var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index2);
429
457
  var yVal = rangeYValues[index2];
430
458
  var yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
@@ -432,7 +460,7 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
432
460
  mapXToDataPoints[x].chartData.push({
433
461
  legend: legend,
434
462
  data: yVal,
435
- 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,
436
464
  yAxisCalloutData: yAxisCalloutData,
437
465
  });
438
466
  if (typeof yVal === 'number') {
@@ -440,14 +468,14 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
440
468
  }
441
469
  }
442
470
  else if (series.type === 'scatter' || !!fallbackVSBC) {
443
- 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);
444
472
  var lineOptions = getLineOptions(series.line);
445
473
  var legendShape = getLegendShape(series);
446
474
  mapXToDataPoints[x].lineData.push({
447
475
  legend: legend + (validXYRanges.length > 1 ? ".".concat(rangeIdx + 1) : ''),
448
476
  legendShape: legendShape,
449
477
  y: yVal,
450
- 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,
451
479
  lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
452
480
  useSecondaryYScale: usesSecondaryYScale(series, input.layout),
453
481
  yAxisCalloutData: yAxisCalloutData,
@@ -498,7 +526,7 @@ var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, col
498
526
  // extract colors for each series only once
499
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);
500
528
  (_e = series.x) === null || _e === void 0 ? void 0 : _e.forEach(function (x, xIndex) {
501
- var _a, _b, _c, _d, _e, _f;
529
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
502
530
  if ((0, chart_utilities_1.isInvalidValue)(x) || (0, chart_utilities_1.isInvalidValue)((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
503
531
  return;
504
532
  }
@@ -512,14 +540,14 @@ var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, col
512
540
  ? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
513
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]
514
542
  : 0)
515
- : (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);
516
544
  var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, xIndex);
517
545
  var yVal = series.y[xIndex];
518
546
  mapXToDataPoints[x].series.push({
519
547
  key: legend,
520
548
  data: yVal,
521
549
  xAxisCalloutData: x,
522
- 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,
523
551
  legend: legend,
524
552
  useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout),
525
553
  yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
@@ -572,17 +600,17 @@ var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colo
572
600
  return yVal;
573
601
  });
574
602
  xBins.forEach(function (bin, index) {
575
- var _a, _b, _c, _d, _e;
603
+ var _a, _b, _c, _d, _e, _f, _g, _h;
576
604
  var legend = legends[seriesIdx];
577
605
  // resolve color for each legend's bars from the colorscale or extracted colors
578
606
  var color = colorScale
579
607
  ? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
580
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]
581
609
  : 0)
582
- : (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);
583
611
  var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
584
612
  var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
585
- 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
586
614
  ? {}
587
615
  : { xAxisCalloutData: "[".concat(bin.x0, " - ").concat(bin.x1, ")") })));
588
616
  });
@@ -622,7 +650,7 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
622
650
  var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
623
651
  var chartData = input.data
624
652
  .map(function (series, index) {
625
- var _a, _b, _c, _d, _e, _f, _g, _h;
653
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
626
654
  var colors = isScatterMarkers
627
655
  ? ((_a = series === null || series === void 0 ? void 0 : series.mode) === null || _a === void 0 ? void 0 : _a.includes('line'))
628
656
  ? (_b = series.line) === null || _b === void 0 ? void 0 : _b.color
@@ -637,11 +665,11 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
637
665
  var isXYearCategory = (0, chart_utilities_1.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
638
666
  var legend = legends[index];
639
667
  // resolve color for each legend's lines from the extracted colors
640
- 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);
641
669
  var seriesOpacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
642
670
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
643
671
  // if mode contains 'text', we prioritize showing the text over curving the line
644
- 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;
645
673
  var legendShape = getLegendShape(series);
646
674
  var validXYRanges = (0, exports.getValidXYRanges)(series);
647
675
  return validXYRanges.map(function (_a, rangeIdx) {
@@ -715,7 +743,7 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPl
715
743
  var legend = legends[index];
716
744
  return series.y
717
745
  .map(function (yValue, i) {
718
- var _a, _b, _c, _d, _e, _f;
746
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
719
747
  if ((0, chart_utilities_1.isInvalidValue)((_a = series.x) === null || _a === void 0 ? void 0 : _a[i]) || (0, chart_utilities_1.isInvalidValue)(yValue)) {
720
748
  return null;
721
749
  }
@@ -724,13 +752,13 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPl
724
752
  ? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
725
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]
726
754
  : 0)
727
- : (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);
728
756
  var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
729
757
  return {
730
758
  x: series.x[i],
731
759
  y: yValue,
732
760
  legend: legend,
733
- 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,
734
762
  };
735
763
  })
736
764
  .filter(function (point) { return point !== null; });
@@ -767,7 +795,7 @@ var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot, colorMa
767
795
  };
768
796
  return series.y
769
797
  .map(function (yVal, i) {
770
- var _a, _b, _c, _d, _e, _f, _g;
798
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
771
799
  if ((0, chart_utilities_1.isInvalidValue)(yVal)) {
772
800
  return null;
773
801
  }
@@ -776,10 +804,10 @@ var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot, colorMa
776
804
  ? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
777
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]
778
806
  : 0)
779
- : (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);
780
808
  var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
781
- var base = convertXValueToNumber((_e = series.base) === null || _e === void 0 ? void 0 : _e[i]);
782
- 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]);
783
811
  return {
784
812
  x: {
785
813
  start: isXDate ? new Date(base) : base,
@@ -787,7 +815,7 @@ var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot, colorMa
787
815
  },
788
816
  y: yVal,
789
817
  legend: legend,
790
- 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,
791
819
  };
792
820
  })
793
821
  .filter(function (point) { return point !== null; });
@@ -931,7 +959,8 @@ var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot, colorMap, c
931
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);
932
960
  var sankeyChartData = {
933
961
  nodes: (_e = node.label) === null || _e === void 0 ? void 0 : _e.map(function (label, index) {
934
- 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);
935
964
  return {
936
965
  nodeId: index,
937
966
  name: label,
@@ -960,19 +989,19 @@ var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot, colorMap, c
960
989
  };
961
990
  exports.transformPlotlyJsonToSankeyProps = transformPlotlyJsonToSankeyProps;
962
991
  var transformPlotlyJsonToGaugeProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
963
- 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;
964
993
  var firstData = input.data[0];
965
994
  var stepsColors = ((_a = firstData.gauge) === null || _a === void 0 ? void 0 : _a.steps) ? firstData.gauge.steps.map(function (step) { return step.color; }) : undefined;
966
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);
967
996
  var segments = ((_f = (_e = firstData.gauge) === null || _e === void 0 ? void 0 : _e.steps) === null || _f === void 0 ? void 0 : _f.length)
968
997
  ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
969
998
  firstData.gauge.steps.map(function (step, index) {
970
- var _a, _b;
999
+ var _a, _b, _c, _d, _e;
971
1000
  var legend = step.name || "Segment ".concat(index + 1);
972
- 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);
973
1002
  return {
974
1003
  legend: legend,
975
- 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]),
976
1005
  color: color,
977
1006
  };
978
1007
  })
@@ -995,13 +1024,13 @@ var transformPlotlyJsonToGaugeProps = function (input, isMultiPlot, colorMap, co
995
1024
  if (diff >= 0) {
996
1025
  sublabel = "\u25B2 ".concat(diff);
997
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);
998
- 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);
999
1028
  sublabelColor = color;
1000
1029
  }
1001
1030
  else {
1002
1031
  sublabel = "\u25BC ".concat(Math.abs(diff));
1003
- 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);
1004
- 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);
1005
1034
  sublabelColor = color;
1006
1035
  }
1007
1036
  }
@@ -1013,17 +1042,17 @@ var transformPlotlyJsonToGaugeProps = function (input, isMultiPlot, colorMap, co
1013
1042
  var chartTitle = getTitles(input.layout).chartTitle;
1014
1043
  return {
1015
1044
  segments: segments,
1016
- chartValue: (_8 = firstData.value) !== null && _8 !== void 0 ? _8 : 0,
1045
+ chartValue: (_14 = firstData.value) !== null && _14 !== void 0 ? _14 : 0,
1017
1046
  chartTitle: chartTitle,
1018
1047
  sublabel: sublabel,
1019
1048
  // range values can be null
1020
- 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,
1021
- 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,
1022
1051
  chartValueFormat: function () { var _a, _b; return (_b = (_a = firstData.value) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''; },
1023
- width: (_21 = input.layout) === null || _21 === void 0 ? void 0 : _21.width,
1024
- 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,
1025
1054
  styles: styles,
1026
- 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,
1027
1056
  roundCorners: true,
1028
1057
  };
1029
1058
  };
@@ -1234,15 +1263,15 @@ var transformPlotlyJsonToFunnelChartProps = function (input, isMultiPlot, colorM
1234
1263
  // Assign a color per series/category and use it for all subValues of that category
1235
1264
  var seriesColors_1 = {};
1236
1265
  input.data.forEach(function (series, seriesIdx) {
1237
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1266
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
1238
1267
  var category = series.name || "Category ".concat(seriesIdx + 1);
1239
1268
  // Use the same color for this category across all stages
1240
1269
  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);
1241
1270
  // Always use the first color for the series/category
1242
- var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, 0, category, colorMap, isDarkTheme);
1271
+ 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);
1243
1272
  seriesColors_1[category] = color;
1244
- var labels = (_h = (_g = series.labels) !== null && _g !== void 0 ? _g : series.y) !== null && _h !== void 0 ? _h : series.stage;
1245
- var values = (_k = (_j = series.values) !== null && _j !== void 0 ? _j : series.x) !== null && _k !== void 0 ? _k : series.value;
1273
+ var labels = (_l = (_k = series.labels) !== null && _k !== void 0 ? _k : series.y) !== null && _l !== void 0 ? _l : series.stage;
1274
+ var values = (_o = (_m = series.values) !== null && _m !== void 0 ? _m : series.x) !== null && _o !== void 0 ? _o : series.value;
1246
1275
  if (!(0, chart_utilities_1.isArrayOrTypedArray)(labels) || !(0, chart_utilities_1.isArrayOrTypedArray)(values)) {
1247
1276
  return;
1248
1277
  }
@@ -1276,7 +1305,8 @@ var transformPlotlyJsonToFunnelChartProps = function (input, isMultiPlot, colorM
1276
1305
  }
1277
1306
  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);
1278
1307
  categories.forEach(function (label, i) {
1279
- var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, label, colorMap, isDarkTheme);
1308
+ var _a, _b, _c;
1309
+ 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);
1280
1310
  var valueNum = Number(values[i]);
1281
1311
  if (isNaN(valueNum)) {
1282
1312
  return;
@@ -1612,11 +1642,12 @@ var getAllupLegendsProps = function (input, colorMap, colorwayType, traceInfo, i
1612
1642
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1613
1643
  if (traceInfo[index].type === 'donut') {
1614
1644
  var pieSeries = series;
1615
- 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);
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, true);
1616
1646
  (_j = pieSeries.labels) === null || _j === void 0 ? void 0 : _j.forEach(function (label, labelIndex) {
1647
+ var _a, _b, _c, _d, _e;
1617
1648
  var legend = "".concat(label);
1618
1649
  // resolve color for each legend from the extracted colors
1619
- var color = (0, PlotlyColorAdapter_1.resolveColor)(colors_2, labelIndex, legend, colorMap, isDarkTheme);
1650
+ 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);
1620
1651
  if (legend !== '' && allupLegends.some(function (group) { return group.title === legend; }) === false) {
1621
1652
  allupLegends.push({
1622
1653
  title: legend,