@fluentui/react-charting 5.24.2 → 5.24.3

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 (129) hide show
  1. package/CHANGELOG.json +34 -1
  2. package/CHANGELOG.md +14 -2
  3. package/dist/react-charting.d.ts +170 -37
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +58 -11
  7. package/lib/ScatterChart.d.ts +1 -0
  8. package/lib/ScatterChart.js +2 -0
  9. package/lib/ScatterChart.js.map +1 -0
  10. package/lib/components/CommonComponents/CartesianChart.base.js +45 -9
  11. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  12. package/lib/components/CommonComponents/CartesianChart.styles.js +48 -26
  13. package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  14. package/lib/components/CommonComponents/CartesianChart.types.d.ts +21 -1
  15. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  16. package/lib/components/DeclarativeChart/DeclarativeChart.js +157 -78
  17. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  18. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +28 -13
  19. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +252 -62
  20. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  21. package/lib/components/ScatterChart/ScatterChart.base.d.ts +7 -0
  22. package/lib/components/ScatterChart/ScatterChart.base.js +453 -0
  23. package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -0
  24. package/lib/components/ScatterChart/ScatterChart.d.ts +7 -0
  25. package/lib/components/ScatterChart/ScatterChart.js +10 -0
  26. package/lib/components/ScatterChart/ScatterChart.js.map +1 -0
  27. package/lib/components/ScatterChart/ScatterChart.styles.d.ts +2 -0
  28. package/lib/components/ScatterChart/ScatterChart.styles.js +7 -0
  29. package/lib/components/ScatterChart/ScatterChart.styles.js.map +1 -0
  30. package/lib/components/ScatterChart/ScatterChart.types.d.ts +42 -0
  31. package/lib/components/ScatterChart/ScatterChart.types.js +2 -0
  32. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -0
  33. package/lib/components/ScatterChart/index.d.ts +2 -0
  34. package/lib/components/ScatterChart/index.js +3 -0
  35. package/lib/components/ScatterChart/index.js.map +1 -0
  36. package/lib/index.d.ts +3 -1
  37. package/lib/index.js +1 -0
  38. package/lib/index.js.map +1 -1
  39. package/lib/types/IDataPoint.d.ts +73 -11
  40. package/lib/types/IDataPoint.js.map +1 -1
  41. package/lib/utilities/SVGTooltipText.d.ts +4 -0
  42. package/lib/utilities/SVGTooltipText.js +1 -2
  43. package/lib/utilities/SVGTooltipText.js.map +1 -1
  44. package/lib/utilities/utilities.d.ts +27 -3
  45. package/lib/utilities/utilities.js +102 -1
  46. package/lib/utilities/utilities.js.map +1 -1
  47. package/lib-amd/ScatterChart.d.ts +1 -0
  48. package/lib-amd/ScatterChart.js +6 -0
  49. package/lib-amd/ScatterChart.js.map +1 -0
  50. package/lib-amd/components/CommonComponents/CartesianChart.base.js +45 -9
  51. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  52. package/lib-amd/components/CommonComponents/CartesianChart.styles.js +48 -26
  53. package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  54. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +21 -1
  55. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  56. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +155 -78
  57. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  58. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +28 -13
  59. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +264 -71
  60. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  61. package/lib-amd/components/ScatterChart/ScatterChart.base.d.ts +7 -0
  62. package/lib-amd/components/ScatterChart/ScatterChart.base.js +447 -0
  63. package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -0
  64. package/lib-amd/components/ScatterChart/ScatterChart.d.ts +7 -0
  65. package/lib-amd/components/ScatterChart/ScatterChart.js +12 -0
  66. package/lib-amd/components/ScatterChart/ScatterChart.js.map +1 -0
  67. package/lib-amd/components/ScatterChart/ScatterChart.styles.d.ts +2 -0
  68. package/lib-amd/components/ScatterChart/ScatterChart.styles.js +12 -0
  69. package/lib-amd/components/ScatterChart/ScatterChart.styles.js.map +1 -0
  70. package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +42 -0
  71. package/lib-amd/components/ScatterChart/ScatterChart.types.js +5 -0
  72. package/lib-amd/components/ScatterChart/ScatterChart.types.js.map +1 -0
  73. package/lib-amd/components/ScatterChart/index.d.ts +2 -0
  74. package/lib-amd/components/ScatterChart/index.js +7 -0
  75. package/lib-amd/components/ScatterChart/index.js.map +1 -0
  76. package/lib-amd/index.d.ts +3 -1
  77. package/lib-amd/index.js +3 -2
  78. package/lib-amd/index.js.map +1 -1
  79. package/lib-amd/types/IDataPoint.d.ts +73 -11
  80. package/lib-amd/types/IDataPoint.js.map +1 -1
  81. package/lib-amd/utilities/SVGTooltipText.d.ts +4 -0
  82. package/lib-amd/utilities/SVGTooltipText.js +1 -2
  83. package/lib-amd/utilities/SVGTooltipText.js.map +1 -1
  84. package/lib-amd/utilities/utilities.d.ts +27 -3
  85. package/lib-amd/utilities/utilities.js +106 -2
  86. package/lib-amd/utilities/utilities.js.map +1 -1
  87. package/lib-commonjs/ScatterChart.d.ts +1 -0
  88. package/lib-commonjs/ScatterChart.js +5 -0
  89. package/lib-commonjs/ScatterChart.js.map +1 -0
  90. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +45 -9
  91. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  92. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +48 -26
  93. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  94. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +21 -1
  95. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  96. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +157 -78
  97. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  98. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +28 -13
  99. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +263 -71
  100. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  101. package/lib-commonjs/components/ScatterChart/ScatterChart.base.d.ts +7 -0
  102. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +456 -0
  103. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -0
  104. package/lib-commonjs/components/ScatterChart/ScatterChart.d.ts +7 -0
  105. package/lib-commonjs/components/ScatterChart/ScatterChart.js +13 -0
  106. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -0
  107. package/lib-commonjs/components/ScatterChart/ScatterChart.styles.d.ts +2 -0
  108. package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js +11 -0
  109. package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js.map +1 -0
  110. package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +42 -0
  111. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js +3 -0
  112. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -0
  113. package/lib-commonjs/components/ScatterChart/index.d.ts +2 -0
  114. package/lib-commonjs/components/ScatterChart/index.js +6 -0
  115. package/lib-commonjs/components/ScatterChart/index.js.map +1 -0
  116. package/lib-commonjs/index.d.ts +3 -1
  117. package/lib-commonjs/index.js +3 -1
  118. package/lib-commonjs/index.js.map +1 -1
  119. package/lib-commonjs/types/IDataPoint.d.ts +73 -11
  120. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  121. package/lib-commonjs/utilities/SVGTooltipText.d.ts +4 -0
  122. package/lib-commonjs/utilities/SVGTooltipText.js +1 -2
  123. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  124. package/lib-commonjs/utilities/utilities.d.ts +27 -3
  125. package/lib-commonjs/utilities/utilities.js +106 -2
  126. package/lib-commonjs/utilities/utilities.js.map +1 -1
  127. package/package.json +2 -2
  128. package/src/components/CommonComponents/CartesianChart.types.ts +25 -1
  129. package/src/components/ScatterChart/ScatterChart.types.ts +61 -0
