@fluentui/react-charting 5.24.3 → 5.24.4

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 +46 -1
  2. package/CHANGELOG.md +16 -2
  3. package/dist/react-charting.d.ts +34 -1
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +7 -1
  7. package/lib/components/AreaChart/AreaChart.base.d.ts +1 -0
  8. package/lib/components/AreaChart/AreaChart.base.js +4 -1
  9. package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
  10. package/lib/components/CommonComponents/CartesianChart.base.js +2 -2
  11. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  12. package/lib/components/CommonComponents/CartesianChart.types.d.ts +12 -2
  13. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  14. package/lib/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
  15. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +9 -1
  16. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  17. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +67 -66
  18. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  19. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
  20. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +22 -3
  21. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  22. package/lib/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
  23. package/lib/components/HeatMapChart/HeatMapChart.base.js +95 -37
  24. package/lib/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  25. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
  26. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +24 -3
  27. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  28. package/lib/components/ScatterChart/ScatterChart.base.js +84 -55
  29. package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
  30. package/lib/components/ScatterChart/ScatterChart.styles.js +12 -0
  31. package/lib/components/ScatterChart/ScatterChart.styles.js.map +1 -1
  32. package/lib/components/ScatterChart/ScatterChart.types.d.ts +5 -0
  33. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  34. package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
  35. package/lib/components/VerticalBarChart/VerticalBarChart.base.js +27 -6
  36. package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  37. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
  38. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +48 -31
  39. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  40. package/lib/index.d.ts +1 -1
  41. package/lib/index.js.map +1 -1
  42. package/lib/types/IDataPoint.d.ts +18 -0
  43. package/lib/types/IDataPoint.js.map +1 -1
  44. package/lib/utilities/utilities.d.ts +6 -3
  45. package/lib/utilities/utilities.js +58 -29
  46. package/lib/utilities/utilities.js.map +1 -1
  47. package/lib-amd/components/AreaChart/AreaChart.base.d.ts +1 -0
  48. package/lib-amd/components/AreaChart/AreaChart.base.js +4 -1
  49. package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
  50. package/lib-amd/components/CommonComponents/CartesianChart.base.js +2 -2
  51. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  52. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +12 -2
  53. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  54. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
  55. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +11 -2
  56. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  57. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +66 -66
  58. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  59. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
  60. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +21 -2
  61. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  62. package/lib-amd/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
  63. package/lib-amd/components/HeatMapChart/HeatMapChart.base.js +94 -36
  64. package/lib-amd/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  65. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
  66. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +23 -2
  67. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  68. package/lib-amd/components/ScatterChart/ScatterChart.base.js +83 -54
  69. package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
  70. package/lib-amd/components/ScatterChart/ScatterChart.styles.js +12 -1
  71. package/lib-amd/components/ScatterChart/ScatterChart.styles.js.map +1 -1
  72. package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +5 -0
  73. package/lib-amd/components/ScatterChart/ScatterChart.types.js.map +1 -1
  74. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
  75. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +26 -5
  76. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  77. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
  78. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +47 -30
  79. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  80. package/lib-amd/index.d.ts +1 -1
  81. package/lib-amd/index.js.map +1 -1
  82. package/lib-amd/types/IDataPoint.d.ts +18 -0
  83. package/lib-amd/types/IDataPoint.js.map +1 -1
  84. package/lib-amd/utilities/utilities.d.ts +6 -3
  85. package/lib-amd/utilities/utilities.js +59 -30
  86. package/lib-amd/utilities/utilities.js.map +1 -1
  87. package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +1 -0
  88. package/lib-commonjs/components/AreaChart/AreaChart.base.js +4 -1
  89. package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
  90. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +2 -2
  91. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  92. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +12 -2
  93. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  94. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
  95. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +11 -2
  96. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  97. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +66 -65
  98. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  99. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
  100. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +21 -2
  101. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  102. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
  103. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js +94 -36
  104. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  105. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
  106. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +23 -2
  107. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  108. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +83 -54
  109. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
  110. package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js +12 -0
  111. package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js.map +1 -1
  112. package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +5 -0
  113. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  114. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
  115. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +26 -5
  116. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  117. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
  118. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +47 -30
  119. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  120. package/lib-commonjs/index.d.ts +1 -1
  121. package/lib-commonjs/index.js.map +1 -1
  122. package/lib-commonjs/types/IDataPoint.d.ts +18 -0
  123. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  124. package/lib-commonjs/utilities/utilities.d.ts +6 -3
  125. package/lib-commonjs/utilities/utilities.js +59 -30
  126. package/lib-commonjs/utilities/utilities.js.map +1 -1
  127. package/package.json +2 -2
  128. package/src/components/CommonComponents/CartesianChart.types.ts +20 -1
  129. package/src/components/ScatterChart/ScatterChart.types.ts +7 -1
