@fluentui/react-charts 0.0.0-nightly-20250820-0406.1 → 0.0.0-nightly-20250822-0407.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/CHANGELOG.md +48 -15
  2. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +1 -1
  3. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  4. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +144 -65
  5. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  6. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +23 -4
  7. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  8. package/lib/components/HeatMapChart/HeatMapChart.js +175 -114
  9. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  10. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +26 -6
  11. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  12. package/lib/components/ScatterChart/ScatterChart.js +4 -2
  13. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  14. package/lib/components/VerticalBarChart/VerticalBarChart.js +27 -4
  15. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  16. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +61 -44
  17. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  18. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +1 -1
  19. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  20. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +143 -64
  21. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  22. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +22 -3
  23. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  24. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +174 -113
  25. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  26. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +25 -5
  27. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  28. package/lib-commonjs/components/ScatterChart/ScatterChart.js +4 -2
  29. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  30. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +26 -3
  31. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  32. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +60 -43
  33. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  34. package/package.json +12 -12
package/CHANGELOG.md CHANGED
@@ -1,28 +1,61 @@
1
1
  # Change Log - @fluentui/react-charts
2
2
 
3
- This log was last generated on Wed, 20 Aug 2025 04:21:02 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 22 Aug 2025 04:22:03 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20250820-0406.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v0.0.0-nightly-20250820-0406.1)
7
+ ## [0.0.0-nightly-20250822-0407.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v0.0.0-nightly-20250822-0407.1)
8
8
 
9
- Wed, 20 Aug 2025 04:21:02 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.2.2..@fluentui/react-charts_v0.0.0-nightly-20250820-0406.1)
9
+ Fri, 22 Aug 2025 04:22:03 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.2.3..@fluentui/react-charts_v0.0.0-nightly-20250822-0407.1)
11
11
 
12
12
  ### Changes
13
13
 
14
14
  - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