@@ -10,22 +10,36 @@ import { IGaugeChartProps } from '../GaugeChart/index';
10
10
  import { IGroupedVerticalBarChartProps } from '../GroupedVerticalBarChart/index';
11
11
  import { IVerticalBarChartProps } from '../VerticalBarChart/index';
12
12
  import { IChartTableProps } from '../ChartTable/index';
13
- import type { Datum, PlotlySchema, PlotData, TypedArray, Color } from '@fluentui/chart-utilities';
13
+ import type { Datum, Layout, PlotlySchema, PlotData, TypedArray, Color } from '@fluentui/chart-utilities';
14
14
  import type { ColorwayType } from './PlotlyColorAdapter';
15
- export declare const isMonthArray: (data: Datum[] | Datum[][] | TypedArray) => boolean;
15
+ import { ILegendsProps } from '../Legends/index';
16
+ export type AxisProperties = {
17
+ xAnnotation?: string;
18
+ yAnnotation?: string;
19
+ row: number;
20
+ column: number;
21
+ };
22
+ export type GridAxisProperties = Record<string, AxisProperties>;
23
+ export type GridProperties = {
24
+ templateRows: string;
25
+ templateColumns: string;
26
+ layout: GridAxisProperties;
27
+ };
16
28
  export declare const correctYearMonth: (xValues: Datum[] | Datum[][] | TypedArray) => any[];