@@ -7,7 +7,8 @@ import { GaugeChartVariant } from '../GaugeChart/index';
7
7
  import { findNumericMinMaxOfY, formatScientificLimitWidth, MIN_DONUT_RADIUS } from '../../utilities/utilities';
8
8
  import { isArrayOrTypedArray, isDate, isDateArray, isNumberArray, isStringArray, isYearArray, isInvalidValue, } from '@fluentui/chart-utilities';
9
9
  import { curveCardinal as d3CurveCardinal } from 'd3-shape';
10
- import { extractColor, resolveColor } from './PlotlyColorAdapter';
10
+ import { getOpacity, extractColor, resolveColor } from './PlotlyColorAdapter';
11
+ import { rgb } from 'd3-color';
11
12
  var dashOptions = {
12
13
  dot: {
13
14
  strokeDasharray: '1, 5',
@@ -242,7 +243,7 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
242
243
  var rangeXValues = series.x.slice(rangeStart, rangeEnd);
243
244
  var rangeYValues = series.y.slice(rangeStart, rangeEnd);
244
245
  rangeXValues.forEach(function (x, index2) {
245
- var _a, _b, _c, _d;
246
+ var _a, _b, _c, _d, _e, _f;
246
247
  if (!mapXToDataPoints[x]) {
247
248
  mapXToDataPoints[x] = {
248
249
  xAxisPoint: resolveXAxisPoint(x, isXYearCategory, isXString, isXDate, isXNumber),
@@ -257,12 +258,13 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
257
258
  ? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[index2 % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
258
259
  : 0)
259
260
  : resolveColor(extractedBarColors, index2, legend, colorMap, isDarkTheme);
261
+ var opacity = getOpacity(series, index2);
260
262
  var yVal = rangeYValues[index2];
261
263
  if (series.type === 'bar') {
262
264
  mapXToDataPoints[x].chartData.push({
263
265
  legend: legend,
264
266
  data: yVal,
265
- color: color,
267
+ color: (_e = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _e !== void 0 ? _e : color,
266
268
  });
267
269
  if (typeof yVal === 'number') {
268
270
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -276,7 +278,7 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
276
278
  legend: legend + (validXYRanges.length > 1 ? ".".concat(rangeIdx + 1) : ''),
277
279
  legendShape: legendShape,
278
280
  y: yVal,
279
- color: lineColor,
281
+ color: (_f = rgb(lineColor).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
280
282
  lineOptions: __assign(__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
281
283
  useSecondaryYScale: usesSecondaryYScale(series, input.layout),
282
284
  });
@@ -289,7 +291,7 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
289
291
  });
290
292
  });
291
293
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
292
- return __assign(__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', yMaxValue: yMaxValue, yMinValue: yMinValue, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true });
294
+ return __assign(__assign(__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', yMaxValue: yMaxValue, yMinValue: yMinValue, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true }), getAxisCategoryOrderProps(input.data, input.layout));
293
295
  };
294
296
  var createColorScale = function (layout, series) {
295
297
  var _a, _b, _c, _d, _e, _f;
@@ -324,7 +326,7 @@ export var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorM
324
326
  // extract colors for each series only once
325
327
  var extractedColors = extractColor((_k = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.layout) === null || _k === void 0 ? void 0 : _k.colorway, colorwayType, (_l = series.marker) === null || _l === void 0 ? void 0 : _l.color, colorMap, isDarkTheme);
326
328
  (_m = series.x) === null || _m === void 0 ? void 0 : _m.forEach(function (x, xIndex) {
327
- var _a, _b, _c, _d, _e;
329
+ var _a, _b, _c, _d, _e, _f;
328
330
  if (isInvalidValue(x) || isInvalidValue((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
329
331
  return;
330
332
  }
@@ -338,12 +340,13 @@ export var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorM
338
340
  ? colorScale(isArrayOrTypedArray((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
339
341
  ? (_d = (_c = series.marker) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d[xIndex % ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length]
340
342
  : 0)
341
- : resolveColor(extractedColors, index1, legend, colorMap, isDarkTheme);
343
+ : resolveColor(extractedColors, xIndex, legend, colorMap, isDarkTheme);
344
+ var opacity = getOpacity(series, xIndex);
342
345
  mapXToDataPoints[x].series.push({
343
346
  key: legend,
344
347
  data: series.y[xIndex],
345
348
  xAxisCalloutData: x,
346
- color: color,
349
+ color: (_f = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
347
350
  legend: legend,
348
351
  useSecondaryYScale: usesSecondaryYScale(series, input.layout),
349
352
  });
@@ -351,7 +354,7 @@ export var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorM
351
354
  });
352
355
  });
353
356
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
354
- return __assign(__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 });
357
+ return __assign(__assign(__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 }), getAxisCategoryOrderProps(input.data, input.layout));
355
358
  };
356
359
  export var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
357
360
  var _a, _b, _c;
@@ -399,7 +402,7 @@ export var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMa
399
402
  return yVal;
400
403
  });
401
404
  xBins.forEach(function (bin, index) {
402
- var _a, _b, _c, _d;
405
+ var _a, _b, _c, _d, _e;
403
406
  var legend = legends[seriesIdx];
404
407
  // resolve color for each legend's bars from the colorscale or extracted colors
405
408
  var color = colorScale
@@ -407,27 +410,15 @@ export var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMa
407
410
  ? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[index % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
408
411
  : 0)
409
412
  : resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
413
+ var opacity = getOpacity(series, index);
410
414
  var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
411
- vbcData.push(__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: color }, (isXString
415
+ vbcData.push(__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: (_e = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _e !== void 0 ? _e : color }, (isXString
412
416
  ? {}
413
417
  : { xAxisCalloutData: "[".concat(bin.x0, " - ").concat(bin.x1, ")") })));
414
418
  });
415
419
  });
416
420
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
417
- return {
418
- data: vbcData,
419
- width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width,
420
- height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350,
421
- supportNegativeData: true,
422
- chartTitle: chartTitle,
423
- xAxisTitle: xAxisTitle,
424
- yAxisTitle: yAxisTitle,
425
- mode: 'histogram',
426
- hideTickOverlap: true,
427
- maxBarWidth: 50,
428
- hideLegend: hideLegend,
429
- roundCorners: true,
430
- };
421
+ return __assign({ data: vbcData, 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, supportNegativeData: true, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'histogram', hideTickOverlap: true, maxBarWidth: 50, hideLegend: hideLegend, roundCorners: true }, getAxisCategoryOrderProps(input.data, input.layout));
431
422
  };
432
423
  export var transformPlotlyJsonToAreaChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
433
424
  return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'area', colorMap, colorwayType, isDarkTheme);
@@ -441,6 +432,7 @@ export var transformPlotlyJsonToScatterChartProps = function (input, isMultiPlot
441
432
  var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme) {
442
433
  var _a, _b, _c, _d, _e, _f, _g;
443
434
  var isScatterMarkers = [
435
+ 'markers',
444
436
  'text+markers',
445
437
  'markers+text',
446
438
  'lines+markers',
@@ -470,12 +462,13 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
470
462
  var legend = legends[index];
471
463
  // resolve color for each legend's lines from the extracted colors
472
464
  var seriesColor = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
465
+ var seriesOpacity = getOpacity(series, index);
473
466
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
474
467
  var lineOptions = getLineOptions(series.line);
475
468
  var legendShape = getLegendShape(series);
476
469
  var validXYRanges = getValidXYRanges(series);
477
470
  return validXYRanges.map(function (_a, rangeIdx) {
478
- var _b;
471
+ var _b, _c;
479
472
  var rangeStart = _a[0], rangeEnd = _a[1];
480
473
  var rangeXValues = xValues.slice(rangeStart, rangeEnd);
481
474
  var rangeYValues = series.y.slice(rangeStart, rangeEnd);
@@ -494,7 +487,7 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
494
487
  ? { markerSize: series.marker.size }
495
488
  : {})), (textValues ? { text: textValues[i] } : {})));
496
489
  }),
497
- color: seriesColor,
490
+ color: (_c = rgb(seriesColor).copy({ opacity: seriesOpacity }).formatHex8()) !== null && _c !== void 0 ? _c : seriesColor,
498
491
  lineOptions: __assign(__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
499
492
  useSecondaryYScale: usesSecondaryYScale(series, input.layout),
500
493
  };
@@ -537,7 +530,7 @@ export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, is
537
530
  var legend = legends[index];
538
531
  return series.y
539
532
  .map(function (yValue, i) {
540
- var _a, _b, _c, _d, _e;
533
+ var _a, _b, _c, _d, _e, _f;
541
534
  if (isInvalidValue((_a = series.x) === null || _a === void 0 ? void 0 : _a[i]) || isInvalidValue(yValue)) {
542
535
  return null;
543
536
  }
@@ -547,19 +540,17 @@ export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, is
547
540
  ? (_d = (_c = series.marker) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d[i % ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length]
548
541
  : 0)
549
542
  : resolveColor(extractedColors, i, legend, colorMap, isDarkTheme);
543
+ var opacity = getOpacity(series, i);
550
544
  return {
551
545
  x: series.x[i],
552
546
  y: yValue,
553
547
  legend: legend,
554
- color: color,
548
+ color: (_f = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
555
549
  };
556
550
  })
557
551
  .filter(function (point) { return point !== null; });
558
552
  })
