@fluentui/react-charting 5.23.88 → 5.23.89

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 (104) hide show
  1. package/CHANGELOG.json +40 -1
  2. package/CHANGELOG.md +15 -2
  3. package/dist/react-charting.d.ts +72 -6
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +37 -1
  7. package/lib/ChartTable.d.ts +1 -0
  8. package/lib/ChartTable.js +2 -0
  9. package/lib/ChartTable.js.map +1 -0
  10. package/lib/components/ChartTable/ChartTable.base.d.ts +10 -0
  11. package/lib/components/ChartTable/ChartTable.base.js +44 -0
  12. package/lib/components/ChartTable/ChartTable.base.js.map +1 -0
  13. package/lib/components/ChartTable/ChartTable.d.ts +7 -0
  14. package/lib/components/ChartTable/ChartTable.js +9 -0
  15. package/lib/components/ChartTable/ChartTable.js.map +1 -0
  16. package/lib/components/ChartTable/ChartTable.styles.d.ts +2 -0
  17. package/lib/components/ChartTable/ChartTable.styles.js +28 -0
  18. package/lib/components/ChartTable/ChartTable.styles.js.map +1 -0
  19. package/lib/components/ChartTable/ChartTable.types.d.ts +58 -0
  20. package/lib/components/ChartTable/ChartTable.types.js +2 -0
  21. package/lib/components/ChartTable/ChartTable.types.js.map +1 -0
  22. package/lib/components/ChartTable/index.d.ts +2 -0
  23. package/lib/components/ChartTable/index.js +3 -0
  24. package/lib/components/ChartTable/index.js.map +1 -0
  25. package/lib/components/DeclarativeChart/DeclarativeChart.d.ts +7 -6
  26. package/lib/components/DeclarativeChart/DeclarativeChart.js +15 -12
  27. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  28. package/lib/components/DeclarativeChart/PlotlyColorAdapter.d.ts +7 -0
  29. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +103 -0
  30. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
  31. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -13
  32. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +141 -120
  33. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  34. package/lib/index.d.ts +2 -0
  35. package/lib/index.js +1 -0
  36. package/lib/index.js.map +1 -1
  37. package/lib/utilities/image-export-utils.js +25 -3
  38. package/lib/utilities/image-export-utils.js.map +1 -1
  39. package/lib-amd/ChartTable.d.ts +1 -0
  40. package/lib-amd/ChartTable.js +6 -0
  41. package/lib-amd/ChartTable.js.map +1 -0
  42. package/lib-amd/components/ChartTable/ChartTable.base.d.ts +10 -0
  43. package/lib-amd/components/ChartTable/ChartTable.base.js +45 -0
  44. package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -0
  45. package/lib-amd/components/ChartTable/ChartTable.d.ts +7 -0
  46. package/lib-amd/components/ChartTable/ChartTable.js +11 -0
  47. package/lib-amd/components/ChartTable/ChartTable.js.map +1 -0
  48. package/lib-amd/components/ChartTable/ChartTable.styles.d.ts +2 -0
  49. package/lib-amd/components/ChartTable/ChartTable.styles.js +32 -0
  50. package/lib-amd/components/ChartTable/ChartTable.styles.js.map +1 -0
  51. package/lib-amd/components/ChartTable/ChartTable.types.d.ts +58 -0
  52. package/lib-amd/components/ChartTable/ChartTable.types.js +5 -0
  53. package/lib-amd/components/ChartTable/ChartTable.types.js.map +1 -0
  54. package/lib-amd/components/ChartTable/index.d.ts +2 -0
  55. package/lib-amd/components/ChartTable/index.js +7 -0
  56. package/lib-amd/components/ChartTable/index.js.map +1 -0
  57. package/lib-amd/components/DeclarativeChart/DeclarativeChart.d.ts +7 -6
  58. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +14 -12
  59. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  60. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +7 -0
  61. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +108 -0
  62. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
  63. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -13
  64. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +143 -124
  65. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  66. package/lib-amd/index.d.ts +2 -0
  67. package/lib-amd/index.js +3 -2
  68. package/lib-amd/index.js.map +1 -1
  69. package/lib-amd/utilities/image-export-utils.js +25 -3
  70. package/lib-amd/utilities/image-export-utils.js.map +1 -1
  71. package/lib-commonjs/ChartTable.d.ts +1 -0
  72. package/lib-commonjs/ChartTable.js +5 -0
  73. package/lib-commonjs/ChartTable.js.map +1 -0
  74. package/lib-commonjs/components/ChartTable/ChartTable.base.d.ts +10 -0
  75. package/lib-commonjs/components/ChartTable/ChartTable.base.js +47 -0
  76. package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -0
  77. package/lib-commonjs/components/ChartTable/ChartTable.d.ts +7 -0
  78. package/lib-commonjs/components/ChartTable/ChartTable.js +12 -0
  79. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -0
  80. package/lib-commonjs/components/ChartTable/ChartTable.styles.d.ts +2 -0
  81. package/lib-commonjs/components/ChartTable/ChartTable.styles.js +32 -0
  82. package/lib-commonjs/components/ChartTable/ChartTable.styles.js.map +1 -0
  83. package/lib-commonjs/components/ChartTable/ChartTable.types.d.ts +58 -0
  84. package/lib-commonjs/components/ChartTable/ChartTable.types.js +3 -0
  85. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -0
  86. package/lib-commonjs/components/ChartTable/index.d.ts +2 -0
  87. package/lib-commonjs/components/ChartTable/index.js +6 -0
  88. package/lib-commonjs/components/ChartTable/index.js.map +1 -0
  89. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.d.ts +7 -6
  90. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +14 -11
  91. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  92. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +7 -0
  93. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +110 -0
  94. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
  95. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -13
  96. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +143 -124
  97. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  98. package/lib-commonjs/index.d.ts +2 -0
  99. package/lib-commonjs/index.js +3 -1
  100. package/lib-commonjs/index.js.map +1 -1
  101. package/lib-commonjs/utilities/image-export-utils.js +25 -3
  102. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  103. package/package.json +2 -2
  104. package/src/components/ChartTable/ChartTable.types.ts +68 -0
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveColor = exports.extractColor = exports.getSchemaColors = exports.getColor = void 0;
4
+ var d3_color_1 = require("d3-color");
5
+ var chart_utilities_1 = require("@fluentui/chart-utilities");
6
+ var utilities_1 = require("../../utilities/utilities");
7
+ var colors_1 = require("../../utilities/colors");
8
+ var DEFAULT_PLOTLY_COLORWAY = [
9
+ '#636efa', //1
10
+ '#ef553b', //2
11
+ '#00cc96', //3
12
+ '#ab63fa', //4
13
+ '#ffa15a', //5
14
+ '#19d3f3', //6
15
+ '#ff6692', //7
16
+ '#b6e880', //8
17
+ '#ff97ff', //9
18
+ '#fecb52', //10
19
+ ];
20
+ var PLOTLY_FLUENTVIZ_COLORWAY_MAPPING = [
21
+ colors_1.DataVizPalette.color1, //1
22
+ colors_1.DataVizPalette.warning, //2
23
+ colors_1.DataVizPalette.color8, //3
24
+ colors_1.DataVizPalette.color4, //4
25
+ colors_1.DataVizPalette.color7, //5
26
+ colors_1.DataVizPalette.color6, //6
27
+ colors_1.DataVizPalette.color2, //7
28
+ colors_1.DataVizPalette.color5, //8
29
+ colors_1.DataVizPalette.color9, //9
30
+ colors_1.DataVizPalette.color10, //10
31
+ ];
32
+ function getPlotlyColorway(colorway) {
33
+ var isPlotlyColorway = (0, chart_utilities_1.isArrayOrTypedArray)(colorway) &&
34
+ (0, utilities_1.areArraysEqual)(colorway === null || colorway === void 0 ? void 0 : colorway.map(function (c) { return c.toLowerCase(); }), DEFAULT_PLOTLY_COLORWAY);
35
+ return isPlotlyColorway ? 'plotly' : 'others';
36
+ }
37
+ function tryMapFluentDataViz(hexColor, templateColorway, isDarkTheme) {
38
+ if (templateColorway !== 'plotly') {
39
+ return hexColor;
40
+ }
41
+ var index = DEFAULT_PLOTLY_COLORWAY.indexOf(hexColor.toLowerCase());
42
+ if (index !== -1) {
43
+ return (0, colors_1.getColorFromToken)(PLOTLY_FLUENTVIZ_COLORWAY_MAPPING[index], isDarkTheme);
44
+ }
45
+ return hexColor;
46
+ }
47
+ var getColor = function (legendLabel, colorMap, isDarkTheme) {
48
+ if (!colorMap.current.has(legendLabel)) {
49
+ var nextColor = void 0;
50
+ if (colorMap.current.size < PLOTLY_FLUENTVIZ_COLORWAY_MAPPING.length) {
51
+ // Get first 10 colors from plotly-fluentviz colorway mapping
52
+ nextColor = (0, colors_1.getColorFromToken)(PLOTLY_FLUENTVIZ_COLORWAY_MAPPING[colorMap.current.size], isDarkTheme);
53
+ }
54
+ else {
55
+ nextColor = (0, colors_1.getNextColor)(colorMap.current.size, 0, isDarkTheme);
56
+ }
57
+ colorMap.current.set(legendLabel, nextColor);
58
+ return nextColor;
59
+ }
60
+ return colorMap.current.get(legendLabel);
61
+ };
62
+ exports.getColor = getColor;
63
+ var getSchemaColors = function (colorway, colors, colorMap, isDarkTheme) {
64
+ var hexColors = [];
65
+ if (!colors) {
66
+ return undefined;
67
+ }
68
+ var templateColorway = getPlotlyColorway(colorway);
69
+ if ((0, chart_utilities_1.isArrayOrTypedArray)(colors)) {
70
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
+ colors.forEach(function (element, index) {
72
+ var colorString = element === null || element === void 0 ? void 0 : element.toString().trim();
73
+ var nextFluentColor = (0, exports.getColor)("Label_".concat(index), colorMap, isDarkTheme);
74
+ if (colorString) {
75
+ var parsedColor = (0, d3_color_1.color)(colorString);
76
+ hexColors.push(parsedColor ? tryMapFluentDataViz(parsedColor.formatHex(), templateColorway, isDarkTheme) : nextFluentColor);
77
+ }
78
+ else {
79
+ hexColors.push(nextFluentColor);
80
+ }
81
+ });
82
+ }
83
+ else if (typeof colors === 'string') {
84
+ var parsedColor = (0, d3_color_1.color)(colors);
85
+ return parsedColor
86
+ ? tryMapFluentDataViz(parsedColor.formatHex(), templateColorway, isDarkTheme)
87
+ : (0, exports.getColor)('Label_0', colorMap, isDarkTheme);
88
+ }
89
+ return hexColors;
90
+ };
91
+ exports.getSchemaColors = getSchemaColors;
92
+ var extractColor = function (colorway, colorwayType, colors, colorMap, isDarkTheme) {
93
+ return colorwayType === 'default' && colors ? (0, exports.getSchemaColors)(colorway, colors, colorMap, isDarkTheme) : undefined;
94
+ };
95
+ exports.extractColor = extractColor;
96
+ var resolveColor = function (extractedColors, index, legend, colorMap, isDarkTheme) {
97
+ var color = '';
98
+ if (extractedColors && (0, chart_utilities_1.isArrayOrTypedArray)(extractedColors) && extractedColors[index]) {
99
+ color = extractedColors[index % extractedColors.length];
100
+ }
101
+ else if (typeof extractedColors === 'string') {
102
+ color = extractedColors;
103
+ }
104
+ else {
105
+ color = (0, exports.getColor)(legend, colorMap, isDarkTheme);
106
+ }
107
+ return color;
108
+ };
109
+ exports.resolveColor = resolveColor;
110
+ //# sourceMappingURL=PlotlyColorAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlotlyColorAdapter.js","sourceRoot":"../src/","sources":["components/DeclarativeChart/PlotlyColorAdapter.ts"],"names":[],"mappings":";;;AACA,qCAA4C;AAE5C,6DAAgE;AAChE,uDAA2D;AAC3D,iDAAyF;AAQzF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BAAe,EAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACrH,CAAC,CAAC;AARW,QAAA,YAAY,gBAQvB;AAEK,IAAM,YAAY,GAAG,UAC1B,eAAqD,EACrD,KAAa,EACb,MAAc,EACd,QAAqD,EACrD,WAAqB;IAErB,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,eAAe,IAAI,IAAA,qCAAmB,EAAC,eAAe,CAAC,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QACtF,KAAK,GAAG,eAAe,CAAC,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAC1D,CAAC;SAAM,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE,CAAC;QAC/C,KAAK,GAAG,eAAe,CAAC;IAC1B,CAAC;SAAM,CAAC;QACN,KAAK,GAAG,IAAA,gBAAQ,EAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAhBW,QAAA,YAAY,gBAgBvB","sourcesContent":["import * as React from 'react';\nimport { color as d3Color } from 'd3-color';\nimport type { PieColors, Color } 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[index]) {\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"]}
@@ -9,22 +9,22 @@ import { IHeatMapChartProps } from '../HeatMapChart/index';
9
9
  import { IGaugeChartProps } from '../GaugeChart/index';