15
- - Bump @fluentui/react-button to v0.0.0-nightly-20250820-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/c1c2a7adf08d34834453a168af7ede24dc249d38) by beachball)
16
- - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20250820-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/c1c2a7adf08d34834453a168af7ede24dc249d38) by beachball)
17
- - Bump @fluentui/react-overflow to v0.0.0-nightly-20250820-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/c1c2a7adf08d34834453a168af7ede24dc249d38) by beachball)
18
- - Bump @fluentui/react-popover to v0.0.0-nightly-20250820-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/c1c2a7adf08d34834453a168af7ede24dc249d38) by beachball)
19
- - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20250820-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/c1c2a7adf08d34834453a168af7ede24dc249d38) by beachball)
20
- - Bump @fluentui/react-tabster to v0.0.0-nightly-20250820-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/c1c2a7adf08d34834453a168af7ede24dc249d38) by beachball)
21
- - Bump @fluentui/react-theme to v0.0.0-nightly-20250820-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/c1c2a7adf08d34834453a168af7ede24dc249d38) by beachball)
22
- - Bump @fluentui/react-tooltip to v0.0.0-nightly-20250820-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/c1c2a7adf08d34834453a168af7ede24dc249d38) by beachball)
23
- - Bump @fluentui/react-utilities to v0.0.0-nightly-20250820-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/c1c2a7adf08d34834453a168af7ede24dc249d38) by beachball)
24
- - Bump @fluentui/react-conformance to v0.0.0-nightly-20250820-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/c1c2a7adf08d34834453a168af7ede24dc249d38) by beachball)
25
- - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20250820-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/c1c2a7adf08d34834453a168af7ede24dc249d38) by beachball)
15
+ - Bump @fluentui/react-button to v0.0.0-nightly-20250822-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/9214ada4ffc741f67015ead61a4ac0b9a7f2d2a1) by beachball)
16
+ - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20250822-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/9214ada4ffc741f67015ead61a4ac0b9a7f2d2a1) by beachball)
17
+ - Bump @fluentui/react-overflow to v0.0.0-nightly-20250822-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/9214ada4ffc741f67015ead61a4ac0b9a7f2d2a1) by beachball)
18
+ - Bump @fluentui/react-popover to v0.0.0-nightly-20250822-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/9214ada4ffc741f67015ead61a4ac0b9a7f2d2a1) by beachball)
19
+ - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20250822-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/9214ada4ffc741f67015ead61a4ac0b9a7f2d2a1) by beachball)
20
+ - Bump @fluentui/react-tabster to v0.0.0-nightly-20250822-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/9214ada4ffc741f67015ead61a4ac0b9a7f2d2a1) by beachball)
21
+ - Bump @fluentui/react-theme to v0.0.0-nightly-20250822-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/9214ada4ffc741f67015ead61a4ac0b9a7f2d2a1) by beachball)
22
+ - Bump @fluentui/react-tooltip to v0.0.0-nightly-20250822-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/9214ada4ffc741f67015ead61a4ac0b9a7f2d2a1) by beachball)
23
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20250822-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/9214ada4ffc741f67015ead61a4ac0b9a7f2d2a1) by beachball)
24
+ - Bump @fluentui/react-conformance to v0.0.0-nightly-20250822-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/9214ada4ffc741f67015ead61a4ac0b9a7f2d2a1) by beachball)
25
+ - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20250822-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/9214ada4ffc741f67015ead61a4ac0b9a7f2d2a1) by beachball)
26
+
27
+ ## [9.2.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.2.3)
28
+
29
+ Thu, 21 Aug 2025 12:25:29 GMT
30
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.2.2..@fluentui/react-charts_v9.2.3)
31
+
32
+ ### Patches
33
+
34
+ - add labels for text+markers ([PR #35025](https://github.com/microsoft/fluentui/pull/35025) by anushgupta@microsoft.com)
35
+ - fix scatter chart bugs ([PR #35047](https://github.com/microsoft/fluentui/pull/35047) by anushgupta@microsoft.com)
36
+ - update validation to tolerate invalid traces ([PR #34998](https://github.com/microsoft/fluentui/pull/34998) by anushgupta@microsoft.com)
37
+ - support for ordering tick labels ([PR #35053](https://github.com/microsoft/fluentui/pull/35053) by anushgupta@microsoft.com)
38
+ - colorscale support for bar charts ([PR #35026](https://github.com/microsoft/fluentui/pull/35026) by anushgupta@microsoft.com)
39
+ - pie chart fix ([PR #35013](https://github.com/microsoft/fluentui/pull/35013) by anushgupta@microsoft.com)
40
+ - use piecolorway for donut chart ([PR #34999](https://github.com/microsoft/fluentui/pull/34999) by anushgupta@microsoft.com)
41
+ - enable scatter chart in v9 declatative ([PR #35036](https://github.com/microsoft/fluentui/pull/35036) by anushgupta@microsoft.com)
42
+ - support for using opacity provided in plotly schema ([PR #35045](https://github.com/microsoft/fluentui/pull/35045) by anushgupta@microsoft.com)
43
+ - add date axis support in vsbc ([PR #35018](https://github.com/microsoft/fluentui/pull/35018) by anushgupta@microsoft.com)
44
+ - add support for multiplot declarative chart ([PR #35038](https://github.com/microsoft/fluentui/pull/35038) by anushgupta@microsoft.com)
45
+ - add styles to tables ([PR #35012](https://github.com/microsoft/fluentui/pull/35012) by anushgupta@microsoft.com)
46
+ - remove duplicated legends in line chart ([PR #34991](https://github.com/microsoft/fluentui/pull/34991) by anushgupta@microsoft.com)
47
+ - fix color issue in gvbc ([PR #35050](https://github.com/microsoft/fluentui/pull/35050) by anushgupta@microsoft.com)
48
+ - support for lines+markers ([PR #34997](https://github.com/microsoft/fluentui/pull/34997) by anushgupta@microsoft.com)
49
+ - use schema colorscale for gvbc ([PR #35011](https://github.com/microsoft/fluentui/pull/35011) by anushgupta@microsoft.com)
50
+ - add support for string y axis in VSBC ([PR #35016](https://github.com/microsoft/fluentui/pull/35016) by anushgupta@microsoft.com)
51
+ - Bump @fluentui/react-button to v9.6.5 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
52
+ - Bump @fluentui/react-jsx-runtime to v9.1.6 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
53
+ - Bump @fluentui/react-overflow to v9.5.5 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
54
+ - Bump @fluentui/react-popover to v9.12.5 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
55
+ - Bump @fluentui/react-shared-contexts to v9.25.0 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
56
+ - Bump @fluentui/react-tabster to v9.26.4 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
57
+ - Bump @fluentui/react-tooltip to v9.8.4 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
58
+ - Bump @fluentui/react-utilities to v9.24.0 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
26
59
 
27
60
  ## [9.2.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.2.2)
28
61
 
@@ -84,7 +84,7 @@ export const extractColor = (colorway, colorwayType, colors, colorMap, isDarkThe
84
84
  };
85
85
  export const resolveColor = (extractedColors, index, legend, colorMap, isDarkTheme)=>{
86
86
  let color = '';
87
- if (extractedColors && isArrayOrTypedArray(extractedColors)) {
87
+ if (extractedColors && isArrayOrTypedArray(extractedColors) && extractedColors.length > 0) {
88
88
  color = extractedColors[index % extractedColors.length];
89
89
  } else if (typeof extractedColors === 'string') {
90
90
  color = extractedColors;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/DeclarativeChart/PlotlyColorAdapter.ts"],"sourcesContent":["import * as React from 'react';\nimport { color as d3Color } from 'd3-color';\nimport type { PieColors, Color, PlotData } from '@fluentui/chart-utilities';\nimport { isArrayOrTypedArray } from '@fluentui/chart-utilities';\nimport { areArraysEqual } from '../../utilities/utilities';\nimport { DataVizPalette, getColorFromToken, getNextColor } from '../../utilities/colors';\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)) {\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"],"names":["React","color","d3Color","isArrayOrTypedArray","areArraysEqual","DataVizPalette","getColorFromToken","getNextColor","DEFAULT_PLOTLY_COLORWAY","PLOTLY_FLUENTVIZ_COLORWAY_MAPPING","color1","warning","color8","color4","color7","color6","color2","color5","color9","color10","getPlotlyColorway","colorway","isPlotlyColorway","map","c","toLowerCase","tryMapFluentDataViz","hexColor","templateColorway","isDarkTheme","index","indexOf","getColor","legendLabel","colorMap","current","has","nextColor","size","length","set","get","getSchemaColors","colors","hexColors","undefined","forEach","element","colorString","toString","trim","nextFluentColor","parsedColor","push","formatHex","extractColor","colorwayType","resolveColor","extractedColors","legend","getOpacity","series","marker","opacity"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,SAASC,OAAO,QAAQ,WAAW;AAE5C,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,SAASC,cAAc,EAAEC,iBAAiB,EAAEC,YAAY,QAAQ,yBAAyB;AAQzF,MAAMC,0BAA0B;IAC9B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,oCAAoC;IACxCJ,eAAeK,MAAM;IACrBL,eAAeM,OAAO;IACtBN,eAAeO,MAAM;IACrBP,eAAeQ,MAAM;IACrBR,eAAeS,MAAM;IACrBT,eAAeU,MAAM;IACrBV,eAAeW,MAAM;IACrBX,eAAeY,MAAM;IACrBZ,eAAea,MAAM;IACrBb,eAAec,OAAO;CACvB;AAED,SAASC,kBAAkBC,QAA8B;IACvD,MAAMC,mBACJnB,oBAAoBkB,aACpBjB,eACEiB,qBAAAA,+BAAAA,SAAUE,GAAG,CAACC,CAAAA,IAAKA,EAAEC,WAAW,KAChCjB;IAGJ,OAAOc,mBAAmB,WAAW;AACvC;AAEA,SAASI,oBAAoBC,QAAgB,EAAEC,gBAAgC,EAAEC,WAAqB;IACpG,IAAID,qBAAqB,UAAU;QACjC,OAAOD;IACT;IACA,MAAMG,QAAQtB,wBAAwBuB,OAAO,CAACJ,SAASF,WAAW;IAClE,IAAIK,UAAU,CAAC,GAAG;QAChB,OAAOxB,kBAAkBG,iCAAiC,CAACqB,MAAM,EAAED;IACrE;IACA,OAAOF;AACT;AAEA,OAAO,MAAMK,WAAW,CACtBC,aACAC,UACAL;IAEA,IAAI,CAACK,SAASC,OAAO,CAACC,GAAG,CAACH,cAAc;QACtC,IAAII;QACJ,IAAIH,SAASC,OAAO,CAACG,IAAI,GAAG7B,kCAAkC8B,MAAM,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CAC1BC,iBACA5B,OACA6B,QACAzB,UACAL;IAEA,IAAI5B,QAAQ;IACZ,IAAIyD,mBAAmBvD,oBAAoBuD,kBAAkB;QAC3DzD,QAAQyD,eAAe,CAAC5B,QAAQ4B,gBAAgBnB,MAAM,CAAC;IACzD,OAAO,IAAI,OAAOmB,oBAAoB,UAAU;QAC9CzD,QAAQyD;IACV,OAAO;QACLzD,QAAQ+B,SAAS2B,QAAQzB,UAAUL;IACrC;IACA,OAAO5B;AACT,EAAE;AAEF,OAAO,MAAM2D,aAAa,CAACC,QAA2B/B;QAC7C+B,gBACiBA,iBACjBA,iBAA6CA,iBAC7CA;QACHA;IAJJ,OAAOA,EAAAA,iBAAAA,OAAOC,MAAM,cAAbD,qCAAAA,eAAeE,OAAO,IACzB5D,qBAAoB0D,kBAAAA,OAAOC,MAAM,cAAbD,sCAAAA,gBAAeE,OAAO,IACxC,EAACF,kBAAAA,OAAOC,MAAM,cAAbD,sCAAAA,gBAAeE,OAAO,CAAa,CAACjC,QAAQ,EAAC+B,kBAAAA,OAAOC,MAAM,cAAbD,sCAAAA,gBAAeE,OAAO,EAAcxB,MAAM,CAAC,IACxFsB,kBAAAA,OAAOC,MAAM,cAAbD,sCAAAA,gBAAeE,OAAO,GACzBF,CAAAA,kBAAAA,OAAOE,OAAO,cAAdF,6BAAAA,kBAAkB;AACxB,EAAE"}
1
+ {"version":3,"sources":["../src/components/DeclarativeChart/PlotlyColorAdapter.ts"],"sourcesContent":["import * as React from 'react';\nimport { color as d3Color } from 'd3-color';\nimport type { PieColors, Color, PlotData } from '@fluentui/chart-utilities';\nimport { isArrayOrTypedArray } from '@fluentui/chart-utilities';\nimport { areArraysEqual } from '../../utilities/utilities';\nimport { DataVizPalette, getColorFromToken, getNextColor } from '../../utilities/colors';\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"],"names":["React","color","d3Color","isArrayOrTypedArray","areArraysEqual","DataVizPalette","getColorFromToken","getNextColor","DEFAULT_PLOTLY_COLORWAY","PLOTLY_FLUENTVIZ_COLORWAY_MAPPING","color1","warning","color8","color4","color7","color6","color2","color5","color9","color10","getPlotlyColorway","colorway","isPlotlyColorway","map","c","toLowerCase","tryMapFluentDataViz","hexColor","templateColorway","isDarkTheme","index","indexOf","getColor","legendLabel","colorMap","current","has","nextColor","size","length","set","get","getSchemaColors","colors","hexColors","undefined","forEach","element","colorString","toString","trim","nextFluentColor","parsedColor","push","formatHex","extractColor","colorwayType","resolveColor","extractedColors","legend","getOpacity","series","marker","opacity"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,SAASC,OAAO,QAAQ,WAAW;AAE5C,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,SAASC,cAAc,EAAEC,iBAAiB,EAAEC,YAAY,QAAQ,yBAAyB;AAQzF,MAAMC,0BAA0B;IAC9B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,oCAAoC;IACxCJ,eAAeK,MAAM;IACrBL,eAAeM,OAAO;IACtBN,eAAeO,MAAM;IACrBP,eAAeQ,MAAM;IACrBR,eAAeS,MAAM;IACrBT,eAAeU,MAAM;IACrBV,eAAeW,MAAM;IACrBX,eAAeY,MAAM;IACrBZ,eAAea,MAAM;IACrBb,eAAec,OAAO;CACvB;AAED,SAASC,kBAAkBC,QAA8B;IACvD,MAAMC,mBACJnB,oBAAoBkB,aACpBjB,eACEiB,qBAAAA,+BAAAA,SAAUE,GAAG,CAACC,CAAAA,IAAKA,EAAEC,WAAW,KAChCjB;IAGJ,OAAOc,mBAAm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CAAAA,gBAAeE,OAAO,GACzBF,CAAAA,kBAAAA,OAAOE,OAAO,cAAdF,6BAAAA,kBAAkB;AACxB,EAAE"}
@@ -4,7 +4,7 @@ import { scaleLinear as d3ScaleLinear } from 'd3-scale';
4
4
  import { format as d3Format } from 'd3-format';
5
5
  import { DataVizPalette, getColorFromToken } from '../../utilities/colors';
6
6
  import { findNumericMinMaxOfY, formatScientificLimitWidth, MIN_DONUT_RADIUS } from '../../utilities/utilities';
7
- import { isArrayOrTypedArray, isDate, isDateArray, isNumberArray, isStringArray, isYearArray, isInvalidValue } from '@fluentui/chart-utilities';
7
+ import { isArrayOrTypedArray, isDate, isDateArray, isNumberArray, isStringArray, isYearArray, isInvalidValue, formatToLocaleString } from '@fluentui/chart-utilities';
8
8
  import { curveCardinal as d3CurveCardinal } from 'd3-shape';
9
9
  import { getOpacity, extractColor, resolveColor } from './PlotlyColorAdapter';
10
10
  import { rgb } from 'd3-color';
@@ -56,6 +56,47 @@ function getTitles(layout) {
56
56
  };
57
57
  return titles;
58
58
  }
59
+ const getXAxisTickFormat = (series, layout)=>{
60
+ const xAxis = getXAxisProperties(series, layout);
61
+ if (xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat) {
62
+ return {
63
+ tickFormat: xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat
64
+ };
65
+ }
66
+ return {};
67
+ };
68
+ const getYAxisTickFormat = (series, layout)=>{
69
+ const yAxis = getYAxisProperties(series, layout);
70
+ if (yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat) {
71
+ return {
72
+ yAxisTickFormat: d3Format(yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat)
73
+ };
74
+ }
75
+ return {};
76
+ };
77
+ const getYMinMaxValues = (series, layout)=>{
78
+ var _getYAxisProperties;
79
+ const range = (_getYAxisProperties = getYAxisProperties(series, layout)) === null || _getYAxisProperties === void 0 ? void 0 : _getYAxisProperties.range;
80
+ if (range && range.length === 2) {
81
+ return {
82
+ yMinValue: range[0],
83
+ yMaxValue: range[1]
84
+ };
85
+ }
86
+ return {};
87
+ };
88
+ const getYAxisProperties = (series, layout)=>{
89
+ return layout === null || layout === void 0 ? void 0 : layout.yaxis;
90
+ };
91
+ const getXAxisProperties = (series, layout)=>{
92
+ return layout === null || layout === void 0 ? void 0 : layout.xaxis;
93
+ };
94
+ const getFormattedCalloutYData = (yVal, yAxisFormat)=>{
95
+ if (typeof (yAxisFormat === null || yAxisFormat === void 0 ? void 0 : yAxisFormat.yAxisTickFormat) === 'function' && typeof yVal === 'number') {
96
+ return yAxisFormat.yAxisTickFormat(yVal);
97
+ }
98
+ return formatToLocaleString(yVal);
99
+ };
59
100
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
60
101
  export const correctYearMonth = (xValues)=>{
61
102
  const presentYear = new Date().getFullYear();
@@ -219,6 +260,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
219
260
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
220
261
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
221
262
  let colorScale = undefined;
263
+ const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
222
264
  let yMinValue = 0;
223
265
  input.data.forEach((series, index1)=>{
224
266
  var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3, _input_layout_template_layout1, _input_layout_template1, _input_layout2, _series_line;
@@ -252,6 +294,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
252
294
  const color = colorScale ? colorScale(isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedBarColors, index2, legend, colorMap, isDarkTheme);
253
295
  const opacity = getOpacity(series, index2);
254
296
  const yVal = rangeYValues[index2];
297
+ const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
255
298
  if (series.type === 'bar') {
256
299
  var _rgb_copy_formatHex8;
257
300
  mapXToDataPoints[x].chartData.push({
@@ -259,7 +302,8 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
259
302
  data: yVal,
260
303
  color: (_rgb_copy_formatHex8 = rgb(color).copy({
261
304
  opacity
262
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
305
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
306
+ yAxisCalloutData
263
307
  });
264
308
  if (typeof yVal === 'number') {
265
309
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -281,7 +325,8 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
281
325
  ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
282
326
  mode: series.mode
283
327
  },
284
- useSecondaryYScale: usesSecondaryYScale(series, input.layout)
328
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout),
329
+ yAxisCalloutData
285
330
  });
286
331
  if (!usesSecondaryYScale(series, input.layout) && typeof yVal === 'number') {
287
332
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -292,7 +337,6 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
292
337
  });
293
338
  });
294
339
  });
295
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
296
340
  const vsbcData = Object.values(mapXToDataPoints);
297
341
  var _input_layout_height;
298
342
  return {
@@ -302,9 +346,6 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
302
346
  barWidth: 'auto',
303
347
  yMaxValue,
304
348
  yMinValue,
305
- chartTitle,
306
- xAxisTitle,
307
- yAxisTitle,
308
349
  mode: 'plotly',
309
350
  ...secondaryYAxisValues,
310
351
  wrapXAxisLables: typeof ((_vsbcData_ = vsbcData[0]) === null || _vsbcData_ === void 0 ? void 0 : _vsbcData_.xAxisPoint) === 'string',
@@ -314,7 +355,11 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
314
355
  roundCorners: true,
315
356
  showYAxisLables: true,
316
357
  noOfCharsToTruncate: 20,
317
- showYAxisLablesTooltip: true
358
+ showYAxisLablesTooltip: true,
359
+ ...getTitles(input.layout),
360
+ ...getXAxisTickFormat(input.data[0], input.layout),
361
+ ...yAxisTickFormat,
362
+ ...getAxisCategoryOrderProps(input.data, input.layout)
318
363
  };
319
364
  };
320
365
  const createColorScale = (layout, series)=>{
@@ -337,6 +382,7 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
337
382
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
338
383
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
339
384
  let colorScale = undefined;
385
+ const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
340
386
  input.data.forEach((series, index1)=>{
341
387
  var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3, _series_x;
342
388
  if (((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : (_input_layout_coloraxis_colorscale = _input_layout_coloraxis.colorscale) === null || _input_layout_coloraxis_colorscale === void 0 ? void 0 : _input_layout_coloraxis_colorscale.length) && isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) && ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length > 0 && typeof ((_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[0]) === 'number') {
@@ -359,23 +405,24 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
359
405
  var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
360
406
  const legend = legends[index1];
361
407
  // resolve color for each legend's bars from the colorscale or extracted colors
362
- const color = colorScale ? colorScale(isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedColors, index1, legend, colorMap, isDarkTheme);
408
+ const color = colorScale ? colorScale(isArrayOrTypedArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedColors, index2, legend, colorMap, isDarkTheme);
363
409
  const opacity = getOpacity(series, index2);
410
+ const yVal = series.y[index2];
364
411
  var _rgb_copy_formatHex8;
365
412
  mapXToDataPoints[x].series.push({
366
413
  key: legend,
367
- data: series.y[index2],
414
+ data: yVal,
368
415
  xAxisCalloutData: x,
369
416
  color: (_rgb_copy_formatHex8 = rgb(color).copy({
370
417
  opacity
371
418
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
372
419
  legend,
373
- useSecondaryYScale: usesSecondaryYScale(series, input.layout)
420
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout),
421
+ yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat)
374
422
  });
375
423
  }
376
424
  });
377
425
  });
378
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
379
426
  const gvbcData = Object.values(mapXToDataPoints);
380
427
  var _input_layout_height;
381
428
  return {
@@ -383,15 +430,17 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
383
430
  width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
384
431
  height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
385
432
  barWidth: 'auto',
386
- chartTitle,
387
- xAxisTitle,
388
- yAxisTitle,
389
433
  mode: 'plotly',
390
434
  ...secondaryYAxisValues,
391
435
  hideTickOverlap: true,
392
436
  wrapXAxisLables: typeof ((_gvbcData_ = gvbcData[0]) === null || _gvbcData_ === void 0 ? void 0 : _gvbcData_.name) === 'string',
393
437
  hideLegend,
394
- roundCorners: true
438
+ roundCorners: true,
439
+ ...getTitles(input.layout),
440
+ ...getYMinMaxValues(input.data[0], input.layout),
441
+ ...getXAxisTickFormat(input.data[0], input.layout),
442
+ ...yAxisTickFormat,
443
+ ...getAxisCategoryOrderProps(input.data, input.layout)
395
444
  };
396
445
  };
397
446
  export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -457,21 +506,20 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
457
506
  });
458
507
  });
459
508
  });
460
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
461
509
  var _input_layout_height;
462
510
  return {
463
511
  data: vbcData,
464
512
  width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
465
513
  height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
466
- chartTitle,
467
- xAxisTitle,
468
- yAxisTitle,
469
514
  mode: 'histogram',
470
515
  hideTickOverlap: true,
471
516
  wrapXAxisLables: typeof ((_vbcData_ = vbcData[0]) === null || _vbcData_ === void 0 ? void 0 : _vbcData_.x) === 'string',
472
517
  maxBarWidth: 50,
473
518
  hideLegend,
474
- roundCorners: true
519
+ roundCorners: true,
520
+ ...getTitles(input.layout),
521
+ ...getYMinMaxValues(input.data[0], input.layout),
522
+ ...getAxisCategoryOrderProps(input.data, input.layout)
475
523
  };
476
524
  };
477
525
  export const transformPlotlyJsonToAreaChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -484,7 +532,7 @@ export const transformPlotlyJsonToScatterChartProps = (input, isMultiPlot, color
484
532
  return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
485
533
  };
486
534
  const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme)=>{
487
- var _input_data_;
535
+ var _input_data_, _input_layout, _input_layout1;
488
536
  const isScatterMarkers = [
489
537
  'markers',
490
538
  'text+markers',
@@ -498,6 +546,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
498
546
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
499
547
  let mode = 'tonexty';
500
548
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
549
+ const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
501
550
  const chartData = input.data.map((series, index)=>{
502
551
  var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _series_mode1;
503
552
  const colors = isScatterMarkers ? (series === null || series === void 0 ? void 0 : (_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('line')) ? (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color : (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color : (_series_line1 = series.line) === null || _series_line1 === void 0 ? void 0 : _series_line1.color;
@@ -538,7 +587,8 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
538
587
  } : {},
539
588
  ...textValues ? {
540
589
  text: textValues[i]
541
- } : {}
590
+ } : {},
591
+ yAxisCalloutData: getFormattedCalloutYData(rangeYValues[i], yAxisTickFormat)
542
592
  };
543
593
  }),
544
594
  color: (_rgb_copy_formatHex8 = rgb(seriesColor).copy({
@@ -552,52 +602,45 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
552
602
  };
553
603
  });
554
604
  }).flat();
555
- const yMinMaxValues = findNumericMinMaxOfY(chartData);
556
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
605
+ const yMinMax = getYMinMaxValues(input.data[0], input.layout);
606
+ if (yMinMax.yMinValue === undefined && yMinMax.yMaxValue === undefined) {
607
+ const yMinMaxValues = findNumericMinMaxOfY(chartData);
608
+ yMinMax.yMinValue = yMinMaxValues.startValue;
609
+ yMinMax.yMaxValue = yMinMaxValues.endValue;
610
+ }
557
611
  const numDataPoints = chartData.reduce((total, lineChartPoints)=>total + lineChartPoints.data.length, 0);
558
612
  const chartProps = {
559
- chartTitle,
560
613
  lineChartData: chartData
561
614
  };
562
615
  const scatterChartProps = {
563
- chartTitle,
564
616
  scatterChartData: chartData
565
617
  };
618
+ var _input_layout_height;
619
+ const commonProps = {
620
+ supportNegativeData: true,
621
+ ...secondaryYAxisValues,
622
+ width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
623
+ height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
624
+ hideTickOverlap: true,
625
+ hideLegend,
626
+ useUTC: false,
627
+ optimizeLargeData: numDataPoints > 1000,
628
+ ...getTitles(input.layout),
629
+ ...getXAxisTickFormat(input.data[0], input.layout),
630
+ ...yAxisTickFormat
631
+ };
566
632
  if (isAreaChart) {
567
- var _input_layout, _input_layout1;
568
- var _input_layout_height;
569
633
  return {
570
634
  data: chartProps,
571
- supportNegativeData: true,
572
- xAxisTitle,
573
- yAxisTitle,
574
- ...secondaryYAxisValues,
575
635
  mode,
576
- width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
577
- height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
578
- hideTickOverlap: true,
579
- useUTC: false,
580
- hideLegend,
581
- optimizeLargeData: numDataPoints > 1000
636
+ ...commonProps
582
637
  };
583
638
  } else {
584
- var _input_layout2, _input_layout3;
585
- var _input_layout_height1;
586
639
  return {
587
640
  data: isScatterChart ? scatterChartProps : chartProps,
588
- supportNegativeData: true,
589
- xAxisTitle,
590
- yAxisTitle,
591
- ...secondaryYAxisValues,
592
641
  roundedTicks: true,
593
- yMinValue: yMinMaxValues.startValue,
594
- yMaxValue: yMinMaxValues.endValue,
595
- width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
596
- height: (_input_layout_height1 = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.height) !== null && _input_layout_height1 !== void 0 ? _input_layout_height1 : 350,
597
- hideTickOverlap: true,
598
- useUTC: false,
599
- hideLegend,
600
- optimizeLargeData: numDataPoints > 1000
642
+ ...commonProps,
643
+ ...yMinMax
601
644
  };
602
645
  }
603
646
  };
@@ -631,8 +674,7 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPl
631
674
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
632
675
  };
633
676
  }).filter((point)=>point !== null);
634
- }).reverse().flat()//reversing the order to invert the Y bars order as required by plotly.
635
- .reverse();
677
+ }).flat();
636
678
  var _input_layout_height;
637
679
  const chartHeight = (_input_layout_height = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 450;
638
680
  var _input_layout_margin_l;
@@ -644,12 +686,8 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPl
644
686
  const scalingFactor = 0.01;
645
687
  const gapFactor = 1 / (1 + scalingFactor * numberOfRows);
646
688
  const barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
647
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
648
689
  return {
649
690
  data: chartData,
650
- chartTitle,
651
- xAxisTitle,
652
- yAxisTitle,
653
691
  secondaryYAxistitle: typeof ((_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_yaxis2 = _input_layout3.yaxis2) === null || _input_layout_yaxis2 === void 0 ? void 0 : _input_layout_yaxis2.title) === 'string' ? (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_yaxis21 = _input_layout4.yaxis2) === null || _input_layout_yaxis21 === void 0 ? void 0 : _input_layout_yaxis21.title : ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_yaxis22 = _input_layout5.yaxis2) === null || _input_layout_yaxis22 === void 0 ? void 0 : (_input_layout_yaxis2_title = _input_layout_yaxis22.title) === null || _input_layout_yaxis2_title === void 0 ? void 0 : _input_layout_yaxis2_title.text) || '',
654
692
  barHeight,
655
693
  showYAxisLables: true,
@@ -659,7 +697,9 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPl
659
697
  noOfCharsToTruncate: 20,
660
698
  showYAxisLablesTooltip: true,
661
699
  hideLegend,
662
- roundCorners: true
700
+ roundCorners: true,
701
+ ...getTitles(input.layout),
702
+ ...getAxisCategoryOrderProps(input.data, input.layout)
663
703
  };
664
704
  };
665
705
  export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -773,7 +813,6 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
773
813
  }
774
814
  const domainValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[0] * (zMax - zMin) + zMin) : defaultDomain;
775
815
  const rangeValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[1]) : defaultRange;
776
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
777
816
  var _input_layout_height;
778
817
  return {
779
818
  data: [
@@ -783,16 +822,17 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
783
822
  rangeValuesForColorScale,
784
823
  hideLegend: true,
785
824
  showYAxisLables: true,
786
- chartTitle,
787
- xAxisTitle,
788
- yAxisTitle,
789
825
  sortOrder: 'none',
790
826
  width: (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.width,
791
827
  height: (_input_layout_height = (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
792
828
  hideTickOverlap: true,
793
829
  noOfCharsToTruncate: 20,
794
830
  showYAxisLablesTooltip: true,
795
- wrapXAxisLables: true
831
+ wrapXAxisLables: true,
832
+ ...getTitles(input.layout),
833
+ ...getAxisCategoryOrderProps([
834
+ firstData
835
+ ], input.layout)
796
836
  };
797
837
  };
798
838
  export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -1518,3 +1558,42 @@ export const getGridProperties = (layout, isMultiPlot)=>{
1518
1558
  layout: reversedGridLayout
1519
1559
  };
1520
1560
  };
1561
+ /**
1562
+ * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/category_order_defaults.js#L50}
1563
+ */ const getAxisCategoryOrderProps = (data, layout)=>{
1564
+ const result = {};
1565
+ const axesById = {
1566
+ x: layout === null || layout === void 0 ? void 0 : layout.xaxis,
1567
+ y: layout === null || layout === void 0 ? void 0 : layout.yaxis
1568
+ };
1569
+ Object.keys(axesById).forEach((axId)=>{
1570
+ const ax = axesById[axId];
1571
+ const axLetter = axId[0];
1572
+ const propName = `${axLetter}AxisCategoryOrder`;
1573
+ const values = [];
1574
+ data.forEach((series)=>{
1575
+ var _series_axLetter;
1576
+ (_series_axLetter = series[axLetter]) === null || _series_axLetter === void 0 ? void 0 : _series_axLetter.forEach((val)=>{
1577
+ if (!isInvalidValue(val)) {
1578
+ values.push(val);
1579
+ }
1580
+ });
1581
+ });
1582
+ const isAxisTypeCategory = (ax === null || ax === void 0 ? void 0 : ax.type) === 'category' || isStringArray(values) && !isNumberArray(values) && !isDateArray(values);
1583
+ if (!isAxisTypeCategory) {
1584
+ return;
1585
+ }
1586
+ const isValidArray = isArrayOrTypedArray(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
1587
+ if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
1588
+ result[propName] = ax.categoryarray;
1589
+ return;
1590
+ }
1591
+ if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
1592
+ const categoriesInTraceOrder = Array.from(new Set(values));
1593
+ result[propName] = categoriesInTraceOrder;
1594
+ return;
1595
+ }
1596
+ result[propName] = ax.categoryorder;
1597
+ });
1598
+ return result;
1599
+ };