559
- .reverse()
560
- .flat()
561
- //reversing the order to invert the Y bars order as required by plotly.
562
- .reverse();
553
+ .flat();
563
554
  var chartHeight = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 450;
564
555
  var margin = (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.margin) === null || _d === void 0 ? void 0 : _d.l) !== null && _e !== void 0 ? _e : 0;
565
556
  var padding = (_h = (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.margin) === null || _g === void 0 ? void 0 : _g.pad) !== null && _h !== void 0 ? _h : 0;
@@ -569,24 +560,9 @@ export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, is
569
560
  var gapFactor = 1 / (1 + scalingFactor * numberOfRows);
570
561
  var barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
571
562
  var _t = getTitles(input.layout), chartTitle = _t.chartTitle, xAxisTitle = _t.xAxisTitle, yAxisTitle = _t.yAxisTitle;
572
- return {
573
- data: chartData,
574
- chartTitle: chartTitle,
575
- xAxisTitle: xAxisTitle,
576
- yAxisTitle: yAxisTitle,
577
- secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
563
+ return __assign({ data: chartData, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
578
564
  ? (_m = (_l = input.layout) === null || _l === void 0 ? void 0 : _l.yaxis2) === null || _m === void 0 ? void 0 : _m.title
579
- : ((_q = (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.yaxis2) === null || _p === void 0 ? void 0 : _p.title) === null || _q === void 0 ? void 0 : _q.text) || '',
580
- barHeight: barHeight,
581
- showYAxisLables: true,
582
- height: chartHeight,
583
- width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width,
584
- hideTickOverlap: true,
585
- hideLegend: hideLegend,
586
- noOfCharsToTruncate: 20,
587
- showYAxisLablesTooltip: true,
588
- roundCorners: true,
589
- };
565
+ : ((_q = (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.yaxis2) === null || _p === void 0 ? void 0 : _p.title) === null || _q === void 0 ? void 0 : _q.text) || '', barHeight: barHeight, showYAxisLables: true, height: chartHeight, width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true }, getAxisCategoryOrderProps(input.data, input.layout));
590
566
  };