10
10
  import { IGroupedVerticalBarChartProps } from '../GroupedVerticalBarChart/index';
11
11
  import { IVerticalBarChartProps } from '../VerticalBarChart/index';
12
- import type { Datum, PlotlySchema, TypedArray, PieColors, Color } from '@fluentui/chart-utilities';
12
+ import { IChartTableProps } from '../ChartTable/index';
13
+ import type { Datum, PlotlySchema, TypedArray, Color } from '@fluentui/chart-utilities';
14
+ import type { ColorwayType } from './PlotlyColorAdapter';
13
15
  export declare const isMonthArray: (data: Datum[] | Datum[][] | TypedArray) => boolean;
14
16
  export declare const correctYearMonth: (xValues: Datum[] | Datum[][] | TypedArray) => any[];
15
- export declare const getColor: (legendLabel: string, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => string;
16
- export declare const getSchemaColors: (colors: PieColors | Color | Color[] | string | null | undefined, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => string[] | string | undefined;
17
- export declare const _extractColor: (useFluentVizColorPalette: boolean, colors: PieColors | Color | Color[] | string | null | undefined, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => string | string[] | undefined;
18
- export declare const _resolveColor: (extractedColors: string[] | string | null | undefined, index: number, legend: string, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => string;
19
- export declare const transformPlotlyJsonToDonutProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, useFluentVizColorPalette: boolean, isDarkTheme?: boolean) => IDonutChartProps;
20
- export declare const transformPlotlyJsonToVSBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, useFluentVizColorPalette: boolean, isDarkTheme?: boolean, fallbackVSBC?: boolean) => IVerticalStackedBarChartProps;
21
- export declare const transformPlotlyJsonToGVBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, useFluentVizColorPalette: boolean, isDarkTheme?: boolean) => IGroupedVerticalBarChartProps;
22
- export declare const transformPlotlyJsonToVBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, useFluentVizColorPalette: boolean, isDarkTheme?: boolean) => IVerticalBarChartProps;
23
- export declare const transformPlotlyJsonToScatterChartProps: (input: PlotlySchema, isAreaChart: boolean, colorMap: React.MutableRefObject<Map<string, string>>, useFluentVizColorPalette: boolean, isDarkTheme?: boolean) => ILineChartProps | IAreaChartProps;
24
- export declare const transformPlotlyJsonToHorizontalBarWithAxisProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, useFluentVizColorPalette: boolean, isDarkTheme?: boolean) => IHorizontalBarChartWithAxisProps;
17
+ export declare const _getGaugeAxisColor: (colorway: string[] | undefined, colorwayType: ColorwayType, color: Color | undefined, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => string;
18
+ export declare const transformPlotlyJsonToDonutProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IDonutChartProps;
19
+ export declare const transformPlotlyJsonToVSBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean, fallbackVSBC?: boolean) => IVerticalStackedBarChartProps;
20
+ export declare const transformPlotlyJsonToGVBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IGroupedVerticalBarChartProps;
21
+ export declare const transformPlotlyJsonToVBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IVerticalBarChartProps;
22
+ export declare const transformPlotlyJsonToScatterChartProps: (input: PlotlySchema, isAreaChart: boolean, isScatterMarkers: boolean, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => ILineChartProps | IAreaChartProps;
23
+ export declare const transformPlotlyJsonToHorizontalBarWithAxisProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IHorizontalBarChartWithAxisProps;
25
24
  export declare const transformPlotlyJsonToHeatmapProps: (input: PlotlySchema) => IHeatMapChartProps;
26
- export declare const transformPlotlyJsonToSankeyProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => ISankeyChartProps;
27
- export declare const transformPlotlyJsonToGaugeProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => IGaugeChartProps;
25
+ export declare const transformPlotlyJsonToSankeyProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => ISankeyChartProps;
26
+ export declare const transformPlotlyJsonToGaugeProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IGaugeChartProps;
27
+ export declare const transformPlotlyJsonToChartTableProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => IChartTableProps;
28
28
  export declare const projectPolarToCartesian: (input: PlotlySchema) => PlotlySchema;
29
29
  /**
30
30
  * Interate iteratively through the trace object and find all the array attributes.