@fluentui/react-charting 5.24.26 → 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.
- package/CHANGELOG.json +16 -1
- package/CHANGELOG.md +11 -2
- package/dist/react-charting.d.ts +7 -0
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +1 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.js +16 -5
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.d.ts +8 -4
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +70 -19
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +86 -85
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.base.js +7 -2
- package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.d.ts +7 -0
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +16 -5
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +8 -4
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +71 -20
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +86 -85
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.base.js +7 -2
- package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.types.d.ts +7 -0
- package/lib-amd/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +16 -5
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +8 -4
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +71 -20
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +86 -85
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.base.js +7 -2
- package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.d.ts +7 -0
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/package.json +1 -1
- 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":";;;;IAcA,IAAM,uBAAuB,GAAG;QAC9B,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,IAAI;KAChB,CAAC;IAEF,IAAM,iCAAiC,GAAG;QACxC,uBAAc,CAAC,MAAM,EAAE,GAAG;QAC1B,uBAAc,CAAC,OAAO,EAAE,GAAG;QAC3B,uBAAc,CAAC,MAAM,EAAE,GAAG;QAC1B,uBAAc,CAAC,MAAM,EAAE,GAAG;QAC1B,uBAAc,CAAC,MAAM,EAAE,GAAG;QAC1B,uBAAc,CAAC,MAAM,EAAE,GAAG;QAC1B,uBAAc,CAAC,MAAM,EAAE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,GAAG,MAAA,MAAM,CAAC,MAAM,0CAAE,KAAiB,CAAC;YAC/C,IAAA,KAAe;gBACnB,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,0CAAE,IAAI,mCAAI,IAAI,CAAC,GAAG,OAAR,IAAI,EAAQ,WAAW,CAAC;gBACnD,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,0CAAE,IAAI,mCAAI,IAAI,CAAC,GAAG,OAAR,IAAI,EAAQ,WAAW,CAAC;aACpD,EAHM,MAAI,QAAA,EAAE,MAAI,QAGhB,CAAC;YAEF,oDAAoD;YACpD,IAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,UAAC,EAAK;oBAAJ,GAAG,QAAA;gBAAM,OAAA,MAAI,GAAG,GAAG,GAAG,CAAC,MAAI,GAAG,MAAI,CAAC;YAA1B,CAA0B,CAAC,CAAC;YACrE,IAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,CAAC,CAAC,EAAP,CAAO,CAAC,CAAC;YAE/C,OAAO,IAAA,sBAAa,GAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACxE,CAAC;QACD,OAAO,iBAAiB,CAAC;IAC3B,CAAC,CAAC;IAzBW,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":";;;;IAcA,IAAM,uBAAuB,GAAG;QAC9B,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,IAAI;KAChB,CAAC;IAEF,iGAAiG;IACjG,6IAA6I;IAChI,QAAA,mBAAmB,GAAG;QACjC,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;QACd,SAAS,EAA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,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,CAAC,CAAC,EAAP,CAAO,CAAC,CAAC;YAE/C,OAAO,IAAA,sBAAa,GAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACxE,CAAC;QACD,OAAO,iBAAiB,CAAC;IAC3B,CAAC,CAAC;IAzBW,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"]}
|
|
@@ -177,7 +177,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
177
177
|
};
|
|
178
178
|
var _getGaugeAxisColor = function (colorway, colorwayType, color, colorMap, isDarkTheme) {
|
|
179
179
|
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)(colorway, colorwayType, color, colorMap, isDarkTheme);
|
|
180
|
-
return (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, 0, '', colorMap, isDarkTheme);
|
|
180
|
+
return (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, 0, '', colorMap, colorway, isDarkTheme);
|
|
181
181
|
};
|
|
182
182
|
exports._getGaugeAxisColor = _getGaugeAxisColor;
|
|
183
183
|
var resolveXAxisPoint = function (x, isXYearCategory, isXString, isXDate, isXNumber) {
|
|
@@ -325,57 +325,41 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
325
325
|
// extract colors for each series only once
|
|
326
326
|
// use piecolorway if available
|
|
327
327
|
// otherwise, default to colorway from template
|
|
328
|
-
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);
|
|
328
|
+
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);
|
|
329
329
|
var mapLegendToDataPoint = {};
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
330
|
+
// clear colorMap for donut chart to reassign colors as the colorMap initially gets assigned by
|
|
331
|
+
// getAllupLegendsProps function without sorting labels by value
|
|
332
|
+
colorMap.current.clear();
|
|
333
|
+
// Sort labels by value descending before mapping
|
|
334
|
+
if (firstData.labels && firstData.values) {
|
|
335
|
+
var markerColors_1 = ((_j = firstData.marker) === null || _j === void 0 ? void 0 : _j.colors) || undefined;
|
|
336
|
+
var hasMarkerColors_1 = Array.isArray(markerColors_1) && markerColors_1.length >= firstData.labels.length;
|
|
337
|
+
var labelValuePairs = firstData.labels.map(function (label, index) { return ({
|
|
338
|
+
label: label,
|
|
339
|
+
value: (0, exports.getNumberAtIndexOrDefault)(firstData.values, index),
|
|
340
|
+
index: index,
|
|
341
|
+
color: hasMarkerColors_1 ? markerColors_1[index] : undefined,
|
|
342
|
+
}); });
|
|
343
|
+
// Filter out invalid values
|
|
344
|
+
var validPairs = labelValuePairs.filter(function (pair) { return !(0, chart_utilities_1.isInvalidValue)(pair.value); });
|
|
345
|
+
// Sort descending by value; when marker colors are present, keep color attached to the label
|
|
346
|
+
validPairs.sort(function (a, b) { return b.value - a.value; });
|
|
347
|
+
validPairs.forEach(function (pair, sortedIdx) {
|
|
348
|
+
var _a, _b, _c, _d, _e, _f;
|
|
349
|
+
var legend = "".concat(pair.label);
|
|
350
|
+
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);
|
|
339
351
|
if (!mapLegendToDataPoint[legend]) {
|
|
340
352
|
mapLegendToDataPoint[legend] = {
|
|
341
353
|
legend: legend,
|
|
342
|
-
data: value,
|
|
354
|
+
data: pair.value,
|
|
343
355
|
color: color,
|
|
344
356
|
};
|
|
345
357
|
}
|
|
346
358
|
else {
|
|
347
|
-
mapLegendToDataPoint[legend].data += value;
|
|
359
|
+
mapLegendToDataPoint[legend].data += pair.value;
|
|
348
360
|
}
|
|
349
361
|
});
|
|
350
362
|
}
|
|
351
|
-
else {
|
|
352
|
-
// Sort labels by value descending before mapping
|
|
353
|
-
if (firstData.labels && firstData.values) {
|
|
354
|
-
var labelValuePairs = firstData.labels.map(function (label, index) { return ({
|
|
355
|
-
label: label,
|
|
356
|
-
value: (0, exports.getNumberAtIndexOrDefault)(firstData.values, index),
|
|
357
|
-
index: index,
|
|
358
|
-
}); });
|
|
359
|
-
// Filter out invalid values
|
|
360
|
-
var validPairs = labelValuePairs.filter(function (pair) { return !(0, chart_utilities_1.isInvalidValue)(pair.value); });
|
|
361
|
-
// Sort descending by value
|
|
362
|
-
validPairs.sort(function (a, b) { return b.value - a.value; });
|
|
363
|
-
validPairs.forEach(function (pair, sortedIdx) {
|
|
364
|
-
var legend = "".concat(pair.label);
|
|
365
|
-
var color = (0, PlotlyColorAdapter_1.resolveColor)(colors, sortedIdx, legend, colorMap, isDarkTheme);
|
|
366
|
-
if (!mapLegendToDataPoint[legend]) {
|
|
367
|
-
mapLegendToDataPoint[legend] = {
|
|
368
|
-
legend: legend,
|
|
369
|
-
data: pair.value,
|
|
370
|
-
color: color,
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
else {
|
|
374
|
-
mapLegendToDataPoint[legend].data += pair.value;
|
|
375
|
-
}
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
363
|
var width = (_l = (_k = input.layout) === null || _k === void 0 ? void 0 : _k.width) !== null && _l !== void 0 ? _l : 440;
|
|
380
364
|
var height = (_o = (_m = input.layout) === null || _m === void 0 ? void 0 : _m.height) !== null && _o !== void 0 ? _o : 220;
|
|
381
365
|
var hideLabels = firstData.textinfo
|
|
@@ -387,10 +371,23 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
387
371
|
? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2)
|
|
388
372
|
: utilities_1.MIN_DONUT_RADIUS;
|
|
389
373
|
var chartTitle = getTitles(input.layout).chartTitle;
|
|
374
|
+
// Build anticlockwise order by keeping the first item, reversing the rest
|
|
375
|
+
var legends = Object.keys(mapLegendToDataPoint);
|
|
376
|
+
var reorderedEntries = legends.length > 1
|
|
377
|
+
? tslib_1.__spreadArray([
|
|
378
|
+
[legends[0], mapLegendToDataPoint[legends[0]]]
|
|
379
|
+
], legends
|
|
380
|
+
.slice(1)
|
|
381
|
+
.reverse()
|
|
382
|
+
.map(function (key) { return [key, mapLegendToDataPoint[key]]; }), true)
|
|
383
|
+
: legends.map(function (key) { return [key, mapLegendToDataPoint[key]]; });
|
|
390
384
|
return {
|
|
391
385
|
data: {
|
|
392
386
|
chartTitle: chartTitle,
|
|
393
|
-
chartData:
|
|
387
|
+
chartData: reorderedEntries.map(function (_a) {
|
|
388
|
+
var v = _a[1];
|
|
389
|
+
return v;
|
|
390
|
+
}),
|
|
394
391
|
},
|
|
395
392
|
hideLegend: isMultiPlot || ((_p = input.layout) === null || _p === void 0 ? void 0 : _p.showlegend) === false,
|
|
396
393
|
width: (_q = input.layout) === null || _q === void 0 ? void 0 : _q.width,
|
|
@@ -399,6 +396,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
399
396
|
hideLabels: hideLabels,
|
|
400
397
|
showLabelsInPercent: firstData.textinfo ? ['percent', 'label+percent'].includes(firstData.textinfo) : true,
|
|
401
398
|
roundCorners: true,
|
|
399
|
+
order: 'sorted',
|
|
402
400
|
};
|
|
403
401
|
};
|
|
404
402
|
exports.transformPlotlyJsonToDonutProps = transformPlotlyJsonToDonutProps;
|
|
@@ -429,7 +427,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
429
427
|
var rangeXValues = series.x.slice(rangeStart, rangeEnd);
|
|
430
428
|
var rangeYValues = series.y.slice(rangeStart, rangeEnd);
|
|
431
429
|
rangeXValues.forEach(function (x, index2) {
|
|
432
|
-
var _a, _b, _c, _d, _e, _f;
|
|
430
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
433
431
|
if (!mapXToDataPoints[x]) {
|
|
434
432
|
mapXToDataPoints[x] = {
|
|
435
433
|
xAxisPoint: (0, exports.resolveXAxisPoint)(x, isXYearCategory, isXString, isXDate, isXNumber),
|
|
@@ -443,7 +441,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
443
441
|
? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
|
|
444
442
|
? (_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]
|
|
445
443
|
: 0)
|
|
446
|
-
: (0, PlotlyColorAdapter_1.resolveColor)(extractedBarColors, index2, legend, colorMap, isDarkTheme);
|
|
444
|
+
: (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);
|
|
447
445
|
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index2);
|
|
448
446
|
var yVal = rangeYValues[index2];
|
|
449
447
|
var yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
|
|
@@ -451,7 +449,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
451
449
|
mapXToDataPoints[x].chartData.push({
|
|
452
450
|
legend: legend,
|
|
453
451
|
data: yVal,
|
|
454
|
-
color: (
|
|
452
|
+
color: (_h = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _h !== void 0 ? _h : color,
|
|
455
453
|
yAxisCalloutData: yAxisCalloutData,
|
|
456
454
|
});
|
|
457
455
|
if (typeof yVal === 'number') {
|
|
@@ -459,14 +457,14 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
459
457
|
}
|
|
460
458
|
}
|
|
461
459
|
else if (series.type === 'scatter' || !!fallbackVSBC) {
|
|
462
|
-
var lineColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedLineColors, index1, legend, colorMap, isDarkTheme);
|
|
460
|
+
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);
|
|
463
461
|
var lineOptions = getLineOptions(series.line);
|
|
464
462
|
var legendShape = getLegendShape(series);
|
|
465
463
|
mapXToDataPoints[x].lineData.push({
|
|
466
464
|
legend: legend + (validXYRanges.length > 1 ? ".".concat(rangeIdx + 1) : ''),
|
|
467
465
|
legendShape: legendShape,
|
|
468
466
|
y: yVal,
|
|
469
|
-
color: (
|
|
467
|
+
color: (_m = (0, d3_color_1.rgb)(lineColor).copy({ opacity: opacity }).formatHex8()) !== null && _m !== void 0 ? _m : color,
|
|
470
468
|
lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
|
|
471
469
|
useSecondaryYScale: usesSecondaryYScale(series, input.layout),
|
|
472
470
|
yAxisCalloutData: yAxisCalloutData,
|
|
@@ -517,7 +515,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
517
515
|
// extract colors for each series only once
|
|
518
516
|
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);
|
|
519
517
|
(_e = series.x) === null || _e === void 0 ? void 0 : _e.forEach(function (x, xIndex) {
|
|
520
|
-
var _a, _b, _c, _d, _e, _f;
|
|
518
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
521
519
|
if ((0, chart_utilities_1.isInvalidValue)(x) || (0, chart_utilities_1.isInvalidValue)((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
|
|
522
520
|
return;
|
|
523
521
|
}
|
|
@@ -531,14 +529,14 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
531
529
|
? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
|
|
532
530
|
? (_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]
|
|
533
531
|
: 0)
|
|
534
|
-
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, xIndex, legend, colorMap, isDarkTheme);
|
|
532
|
+
: (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);
|
|
535
533
|
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, xIndex);
|
|
536
534
|
var yVal = series.y[xIndex];
|
|
537
535
|
mapXToDataPoints[x].series.push({
|
|
538
536
|
key: legend,
|
|
539
537
|
data: yVal,
|
|
540
538
|
xAxisCalloutData: x,
|
|
541
|
-
color: (
|
|
539
|
+
color: (_j = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color,
|
|
542
540
|
legend: legend,
|
|
543
541
|
useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout),
|
|
544
542
|
yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
|
|
@@ -591,17 +589,17 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
591
589
|
return yVal;
|
|
592
590
|
});
|
|
593
591
|
xBins.forEach(function (bin, index) {
|
|
594
|
-
var _a, _b, _c, _d, _e;
|
|
592
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
595
593
|
var legend = legends[seriesIdx];
|
|
596
594
|
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
597
595
|
var color = colorScale
|
|
598
596
|
? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
|
|
599
597
|
? (_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]
|
|
600
598
|
: 0)
|
|
601
|
-
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
599
|
+
: (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);
|
|
602
600
|
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
|
|
603
601
|
var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
|
|
604
|
-
vbcData.push(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: (
|
|
602
|
+
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
|
|
605
603
|
? {}
|
|
606
604
|
: { xAxisCalloutData: "[".concat(bin.x0, " - ").concat(bin.x1, ")") })));
|
|
607
605
|
});
|
|
@@ -641,7 +639,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
641
639
|
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
642
640
|
var chartData = input.data
|
|
643
641
|
.map(function (series, index) {
|
|
644
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
642
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
645
643
|
var colors = isScatterMarkers
|
|
646
644
|
? ((_a = series === null || series === void 0 ? void 0 : series.mode) === null || _a === void 0 ? void 0 : _a.includes('line'))
|
|
647
645
|
? (_b = series.line) === null || _b === void 0 ? void 0 : _b.color
|
|
@@ -656,11 +654,11 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
656
654
|
var isXYearCategory = (0, chart_utilities_1.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
|
|
657
655
|
var legend = legends[index];
|
|
658
656
|
// resolve color for each legend's lines from the extracted colors
|
|
659
|
-
var seriesColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
657
|
+
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);
|
|
660
658
|
var seriesOpacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
|
|
661
659
|
mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
|
|
662
660
|
// if mode contains 'text', we prioritize showing the text over curving the line
|
|
663
|
-
var lineOptions = !((
|
|
661
|
+
var lineOptions = !((_l = series.mode) === null || _l === void 0 ? void 0 : _l.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
|
|
664
662
|
var legendShape = getLegendShape(series);
|
|
665
663
|
var validXYRanges = (0, exports.getValidXYRanges)(series);
|
|
666
664
|
return validXYRanges.map(function (_a, rangeIdx) {
|
|
@@ -734,7 +732,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
734
732
|
var legend = legends[index];
|
|
735
733
|
return series.y
|
|
736
734
|
.map(function (yValue, i) {
|
|
737
|
-
var _a, _b, _c, _d, _e, _f;
|
|
735
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
738
736
|
if ((0, chart_utilities_1.isInvalidValue)((_a = series.x) === null || _a === void 0 ? void 0 : _a[i]) || (0, chart_utilities_1.isInvalidValue)(yValue)) {
|
|
739
737
|
return null;
|
|
740
738
|
}
|
|
@@ -743,13 +741,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
743
741
|
? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
|
|
744
742
|
? (_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]
|
|
745
743
|
: 0)
|
|
746
|
-
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
|
|
744
|
+
: (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);
|
|
747
745
|
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
|
|
748
746
|
return {
|
|
749
747
|
x: series.x[i],
|
|
750
748
|
y: yValue,
|
|
751
749
|
legend: legend,
|
|
752
|
-
color: (
|
|
750
|
+
color: (_j = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color,
|
|
753
751
|
};
|
|
754
752
|
})
|
|
755
753
|
.filter(function (point) { return point !== null; });
|
|
@@ -786,7 +784,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
786
784
|
};
|
|
787
785
|
return series.y
|
|
788
786
|
.map(function (yVal, i) {
|
|
789
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
787
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
790
788
|
if ((0, chart_utilities_1.isInvalidValue)(yVal)) {
|
|
791
789
|
return null;
|
|
792
790
|
}
|
|
@@ -795,10 +793,10 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
795
793
|
? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
|
|
796
794
|
? (_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]
|
|
797
795
|
: 0)
|
|
798
|
-
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
|
|
796
|
+
: (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);
|
|
799
797
|
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
|
|
800
|
-
var base = convertXValueToNumber((
|
|
801
|
-
var xVal = convertXValueToNumber((
|
|
798
|
+
var base = convertXValueToNumber((_h = series.base) === null || _h === void 0 ? void 0 : _h[i]);
|
|
799
|
+
var xVal = convertXValueToNumber((_j = series.x) === null || _j === void 0 ? void 0 : _j[i]);
|
|
802
800
|
return {
|
|
803
801
|
x: {
|
|
804
802
|
start: isXDate ? new Date(base) : base,
|
|
@@ -806,7 +804,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
806
804
|
},
|
|
807
805
|
y: yVal,
|
|
808
806
|
legend: legend,
|
|
809
|
-
color: (
|
|
807
|
+
color: (_k = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _k !== void 0 ? _k : color,
|
|
810
808
|
};
|
|
811
809
|
})
|
|
812
810
|
.filter(function (point) { return point !== null; });
|
|
@@ -950,7 +948,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
950
948
|
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);
|
|
951
949
|
var sankeyChartData = {
|
|
952
950
|
nodes: (_e = node.label) === null || _e === void 0 ? void 0 : _e.map(function (label, index) {
|
|
953
|
-
var
|
|
951
|
+
var _a, _b, _c;
|
|
952
|
+
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);
|
|
954
953
|
return {
|
|
955
954
|
nodeId: index,
|
|
956
955
|
name: label,
|
|
@@ -979,19 +978,19 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
979
978
|
};
|
|
980
979
|
exports.transformPlotlyJsonToSankeyProps = transformPlotlyJsonToSankeyProps;
|
|
981
980
|
var transformPlotlyJsonToGaugeProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
982
|
-
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;
|
|
981
|
+
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;
|
|
983
982
|
var firstData = input.data[0];
|
|
984
983
|
var stepsColors = ((_a = firstData.gauge) === null || _a === void 0 ? void 0 : _a.steps) ? firstData.gauge.steps.map(function (step) { return step.color; }) : undefined;
|
|
985
984
|
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);
|
|
986
985
|
var segments = ((_f = (_e = firstData.gauge) === null || _e === void 0 ? void 0 : _e.steps) === null || _f === void 0 ? void 0 : _f.length)
|
|
987
986
|
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
988
987
|
firstData.gauge.steps.map(function (step, index) {
|
|
989
|
-
var _a, _b;
|
|
988
|
+
var _a, _b, _c, _d, _e;
|
|
990
989
|
var legend = step.name || "Segment ".concat(index + 1);
|
|
991
|
-
var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
990
|
+
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);
|
|
992
991
|
return {
|
|
993
992
|
legend: legend,
|
|
994
|
-
size: ((
|
|
993
|
+
size: ((_d = step.range) === null || _d === void 0 ? void 0 : _d[1]) - ((_e = step.range) === null || _e === void 0 ? void 0 : _e[0]),
|
|
995
994
|
color: color,
|
|
996
995
|
};
|
|
997
996
|
})
|
|
@@ -1014,13 +1013,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1014
1013
|
if (diff >= 0) {
|
|
1015
1014
|
sublabel = "\u25B2 ".concat(diff);
|
|
1016
1015
|
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);
|
|
1017
|
-
var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedIncreasingDeltaColors, 0, '', colorMap, isDarkTheme);
|
|
1016
|
+
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);
|
|
1018
1017
|
sublabelColor = color;
|
|
1019
1018
|
}
|
|
1020
1019
|
else {
|
|
1021
1020
|
sublabel = "\u25BC ".concat(Math.abs(diff));
|
|
1022
|
-
var extractedDecreasingDeltaColors = (0, PlotlyColorAdapter_1.extractColor)((
|
|
1023
|
-
var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedDecreasingDeltaColors, 0, '', colorMap, isDarkTheme);
|
|
1021
|
+
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);
|
|
1022
|
+
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);
|
|
1024
1023
|
sublabelColor = color;
|
|
1025
1024
|
}
|
|
1026
1025
|
}
|
|
@@ -1032,17 +1031,17 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1032
1031
|
var chartTitle = getTitles(input.layout).chartTitle;
|
|
1033
1032
|
return {
|
|
1034
1033
|
segments: segments,
|
|
1035
|
-
chartValue: (
|
|
1034
|
+
chartValue: (_14 = firstData.value) !== null && _14 !== void 0 ? _14 : 0,
|
|
1036
1035
|
chartTitle: chartTitle,
|
|
1037
1036
|
sublabel: sublabel,
|
|
1038
1037
|
// range values can be null
|
|
1039
|
-
minValue: typeof ((
|
|
1040
|
-
maxValue: typeof ((
|
|
1038
|
+
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,
|
|
1039
|
+
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,
|
|
1041
1040
|
chartValueFormat: function () { var _a, _b; return (_b = (_a = firstData.value) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''; },
|
|
1042
|
-
width: (
|
|
1043
|
-
height: (
|
|
1041
|
+
width: (_27 = input.layout) === null || _27 === void 0 ? void 0 : _27.width,
|
|
1042
|
+
height: (_29 = (_28 = input.layout) === null || _28 === void 0 ? void 0 : _28.height) !== null && _29 !== void 0 ? _29 : 220,
|
|
1044
1043
|
styles: styles,
|
|
1045
|
-
variant: ((
|
|
1044
|
+
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,
|
|
1046
1045
|
roundCorners: true,
|
|
1047
1046
|
};
|
|
1048
1047
|
};
|
|
@@ -1253,15 +1252,15 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1253
1252
|
// Assign a color per series/category and use it for all subValues of that category
|
|
1254
1253
|
var seriesColors_1 = {};
|
|
1255
1254
|
input.data.forEach(function (series, seriesIdx) {
|
|
1256
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1255
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
1257
1256
|
var category = series.name || "Category ".concat(seriesIdx + 1);
|
|
1258
1257
|
// Use the same color for this category across all stages
|
|
1259
1258
|
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);
|
|
1260
1259
|
// Always use the first color for the series/category
|
|
1261
|
-
var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, 0, category, colorMap, isDarkTheme);
|
|
1260
|
+
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);
|
|
1262
1261
|
seriesColors_1[category] = color;
|
|
1263
|
-
var labels = (
|
|
1264
|
-
var values = (
|
|
1262
|
+
var labels = (_l = (_k = series.labels) !== null && _k !== void 0 ? _k : series.y) !== null && _l !== void 0 ? _l : series.stage;
|
|
1263
|
+
var values = (_o = (_m = series.values) !== null && _m !== void 0 ? _m : series.x) !== null && _o !== void 0 ? _o : series.value;
|
|
1265
1264
|
if (!(0, chart_utilities_1.isArrayOrTypedArray)(labels) || !(0, chart_utilities_1.isArrayOrTypedArray)(values)) {
|
|
1266
1265
|
return;
|
|
1267
1266
|
}
|
|
@@ -1295,7 +1294,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1295
1294
|
}
|
|
1296
1295
|
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);
|
|
1297
1296
|
categories.forEach(function (label, i) {
|
|
1298
|
-
var
|
|
1297
|
+
var _a, _b, _c;
|
|
1298
|
+
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);
|
|
1299
1299
|
var valueNum = Number(values[i]);
|
|
1300
1300
|
if (isNaN(valueNum)) {
|
|
1301
1301
|
return;
|
|
@@ -1631,11 +1631,12 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1631
1631
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
1632
1632
|
if (traceInfo[index].type === 'donut') {
|
|
1633
1633
|
var pieSeries = series;
|
|
1634
|
-
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);
|
|
1634
|
+
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);
|
|
1635
1635
|
(_j = pieSeries.labels) === null || _j === void 0 ? void 0 : _j.forEach(function (label, labelIndex) {
|
|
1636
|
+
var _a, _b, _c, _d, _e;
|
|
1636
1637
|
var legend = "".concat(label);
|
|
1637
1638
|
// resolve color for each legend from the extracted colors
|
|
1638
|
-
var color = (0, PlotlyColorAdapter_1.resolveColor)(colors_2, labelIndex, legend, colorMap, isDarkTheme);
|
|
1639
|
+
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);
|
|
1639
1640
|
if (legend !== '' && allupLegends.some(function (group) { return group.title === legend; }) === false) {
|
|
1640
1641
|
allupLegends.push({
|
|
1641
1642
|
title: legend,
|