591
567
  export var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
592
568
  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;
@@ -701,22 +677,7 @@ export var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, col
701
677
  ? colorscale.map(function (arr) { return arr[1]; })
702
678
  : defaultRange;
703
679
  var _9 = getTitles(input.layout), chartTitle = _9.chartTitle, xAxisTitle = _9.xAxisTitle, yAxisTitle = _9.yAxisTitle;
704
- return {
705
- data: [heatmapData],
706
- domainValuesForColorScale: domainValuesForColorScale,
707
- rangeValuesForColorScale: rangeValuesForColorScale,
708
- hideLegend: true,
709
- showYAxisLables: true,
710
- chartTitle: chartTitle,
711
- xAxisTitle: xAxisTitle,
712
- yAxisTitle: yAxisTitle,
713
- sortOrder: 'none',
714
- width: (_6 = input.layout) === null || _6 === void 0 ? void 0 : _6.width,
715
- height: (_8 = (_7 = input.layout) === null || _7 === void 0 ? void 0 : _7.height) !== null && _8 !== void 0 ? _8 : 350,
716
- hideTickOverlap: true,
717
- noOfCharsToTruncate: 20,
718
- showYAxisLablesTooltip: true,
719
- };
680
+ return __assign({ data: [heatmapData], domainValuesForColorScale: domainValuesForColorScale, rangeValuesForColorScale: rangeValuesForColorScale, hideLegend: true, showYAxisLables: true, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, sortOrder: 'none', width: (_6 = input.layout) === null || _6 === void 0 ? void 0 : _6.width, height: (_8 = (_7 = input.layout) === null || _7 === void 0 ? void 0 : _7.height) !== null && _8 !== void 0 ? _8 : 350, hideTickOverlap: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true }, getAxisCategoryOrderProps([firstData], input.layout));
720
681
  };