17
29
  export declare const _getGaugeAxisColor: (colorway: string[] | undefined, colorwayType: ColorwayType, color: Color | undefined, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => string;
18
30
  export declare const resolveXAxisPoint: (x: Datum, isXYearCategory: boolean, isXString: boolean, isXDate: boolean, isXNumber: boolean) => string | Date | number;
19
- export declare const transformPlotlyJsonToDonutProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IDonutChartProps;
20
- export declare const transformPlotlyJsonToVSBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean, fallbackVSBC?: boolean) => IVerticalStackedBarChartProps;
21
- export declare const transformPlotlyJsonToGVBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IGroupedVerticalBarChartProps;
22
- export declare const transformPlotlyJsonToVBCProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IVerticalBarChartProps;
23
- export declare const transformPlotlyJsonToScatterChartProps: (input: PlotlySchema, isAreaChart: boolean, isScatterMarkers: boolean, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => ILineChartProps | IAreaChartProps;
24
- export declare const transformPlotlyJsonToHorizontalBarWithAxisProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IHorizontalBarChartWithAxisProps;
25
- export declare const transformPlotlyJsonToHeatmapProps: (input: PlotlySchema) => IHeatMapChartProps;
26
- export declare const transformPlotlyJsonToSankeyProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => ISankeyChartProps;
27
- export declare const transformPlotlyJsonToGaugeProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IGaugeChartProps;
28
- export declare const transformPlotlyJsonToChartTableProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, isDarkTheme?: boolean) => IChartTableProps;
31
+ export declare const transformPlotlyJsonToDonutProps: (input: PlotlySchema, isMultiPlot: boolean, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IDonutChartProps;
32
+ export declare const transformPlotlyJsonToVSBCProps: (input: PlotlySchema, isMultiPlot: boolean, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean, fallbackVSBC?: boolean) => IVerticalStackedBarChartProps;
33
+ export declare const transformPlotlyJsonToGVBCProps: (input: PlotlySchema, isMultiPlot: boolean, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IGroupedVerticalBarChartProps;
34
+ export declare const transformPlotlyJsonToVBCProps: (input: PlotlySchema, isMultiPlot: boolean, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IVerticalBarChartProps;
35
+ export declare const transformPlotlyJsonToAreaChartProps: (input: PlotlySchema, isMultiPlot: boolean, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IAreaChartProps;
36
+ export declare const transformPlotlyJsonToLineChartProps: (input: PlotlySchema, isMultiPlot: boolean, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => ILineChartProps;
37
+ export declare const transformPlotlyJsonToScatterChartProps: (input: PlotlySchema, isMultiPlot: boolean, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => ILineChartProps;
38
+ export declare const transformPlotlyJsonToHorizontalBarWithAxisProps: (input: PlotlySchema, isMultiPlot: boolean, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IHorizontalBarChartWithAxisProps;
39
+ export declare const transformPlotlyJsonToHeatmapProps: (input: PlotlySchema, isMultiPlot: boolean, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IHeatMapChartProps;
40
+ export declare const transformPlotlyJsonToSankeyProps: (input: PlotlySchema, isMultiPlot: boolean, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => ISankeyChartProps;
41
+ export declare const transformPlotlyJsonToGaugeProps: (input: PlotlySchema, isMultiPlot: boolean, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IGaugeChartProps;
42
+ export declare const transformPlotlyJsonToChartTableProps: (input: PlotlySchema, isMultiPlot: boolean, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => IChartTableProps;
29
43
  export declare const projectPolarToCartesian: (input: PlotlySchema) => PlotlySchema;
30
44
  /**
31
45
  * Interate iteratively through the trace object and find all the array attributes.
@@ -33,6 +47,7 @@ export declare const projectPolarToCartesian: (input: PlotlySchema) => PlotlySch
33
47
  * @param trace
34
48
  */
35
49
  export declare function findArrayAttributes(trace: any): void;
36
- export declare const isStringArray: (arr: any) => boolean;
50
+ export declare const getAllupLegendsProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, isDarkTheme?: boolean) => ILegendsProps;
37
51
  export declare const getNumberAtIndexOrDefault: (data: PlotData['z'] | undefined, index: number) => number | undefined;
38
52
  export declare const getValidXYRanges: (series: Partial<PlotData>) => [number, number][];
53
+ export declare const getGridProperties: (layout: Partial<Layout> | undefined, isMultiPlot: boolean) => GridProperties;
@@ -1,7 +1,7 @@
1
- define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../../utilities/colors", "../GaugeChart/index", "../../utilities/utilities", "@fluentui/chart-utilities", "d3-time-format", "d3-shape", "./PlotlyColorAdapter"], function (require, exports, tslib_1, d3_array_1, d3_scale_1, d3_format_1, colors_1, index_1, utilities_1, chart_utilities_1, d3_time_format_1, d3_shape_1, PlotlyColorAdapter_1) {
1
+ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../../utilities/colors", "../GaugeChart/index", "../../utilities/utilities", "@fluentui/chart-utilities", "d3-shape", "./PlotlyColorAdapter"], function (require, exports, tslib_1, d3_array_1, d3_scale_1, d3_format_1, colors_1, index_1, utilities_1, chart_utilities_1, d3_shape_1, PlotlyColorAdapter_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getValidXYRanges = exports.getNumberAtIndexOrDefault = exports.isStringArray = exports.findArrayAttributes = exports.projectPolarToCartesian = exports.transformPlotlyJsonToChartTableProps = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports.resolveXAxisPoint = exports._getGaugeAxisColor = exports.correctYearMonth = exports.isMonthArray = void 0;
4
+ exports.getGridProperties = exports.getValidXYRanges = exports.getNumberAtIndexOrDefault = exports.getAllupLegendsProps = exports.findArrayAttributes = exports.projectPolarToCartesian = exports.transformPlotlyJsonToChartTableProps = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToLineChartProps = exports.transformPlotlyJsonToAreaChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports.resolveXAxisPoint = exports._getGaugeAxisColor = exports.correctYearMonth = void 0;
5
5
  var dashOptions = {
6
6
  dot: {
7
7
  strokeDasharray: '1, 5',
@@ -40,17 +40,6 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
40
40
  lineBorderWidth: '4',
41
41
  },
42
42
  };
43
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
- var isMonth = function (possiblyMonthValue) {
45
- var parseFullMonth = (0, d3_time_format_1.timeParse)('%B');
46
- var parseShortMonth = (0, d3_time_format_1.timeParse)('%b');
47
- return parseFullMonth(possiblyMonthValue) !== null || parseShortMonth(possiblyMonthValue) !== null;
48
- };
49
- var isMonthArray = function (data) {
50
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
51
- return (0, chart_utilities_1.isArrayOfType)(data, function (value) { return isMonth(value) || value === null; });
52
- };
53
- exports.isMonthArray = isMonthArray;
54
43
  function getTitles(layout) {
55
44
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
56
45
  var titles = {
@@ -98,8 +87,9 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
98
87
  return xValues;
99
88
  };
100
89
  exports.correctYearMonth = correctYearMonth;
101
- var usesSecondaryYScale = function (series) {
102
- return series.yaxis === 'y2';
90
+ var usesSecondaryYScale = function (series, layout) {
91
+ var _a, _b;
92
+ return series.yaxis === 'y2' && (((_a = layout === null || layout === void 0 ? void 0 : layout.yaxis2) === null || _a === void 0 ? void 0 : _a.anchor) === 'x' || ((_b = layout === null || layout === void 0 ? void 0 : layout.yaxis2) === null || _b === void 0 ? void 0 : _b.side) === 'right');
103
93
  };
104
94
  var getSecondaryYAxisValues = function (data, layout, maxAllowedMinY, minAllowedMaxY) {
105
95
  var _a, _b, _c, _d;
@@ -107,7 +97,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
107
97
  var yMinValue;
108
98
  var yMaxValue;
109
99
  data.forEach(function (series) {
110
- if (usesSecondaryYScale(series)) {
100
+ if (usesSecondaryYScale(series, layout)) {
111
101
  containsSecondaryYAxis = true;
112
102
  var yValues = series.y;
113
103
  if (yValues) {
@@ -166,7 +156,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
166
156
  return x;
167
157
  };
168
158
  exports.resolveXAxisPoint = resolveXAxisPoint;
169
- var transformPlotlyJsonToDonutProps = function (input, colorMap, colorwayType, isDarkTheme) {
159
+ var transformPlotlyJsonToDonutProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
170
160
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
171
161
  var firstData = input.data[0];
172
162
  // extract colors for each series only once
@@ -219,13 +209,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
219
209
  };
220
210
  };
221
211
  exports.transformPlotlyJsonToDonutProps = transformPlotlyJsonToDonutProps;
222
- var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayType, isDarkTheme, fallbackVSBC) {
212
+ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC) {
223
213
  var _a, _b, _c;
224
214
  var mapXToDataPoints = {};
225
215
  var yMaxValue = 0;
226
216
  var yMinValue = 0;
227
217
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
228
- var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
218
+ var _d = getLegendProps(input.data, input.layout, isMultiPlot), legends = _d.legends, hideLegend = _d.hideLegend;
229
219
  var colorScale = undefined;
230
220
  input.data.forEach(function (series, index1) {
231
221
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
@@ -242,7 +232,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
242
232
  var extractedLineColors = (0, PlotlyColorAdapter_1.extractColor)((_p = (_o = (_m = input.layout) === null || _m === void 0 ? void 0 : _m.template) === null || _o === void 0 ? void 0 : _o.layout) === null || _p === void 0 ? void 0 : _p.colorway, colorwayType, (_q = series.line) === null || _q === void 0 ? void 0 : _q.color, colorMap, isDarkTheme);
243
233
  var xValues = series.x;
244
234
  var isXDate = (0, chart_utilities_1.isDateArray)(xValues);
245
- var isXString = (0, exports.isStringArray)(xValues);
235
+ var isXString = (0, chart_utilities_1.isStringArray)(xValues);
246
236
  var isXNumber = (0, chart_utilities_1.isNumberArray)(xValues);
247
237
  var validXYRanges = (0, exports.getValidXYRanges)(series);
248
238
  validXYRanges.forEach(function (_a, rangeIdx) {
@@ -250,7 +240,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
250
240
  var rangeXValues = series.x.slice(rangeStart, rangeEnd);
251
241
  var rangeYValues = series.y.slice(rangeStart, rangeEnd);
252
242
  rangeXValues.forEach(function (x, index2) {
253
- var _a, _b, _c, _d, _e, _f;
243
+ var _a, _b, _c, _d;
254
244
  if (!mapXToDataPoints[x]) {
255
245
  mapXToDataPoints[x] = {
256
246
  xAxisPoint: (0, exports.resolveXAxisPoint)(x, isXYearCategory, isXString, isXDate, isXNumber),
@@ -279,21 +269,16 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
279
269
  else if (series.type === 'scatter' || !!fallbackVSBC) {
280
270
  var lineColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedLineColors, index1, legend, colorMap, isDarkTheme);
281
271
  var lineOptions = getLineOptions(series.line);
282
- var dashType = ((_e = series.line) === null || _e === void 0 ? void 0 : _e.dash) || 'solid';
283
- var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot'
284
- ? 'dottedLine'
285
- : ((_f = series.mode) === null || _f === void 0 ? void 0 : _f.includes('markers'))
286
- ? 'circle'
287
- : 'default';
272
+ var legendShape = getLegendShape(series);
288
273
  mapXToDataPoints[x].lineData.push({
289
274
  legend: legend + (validXYRanges.length > 1 ? ".".concat(rangeIdx + 1) : ''),
290
275
  legendShape: legendShape,
291
276
  y: yVal,
292
277
  color: lineColor,
293
278
  lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
294
- useSecondaryYScale: usesSecondaryYScale(series),
279
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout),
295
280
  });
296
- if (!usesSecondaryYScale(series) && typeof yVal === 'number') {
281
+ if (!usesSecondaryYScale(series, input.layout) && typeof yVal === 'number') {
297
282
  yMaxValue = Math.max(yMaxValue, yVal);
298
283
  yMinValue = Math.min(yMinValue, yVal);
299
284
  }
@@ -321,11 +306,11 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
321
306
  var scaleColors = scale.map(function (item) { return item[1]; });
322
307
  return (0, d3_scale_1.scaleLinear)().domain(scaleDomain).range(scaleColors);
323
308
  };
324
- var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayType, isDarkTheme) {
309
+ var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
325
310
  var _a, _b, _c;
326
311
  var mapXToDataPoints = {};
327
312
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
328
- var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
313
+ var _d = getLegendProps(input.data, input.layout, isMultiPlot), legends = _d.legends, hideLegend = _d.hideLegend;
329
314
  var colorScale = undefined;
330
315
  input.data.forEach(function (series, index1) {
331
316
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
@@ -359,7 +344,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
359
344
  xAxisCalloutData: x,
360
345
  color: color,
361
346
  legend: legend,
362
- useSecondaryYScale: usesSecondaryYScale(series),
347
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout),
363
348
  });
364
349
  }
365
350
  });
@@ -368,10 +353,10 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
368
353
  return tslib_1.__assign(tslib_1.__assign({ data: Object.values(mapXToDataPoints), width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barwidth: 'auto', chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true });
369
354
  };
370
355
  exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
371
- var transformPlotlyJsonToVBCProps = function (input, colorMap, colorwayType, isDarkTheme) {
356
+ var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
372
357
  var _a, _b, _c;
373
358
  var vbcData = [];
374
- var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
359
+ var _d = getLegendProps(input.data, input.layout, isMultiPlot), legends = _d.legends, hideLegend = _d.hideLegend;
375
360
  var colorScale = undefined;
376
361
  input.data.forEach(function (series, seriesIdx) {
377
362
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
@@ -396,7 +381,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
396
381
  xValues.push(xVal);
397
382
  yValues.push(yVal);
398
383
  });
399
- var isXString = (0, exports.isStringArray)(xValues);
384
+ var isXString = (0, chart_utilities_1.isStringArray)(xValues);
400
385
  // TODO: In case of a single bin, add an empty bin of the same size to prevent the
401
386
  // default bar width from being used and ensure the bar spans the full intended range.
402
387
  var xBins = createBins(xValues, (_m = series.xbins) === null || _m === void 0 ? void 0 : _m.start, (_o = series.xbins) === null || _o === void 0 ? void 0 : _o.end, (_p = series.xbins) === null || _p === void 0 ? void 0 : _p.size);
@@ -445,14 +430,35 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
445
430
  };
446
431
  };
447
432
  exports.transformPlotlyJsonToVBCProps = transformPlotlyJsonToVBCProps;
448
- var transformPlotlyJsonToScatterChartProps = function (input, isAreaChart, isScatterMarkers, colorMap, colorwayType, isDarkTheme) {
449
- var _a, _b, _c, _d, _e, _f;
433
+ var transformPlotlyJsonToAreaChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
434
+ return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'area', colorMap, colorwayType, isDarkTheme);
435
+ };
436
+ exports.transformPlotlyJsonToAreaChartProps = transformPlotlyJsonToAreaChartProps;
437
+ var transformPlotlyJsonToLineChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
438
+ return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'line', colorMap, colorwayType, isDarkTheme);
439
+ };
440
+ exports.transformPlotlyJsonToLineChartProps = transformPlotlyJsonToLineChartProps;
441
+ var transformPlotlyJsonToScatterChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
442
+ return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
443
+ };
444
+ exports.transformPlotlyJsonToScatterChartProps = transformPlotlyJsonToScatterChartProps;
445
+ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme) {
446
+ var _a, _b, _c, _d, _e, _f, _g;
447
+ var isScatterMarkers = [
448
+ 'text+markers',
449
+ 'markers+text',
450
+ 'lines+markers',
451
+ 'markers+line',
452
+ 'text+lines+markers',
453
+ ].includes((_a = input.data[0]) === null || _a === void 0 ? void 0 : _a.mode);
454
+ var isAreaChart = chartType === 'area';
455
+ var isScatterChart = chartType === 'scatter';
450
456
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
451
457
  var mode = 'tonexty';
452
- var _g = getLegendProps(input.data, input.layout), legends = _g.legends, hideLegend = _g.hideLegend;
458
+ var _h = getLegendProps(input.data, input.layout, isMultiPlot), legends = _h.legends, hideLegend = _h.hideLegend;
453
459
  var chartData = input.data
454
460
  .map(function (series, index) {
455
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
461
+ var _a, _b, _c, _d, _e, _f, _g;
456
462
  var colors = isScatterMarkers
457
463
  ? ((_a = series === null || series === void 0 ? void 0 : series.mode) === null || _a === void 0 ? void 0 : _a.includes('line'))
458
464
  ? (_b = series.line) === null || _b === void 0 ? void 0 : _b.color
@@ -461,22 +467,16 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
461
467
  // extract colors for each series only once
462
468
  var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_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, colorwayType, colors, colorMap, isDarkTheme);
463
469
  var xValues = series.x;
464
- var isXString = (0, exports.isStringArray)(xValues);
470
+ var isXString = (0, chart_utilities_1.isStringArray)(xValues);
465
471
  var isXDate = (0, chart_utilities_1.isDateArray)(xValues);
466
472
  var isXNumber = (0, chart_utilities_1.isNumberArray)(xValues);
467
- // string case is not possible for scatter chart as it is already filtered out in declarative chart
468
- var isXYearCategory = false;
473
+ var isXYearCategory = (0, chart_utilities_1.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
469
474
  var legend = legends[index];
470
475
  // resolve color for each legend's lines from the extracted colors
471
476
  var seriesColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
472
477
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
473
478
  var lineOptions = getLineOptions(series.line);
474
- var dashType = ((_h = series.line) === null || _h === void 0 ? void 0 : _h.dash) || 'solid';
475
- var legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot'
476
- ? 'dottedLine'
477
- : ((_j = series.mode) === null || _j === void 0 ? void 0 : _j.includes('markers'))
478
- ? 'circle'
479
- : 'default';
479
+ var legendShape = getLegendShape(series);
480
480
  var validXYRanges = (0, exports.getValidXYRanges)(series);
481
481
  return validXYRanges.map(function (_a, rangeIdx) {
482
482
  var _b;
@@ -500,29 +500,32 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
500
500
  }),
501
501
  color: seriesColor,
502
502
  lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
503
- useSecondaryYScale: usesSecondaryYScale(series),
503
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout),
504
504
  };
505
505
  });
506
506
  })
507
507
  .flat();
508
508
  var yMinMaxValues = (0, utilities_1.findNumericMinMaxOfY)(chartData);
509
- var _h = getTitles(input.layout), chartTitle = _h.chartTitle, xAxisTitle = _h.xAxisTitle, yAxisTitle = _h.yAxisTitle;
509
+ var _j = getTitles(input.layout), chartTitle = _j.chartTitle, xAxisTitle = _j.xAxisTitle, yAxisTitle = _j.yAxisTitle;
510
510
  var numDataPoints = chartData.reduce(function (total, lineChartPoints) { return total + lineChartPoints.data.length; }, 0);
511
511
  var chartProps = {
512
512
  chartTitle: chartTitle,
513
513
  lineChartData: chartData,
514
514
  };
515
+ var scatterChartProps = {
516
+ chartTitle: chartTitle,
517
+ scatterChartData: chartData,
518
+ };
515
519
  if (isAreaChart) {
516
- return tslib_1.__assign(tslib_1.__assign({ data: chartProps, supportNegativeData: true, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle }, secondaryYAxisValues), { mode: mode, width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, hideTickOverlap: true, hideLegend: hideLegend, useUTC: false, optimizeLargeData: numDataPoints > 1000 });
520
+ return tslib_1.__assign(tslib_1.__assign({ data: chartProps, supportNegativeData: true, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle }, secondaryYAxisValues), { mode: mode, width: (_b = input.layout) === null || _b === void 0 ? void 0 : _b.width, height: (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : 350, hideTickOverlap: true, hideLegend: hideLegend, useUTC: false, optimizeLargeData: numDataPoints > 1000 });
517
521
  }
518
522
  else {
519
- return tslib_1.__assign(tslib_1.__assign({ data: chartProps, supportNegativeData: true, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle }, secondaryYAxisValues), { roundedTicks: true, yMinValue: yMinMaxValues.startValue, yMaxValue: yMinMaxValues.endValue, width: (_d = input.layout) === null || _d === void 0 ? void 0 : _d.width, height: (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.height) !== null && _f !== void 0 ? _f : 350, hideTickOverlap: true, enableReflow: false, hideLegend: hideLegend, useUTC: false, optimizeLargeData: numDataPoints > 1000 });
523
+ return tslib_1.__assign(tslib_1.__assign({ data: isScatterChart ? scatterChartProps : chartProps, supportNegativeData: true, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle }, secondaryYAxisValues), { roundedTicks: true, yMinValue: yMinMaxValues.startValue, yMaxValue: yMinMaxValues.endValue, width: (_e = input.layout) === null || _e === void 0 ? void 0 : _e.width, height: (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : 350, hideTickOverlap: true, enableReflow: false, hideLegend: hideLegend, useUTC: false, optimizeLargeData: numDataPoints > 1000 });
520
524
  }
521
525
  };
522
- exports.transformPlotlyJsonToScatterChartProps = transformPlotlyJsonToScatterChartProps;
523
- var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap, colorwayType, isDarkTheme) {
526
+ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
524
527
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
525
- var _s = getLegendProps(input.data, input.layout), legends = _s.legends, hideLegend = _s.hideLegend;
528
+ var _s = getLegendProps(input.data, input.layout, isMultiPlot), legends = _s.legends, hideLegend = _s.hideLegend;
526
529
  var colorScale = undefined;
527
530
  var chartData = input.data
528
531
  .map(function (series, index) {
@@ -590,7 +593,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
590
593
  };
591
594
  };
592
595
  exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
593
- var transformPlotlyJsonToHeatmapProps = function (input) {
596
+ var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
594
597
  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;
595
598
  var firstData = input.data[0];
596
599
  var heatmapDataPoints = [];
@@ -610,8 +613,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
610
613
  yValues_1.push(firstData.y[index]);
611
614
  zValues_1.push(zVal);
612
615
  });
613
- var isXString_1 = (0, exports.isStringArray)(xValues_1);
614
- var isYString_1 = (0, exports.isStringArray)(yValues_1);
616
+ var isXString_1 = (0, chart_utilities_1.isStringArray)(xValues_1);
617
+ var isYString_1 = (0, chart_utilities_1.isStringArray)(yValues_1);
615
618
  var xBins_1 = createBins(xValues_1, (_b = firstData.xbins) === null || _b === void 0 ? void 0 : _b.start, (_c = firstData.xbins) === null || _c === void 0 ? void 0 : _c.end, (_d = firstData.xbins) === null || _d === void 0 ? void 0 : _d.size);
616
619
  var yBins_1 = createBins(yValues_1, (_e = firstData.ybins) === null || _e === void 0 ? void 0 : _e.start, (_f = firstData.ybins) === null || _f === void 0 ? void 0 : _f.end, (_g = firstData.ybins) === null || _g === void 0 ? void 0 : _g.size);
617
620
  var zBins_1 = yBins_1.map(function () { return xBins_1.map(function () { return []; }); });
@@ -721,7 +724,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
721
724
  };
722
725
  };
723
726
  exports.transformPlotlyJsonToHeatmapProps = transformPlotlyJsonToHeatmapProps;
724
- var transformPlotlyJsonToSankeyProps = function (input, colorMap, colorwayType, isDarkTheme) {
727
+ var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
725
728
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
726
729
  var _m = input.data[0], link = _m.link, node = _m.node;
727
730
  var validLinks = ((_a = link === null || link === void 0 ? void 0 : link.value) !== null && _a !== void 0 ? _a : [])
@@ -769,7 +772,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
769
772
  };
770
773
  };
771
774
  exports.transformPlotlyJsonToSankeyProps = transformPlotlyJsonToSankeyProps;
772
- var transformPlotlyJsonToGaugeProps = function (input, colorMap, colorwayType, isDarkTheme) {
775
+ var transformPlotlyJsonToGaugeProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
773
776
  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;
774
777
  var firstData = input.data[0];
775
778
  var stepsColors = ((_a = firstData.gauge) === null || _a === void 0 ? void 0 : _a.steps) ? firstData.gauge.steps.map(function (step) { return step.color; }) : undefined;
@@ -869,7 +872,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
869
872
  }
870
873
  return "".concat(prefix !== null && prefix !== void 0 ? prefix : '').concat(formatted).concat(suffix !== null && suffix !== void 0 ? suffix : '');
871
874
  };
872
- var transformPlotlyJsonToChartTableProps = function (input, colorMap, isDarkTheme) {
875
+ var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
873
876
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
874
877
  var tableData = input.data[0];
875
878
  var normalizeHeaders = function (values, header) {
@@ -1075,12 +1078,6 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
1075
1078
  }
1076
1079
  return Object.keys(lineOptions).length > 0 ? lineOptions : undefined;
1077
1080
  }
1078
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1079
- var isStringArray = function (arr) {
1080
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1081
- return (0, chart_utilities_1.isArrayOfType)(arr, function (value) { return typeof value === 'string' || value === null; });
1082
- };
1083
- exports.isStringArray = isStringArray;
1084
1081
  // TODO: Use binary search to find the appropriate bin for numeric value.
1085
1082
  var findBinIndex = function (bins, value, isString) {
1086
1083
  if (typeof value === 'undefined' || value === null) {
@@ -1104,7 +1101,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
1104
1101
  if (!data || data.length === 0) {
1105
1102
  return [];
1106
1103
  }
1107
- if ((0, exports.isStringArray)(data)) {
1104
+ if ((0, chart_utilities_1.isStringArray)(data)) {
1108
1105
  var categories_1 = Array.from(new Set(data));
1109
1106
  var start = typeof binStart === 'number' ? Math.ceil(binStart) : 0;
1110
1107
  var stop_1 = typeof binEnd === 'number' ? Math.floor(binEnd) + 1 : categories_1.length;
@@ -1175,7 +1172,48 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
1175
1172
  var factor = Math.pow(10, precision);
1176
1173
  return Math.round(value * factor) / factor;
1177
1174
  };
1178
- var getLegendProps = function (data, layout) {
1175
+ var getLegendShape = function (series) {
1176
+ var _a, _b;
1177
+ var dashType = ((_a = series.line) === null || _a === void 0 ? void 0 : _a.dash) || 'solid';
1178
+ if (dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot') {
1179
+ return 'dottedLine';
1180
+ }
1181
+ else if ((_b = series.mode) === null || _b === void 0 ? void 0 : _b.includes('markers')) {
1182
+ return 'circle';
1183
+ }
1184
+ return 'default';
1185
+ };
1186
+ var getAllupLegendsProps = function (input, colorMap, colorwayType, isDarkTheme) {
1187
+ var allupLegends = [];
1188
+ // reduce on showlegend boolean propperty. reduce should return true if at least one series has showlegend true
1189
+ var toShowLegend = input.data.reduce(function (acc, series) {
1190
+ return acc || series.showlegend === true;
1191
+ }, false);
1192
+ if (toShowLegend) {
1193
+ input.data.forEach(function (series, index) {
1194
+ var _a, _b, _c, _d, _e;
1195
+ var name = series.legendgroup;
1196
+ var color = ((_a = series.line) === null || _a === void 0 ? void 0 : _a.color) || ((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color);
1197
+ var legendShape = getLegendShape(series);
1198
+ var resolvedColor = (0, PlotlyColorAdapter_1.extractColor)((_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, color, colorMap, isDarkTheme);
1199
+ if (name !== undefined && allupLegends.some(function (group) { return group.title === name; }) === false) {
1200
+ allupLegends.push({
1201
+ title: name,
1202
+ color: resolvedColor,
1203
+ shape: legendShape,
1204
+ });
1205
+ }
1206
+ });
1207
+ }
1208
+ return {
1209
+ legends: allupLegends,
1210
+ centerLegends: true,
1211
+ enabledWrapLines: true,
1212
+ canSelectMultipleLegends: true,
1213
+ };
1214
+ };
1215
+ exports.getAllupLegendsProps = getAllupLegendsProps;
1216
+ var getLegendProps = function (data, layout, isMultiPlot) {
1179
1217
  var legends = [];
1180
1218
  if (data.length === 1) {
1181
1219
  legends.push(data[0].name || '');
@@ -1185,10 +1223,11 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
1185
1223
  legends.push(series.name || "Series ".concat(index + 1));
1186
1224
  });
1187
1225
  }
1188
- var hideLegends = data.every(function (series) { return series.showlegend === false; });
1226
+ var hideLegendsData = data.every(function (series) { return series.showlegend === false; });
1227
+ var hideLegendsInferred = (layout === null || layout === void 0 ? void 0 : layout.showlegend) === false || ((layout === null || layout === void 0 ? void 0 : layout.showlegend) !== true && legends.length < 2);
1189
1228
  return {
1190
1229
  legends: legends,
1191
- hideLegend: (layout === null || layout === void 0 ? void 0 : layout.showlegend) === false || ((layout === null || layout === void 0 ? void 0 : layout.showlegend) !== true && legends.length < 2) ? true : hideLegends,
1230
+ hideLegend: isMultiPlot || hideLegendsInferred || hideLegendsData,
1192
1231
  };
1193
1232
  };
1194
1233
  var getNumberAtIndexOrDefault = function (data, index) {
@@ -1222,5 +1261,159 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
1222
1261
  return ranges;
1223
1262
  };
1224
1263
  exports.getValidXYRanges = getValidXYRanges;
1264
+ var getIndexFromKey = function (key, pattern) {
1265
+ var normalizedKey = key.replace(pattern, '') === '' ? '1' : key.replace(pattern, '');
1266
+ return parseInt(normalizedKey, 10) - 1;
1267
+ };
1268
+ var getGridProperties = function (layout, isMultiPlot) {
1269
+ var _a;
1270
+ var gridX = [];
1271
+ var gridY = [];
1272
+ var annotations = {};
1273
+ var templateRows = '1fr';
1274
+ var templateColumns = '1fr';
1275
+ var gridLayout = {};
1276
+ if (layout === undefined || layout === null || Object.keys(layout).length === 0) {
1277
+ return { templateRows: templateRows, templateColumns: templateColumns, layout: gridLayout };
1278
+ }
1279
+ if (!layout.xaxis || !layout.yaxis) {
1280
+ return { templateRows: templateRows, templateColumns: templateColumns, layout: gridLayout };
1281
+ }
1282
+ if (!isMultiPlot) {
1283
+ return { templateRows: templateRows, templateColumns: templateColumns, layout: gridLayout };
1284
+ }
1285
+ Object.keys(layout).forEach(function (key) {
1286
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1287
+ if (key.startsWith('xaxis')) {
1288
+ var index = getIndexFromKey(key, 'xaxis');
1289
+ var anchor = (_b = (_a = layout[key]) === null || _a === void 0 ? void 0 : _a.anchor) !== null && _b !== void 0 ? _b : 'y';
1290
+ var anchorIndex = getIndexFromKey(anchor, 'y');
1291
+ if (index !== anchorIndex) {
1292
+ throw new Error("Invalid layout: xaxis ".concat(index + 1, " anchor should be y").concat(anchorIndex + 1));
1293
+ }
1294
+ gridX[index] = (_d = (_c = layout[key]) === null || _c === void 0 ? void 0 : _c.domain) !== null && _d !== void 0 ? _d : [];
1295
+ }
1296
+ else if (key.startsWith('yaxis')) {
1297
+ var index = getIndexFromKey(key, 'yaxis');
1298
+ var anchor = (_f = (_e = layout[key]) === null || _e === void 0 ? void 0 : _e.anchor) !== null && _f !== void 0 ? _f : 'x';
1299
+ var anchorIndex = getIndexFromKey(anchor, 'x');
1300
+ if (index !== anchorIndex) {
1301
+ if ((index === 1 && anchorIndex === 0) || ((_g = layout.yaxis2) === null || _g === void 0 ? void 0 : _g.side) === 'right') {
1302
+ // Special case for secondary y axis where yaxis2 can anchor to x1
1303
+ return { templateRows: templateRows, templateColumns: templateColumns };
1304
+ }
1305
+ throw new Error("Invalid layout: yaxis ".concat(index + 1, " anchor should be x").concat(anchorIndex + 1));
1306
+ }
1307
+ gridY[index] = (_j = (_h = layout[key]) === null || _h === void 0 ? void 0 : _h.domain) !== null && _j !== void 0 ? _j : [];
1308
+ }
1309
+ });
1310
+ (_a = layout.annotations) === null || _a === void 0 ? void 0 : _a.forEach(function (annotation) {
1311
+ var xMatches = gridX.flatMap(function (interval, idx) {
1312
+ return (annotation === null || annotation === void 0 ? void 0 : annotation.x) >= interval[0] && (annotation === null || annotation === void 0 ? void 0 : annotation.x) <= interval[1] ? [idx] : [];
1313
+ });
1314
+ var yMatch = gridY.findIndex(function (interval, yIndex) {
1315
+ return xMatches.includes(yIndex) &&
1316
+ (annotation === null || annotation === void 0 ? void 0 : annotation.y) >= interval[0] &&
1317
+ (annotation === null || annotation === void 0 ? void 0 : annotation.y) <= interval[1];
1318
+ });
1319
+ if (yMatch !== -1) {
1320
+ if (annotations[yMatch] === undefined) {
1321
+ annotations[yMatch] = {};
1322
+ }
1323
+ if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
1324
+ annotations[yMatch].yAnnotation = annotation.text;
1325
+ }
1326
+ else {
1327
+ annotations[yMatch].xAnnotation = annotation.text;
1328
+ }
1329
+ }
1330
+ });
1331
+ if (gridX.length > 0) {
1332
+ var uniqueXIntervals_1 = new Map();
1333
+ gridX.forEach(function (interval) {
1334
+ var key = "".concat(interval[0], "-").concat(interval[1]);
1335
+ if (!uniqueXIntervals_1.has(key)) {
1336
+ uniqueXIntervals_1.set(key, interval);
1337
+ }
1338
+ });
1339
+ var minXInterval_1 = Math.min.apply(Math, Array.from(uniqueXIntervals_1.values()).map(function (interval) { return interval[1] - interval[0]; }));
1340
+ templateColumns = Array.from(uniqueXIntervals_1.values())
1341
+ .map(function (interval) { return "".concat((interval[1] - interval[0]) / minXInterval_1, "fr"); })
1342
+ .join(' ');
1343
+ var columnNumber_1 = 1;
1344
+ var lastIntervalEnd_1 = 0;
1345
+ gridX.forEach(function (interval, index) {
1346
+ if (interval.length === 0) {
1347
+ return;
1348
+ }
1349
+ var cellName = "x".concat(index === 0 ? '' : index + 1);
1350
+ var annotationProps = annotations[index];
1351
+ var xAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.xAnnotation;
1352
+ if (interval[0] < lastIntervalEnd_1) {
1353
+ columnNumber_1 = 1;
1354
+ }
1355
+ lastIntervalEnd_1 = interval[1];
1356
+ var row = {
1357
+ row: -1,
1358
+ column: columnNumber_1,
1359
+ xAnnotation: xAnnotation,
1360
+ };
1361
+ gridLayout[cellName] = row;
1362
+ columnNumber_1 += 1;
1363
+ });
1364
+ }
1365
+ var numColumns = Math.max.apply(Math, Object.values(gridLayout).map(function (cell) { var _a; return (_a = cell.column) !== null && _a !== void 0 ? _a : 0; }));
1366
+ var columnFill = {};
1367
+ for (var i = 1; i <= numColumns; i++) {
1368
+ columnFill[i] = { row: 1, fillDomain: 0 };
1369
+ }
1370
+ if (gridY.length > 0) {
1371
+ var uniqueYIntervals_1 = new Map();
1372
+ gridY.forEach(function (interval) {
1373
+ var key = "".concat(interval[0], "-").concat(interval[1]);
1374
+ if (!uniqueYIntervals_1.has(key)) {
1375
+ uniqueYIntervals_1.set(key, interval);
1376
+ }
1377
+ });
1378
+ var minYInterval_1 = Math.min.apply(Math, Array.from(uniqueYIntervals_1.values()).map(function (interval) { return interval[1] - interval[0]; }));
1379
+ templateRows = Array.from(uniqueYIntervals_1.values())
1380
+ .map(function (interval) { return "".concat((interval[1] - interval[0]) / minYInterval_1, "fr"); })
1381
+ .join(' ');
1382
+ gridY.forEach(function (interval, index) {
1383
+ if (interval.length === 0) {
1384
+ return;
1385
+ }
1386
+ var cellName = "x".concat(index === 0 ? '' : index + 1);
1387
+ var annotationProps = annotations[index];
1388
+ var yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
1389
+ var cell = gridLayout[cellName];
1390
+ if (cell !== undefined) {
1391
+ cell.row = columnFill[cell.column].row;
1392
+ cell.yAnnotation = yAnnotation;
1393
+ }
1394
+ columnFill[cell.column].fillDomain = interval[1];
1395
+ columnFill[cell.column].row += 1;
1396
+ });
1397
+ }
1398
+ // reverse the order of rows in grid layout from bottom-top to top-bottom as required by CSS grid
1399
+ var reversedGridLayout = {};
1400
+ // find the maximum row number
1401
+ var maxRowNumber = Math.max.apply(Math, Object.values(gridLayout).map(function (cell) { var _a; return (_a = cell.row) !== null && _a !== void 0 ? _a : 0; }));
1402
+ // iterate over the gridLayout and reverse the row numbers
1403
+ Object.keys(gridLayout).forEach(function (key) {
1404
+ var cell = gridLayout[key];
1405
+ if (cell.row !== undefined) {
1406
+ // reverse the row number
1407
+ cell.row = maxRowNumber - cell.row + 1;
1408
+ }
1409
+ reversedGridLayout[key] = cell;
1410
+ });
1411
+ return {
1412
+ templateRows: templateRows,
1413
+ templateColumns: templateColumns,
1414
+ layout: reversedGridLayout,
1415
+ };
1416
+ };
1417
+ exports.getGridProperties = getGridProperties;
1225
1418
  });
1226
1419
  //# sourceMappingURL=PlotlySchemaAdapter.js.map