721
682
  export var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
722
683
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
@@ -1400,4 +1361,44 @@ export var getGridProperties = function (layout, isMultiPlot) {
1400
1361
  layout: reversedGridLayout,
1401
1362
  };
1402
1363
  };
1364
+ /**
1365
+ * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/category_order_defaults.js#L50}
1366
+ */
1367
+ var getAxisCategoryOrderProps = function (data, layout) {
1368
+ var result = {};
1369
+ var axesById = {
1370
+ x: layout === null || layout === void 0 ? void 0 : layout.xaxis,
1371
+ y: layout === null || layout === void 0 ? void 0 : layout.yaxis,
1372
+ };
1373
+ Object.keys(axesById).forEach(function (axId) {
1374
+ var ax = axesById[axId];
1375
+ var axLetter = axId[0];
1376
+ var propName = "".concat(axLetter, "AxisCategoryOrder");
1377
+ var values = [];
1378
+ data.forEach(function (series) {
1379
+ var _a;
1380
+ (_a = series[axLetter]) === null || _a === void 0 ? void 0 : _a.forEach(function (val) {
1381
+ if (!isInvalidValue(val)) {
1382
+ values.push(val);
1383
+ }
1384
+ });
1385
+ });
1386
+ var isAxisTypeCategory = (ax === null || ax === void 0 ? void 0 : ax.type) === 'category' || (isStringArray(values) && !isNumberArray(values) && !isDateArray(values));
1387
+ if (!isAxisTypeCategory) {
1388
+ return;
1389
+ }
1390
+ var isValidArray = isArrayOrTypedArray(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
1391
+ if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
1392
+ result[propName] = ax.categoryarray;
1393
+ return;
1394
+ }
1395
+ if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
1396
+ var categoriesInTraceOrder = Array.from(new Set(values));
1397
+ result[propName] = categoriesInTraceOrder;
1398
+ return;
1399
+ }
1400
+ result[propName] = ax.categoryorder;
1401
+ });
1402
+ return result;
1403
+ };
1403
1404
  //# sourceMappingURL=PlotlySchemaAdapter.js.map