@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
@@ -11,6 +11,7 @@ var utilities_1 = require("../../utilities/utilities");
11
11
  var chart_utilities_1 = require("@fluentui/chart-utilities");
12
12
  var d3_shape_1 = require("d3-shape");
13
13
  var PlotlyColorAdapter_1 = require("./PlotlyColorAdapter");
14
+ var d3_color_1 = require("d3-color");
14
15
  var dashOptions = {
15
16
  dot: {
16
17
  strokeDasharray: '1, 5',
@@ -249,7 +250,7 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
249
250
  var rangeXValues = series.x.slice(rangeStart, rangeEnd);
250
251
  var rangeYValues = series.y.slice(rangeStart, rangeEnd);
251
252
  rangeXValues.forEach(function (x, index2) {
252
- var _a, _b, _c, _d;
253
+ var _a, _b, _c, _d, _e, _f;
253
254
  if (!mapXToDataPoints[x]) {
254
255
  mapXToDataPoints[x] = {
255
256
  xAxisPoint: (0, exports.resolveXAxisPoint)(x, isXYearCategory, isXString, isXDate, isXNumber),
@@ -264,12 +265,13 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
264
265
  ? (_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]
265
266
  : 0)
266
267
  : (0, PlotlyColorAdapter_1.resolveColor)(extractedBarColors, index2, legend, colorMap, isDarkTheme);
268
+ var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index2);
267
269
  var yVal = rangeYValues[index2];
268
270
  if (series.type === 'bar') {
269
271
  mapXToDataPoints[x].chartData.push({
270
272
  legend: legend,
271
273
  data: yVal,
272
- color: color,
274
+ color: (_e = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _e !== void 0 ? _e : color,
273
275
  });
274
276
  if (typeof yVal === 'number') {
275
277
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -283,7 +285,7 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
283
285
  legend: legend + (validXYRanges.length > 1 ? ".".concat(rangeIdx + 1) : ''),
284
286
  legendShape: legendShape,
285
287
  y: yVal,
286
- color: lineColor,
288
+ color: (_f = (0, d3_color_1.rgb)(lineColor).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
287
289
  lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
288
290
  useSecondaryYScale: usesSecondaryYScale(series, input.layout),
289
291
  });
@@ -296,7 +298,7 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
296
298
  });
297
299
  });
298
300
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
299
- 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', 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 });
301
+ return tslib_1.__assign(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', 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));
300
302
  };
301
303
  exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
302
304
  var createColorScale = function (layout, series) {
@@ -332,7 +334,7 @@ var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, col
332
334
  // extract colors for each series only once
333
335
  var extractedColors = (0, PlotlyColorAdapter_1.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);
334
336
  (_m = series.x) === null || _m === void 0 ? void 0 : _m.forEach(function (x, xIndex) {
335
- var _a, _b, _c, _d, _e;
337
+ var _a, _b, _c, _d, _e, _f;
336
338
  if ((0, chart_utilities_1.isInvalidValue)(x) || (0, chart_utilities_1.isInvalidValue)((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
337
339
  return;
338
340
  }
@@ -346,12 +348,13 @@ var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, col
346
348
  ? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
347
349
  ? (_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]
348
350
  : 0)
349
- : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index1, legend, colorMap, isDarkTheme);
351
+ : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, xIndex, legend, colorMap, isDarkTheme);
352
+ var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, xIndex);
350
353
  mapXToDataPoints[x].series.push({
351
354
  key: legend,
352
355
  data: series.y[xIndex],
353
356
  xAxisCalloutData: x,
354
- color: color,
357
+ color: (_f = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
355
358
  legend: legend,
356
359
  useSecondaryYScale: usesSecondaryYScale(series, input.layout),
357
360
  });
@@ -359,7 +362,7 @@ var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, col
359
362
  });
360
363
  });
361
364
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
362
- 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 });
365
+ return tslib_1.__assign(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 }), getAxisCategoryOrderProps(input.data, input.layout));
363
366
  };
364
367
  exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
365
368
  var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
@@ -408,7 +411,7 @@ var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colo
408
411
  return yVal;
409
412
  });
410
413
  xBins.forEach(function (bin, index) {
411
- var _a, _b, _c, _d;
414
+ var _a, _b, _c, _d, _e;
412
415
  var legend = legends[seriesIdx];
413
416
  // resolve color for each legend's bars from the colorscale or extracted colors
414
417
  var color = colorScale
@@ -416,27 +419,15 @@ var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colo
416
419
  ? (_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]
417
420
  : 0)
418
421
  : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
422
+ var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
419
423
  var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
420
- vbcData.push(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: color }, (isXString
424
+ vbcData.push(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: (_e = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _e !== void 0 ? _e : color }, (isXString
421
425
  ? {}
422
426
  : { xAxisCalloutData: "[".concat(bin.x0, " - ").concat(bin.x1, ")") })));
423
427
  });
424
428
  });
425
429
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
426
- return {
427
- data: vbcData,
428
- width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width,
429
- height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350,
430
- supportNegativeData: true,
431
- chartTitle: chartTitle,
432
- xAxisTitle: xAxisTitle,
433
- yAxisTitle: yAxisTitle,
434
- mode: 'histogram',
435
- hideTickOverlap: true,
436
- maxBarWidth: 50,
437
- hideLegend: hideLegend,
438
- roundCorners: true,
439
- };
430
+ return tslib_1.__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));
440
431
  };
441
432
  exports.transformPlotlyJsonToVBCProps = transformPlotlyJsonToVBCProps;
442
433
  var transformPlotlyJsonToAreaChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
@@ -454,6 +445,7 @@ exports.transformPlotlyJsonToScatterChartProps = transformPlotlyJsonToScatterCha
454
445
  var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme) {
455
446
  var _a, _b, _c, _d, _e, _f, _g;
456
447
  var isScatterMarkers = [
448
+ 'markers',
457
449
  'text+markers',
458
450
  'markers+text',
459
451
  'lines+markers',
@@ -483,12 +475,13 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
483
475
  var legend = legends[index];
484
476
  // resolve color for each legend's lines from the extracted colors
485
477
  var seriesColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
478
+ var seriesOpacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
486
479
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
487
480
  var lineOptions = getLineOptions(series.line);
488
481
  var legendShape = getLegendShape(series);
489
482
  var validXYRanges = (0, exports.getValidXYRanges)(series);
490
483
  return validXYRanges.map(function (_a, rangeIdx) {
491
- var _b;
484
+ var _b, _c;
492
485
  var rangeStart = _a[0], rangeEnd = _a[1];
493
486
  var rangeXValues = xValues.slice(rangeStart, rangeEnd);
494
487
  var rangeYValues = series.y.slice(rangeStart, rangeEnd);
@@ -507,7 +500,7 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
507
500
  ? { markerSize: series.marker.size }
508
501
  : {})), (textValues ? { text: textValues[i] } : {})));
509
502
  }),
510
- color: seriesColor,
503
+ color: (_c = (0, d3_color_1.rgb)(seriesColor).copy({ opacity: seriesOpacity }).formatHex8()) !== null && _c !== void 0 ? _c : seriesColor,
511
504
  lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
512
505
  useSecondaryYScale: usesSecondaryYScale(series, input.layout),
513
506
  };
@@ -550,7 +543,7 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPl
550
543
  var legend = legends[index];
551
544
  return series.y
552
545
  .map(function (yValue, i) {
553
- var _a, _b, _c, _d, _e;
546
+ var _a, _b, _c, _d, _e, _f;
554
547
  if ((0, chart_utilities_1.isInvalidValue)((_a = series.x) === null || _a === void 0 ? void 0 : _a[i]) || (0, chart_utilities_1.isInvalidValue)(yValue)) {
555
548
  return null;
556
549
  }
@@ -560,19 +553,17 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPl
560
553
  ? (_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]
561
554
  : 0)
562
555
  : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
556
+ var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
563
557
  return {
564
558
  x: series.x[i],
565
559
  y: yValue,
566
560
  legend: legend,
567
- color: color,
561
+ color: (_f = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
568
562
  };
569
563
  })
570
564
  .filter(function (point) { return point !== null; });
571
565
  })
572
- .reverse()
573
- .flat()
574
- //reversing the order to invert the Y bars order as required by plotly.
575
- .reverse();
566
+ .flat();
576
567
  var chartHeight = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 450;
577
568
  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;
578
569
  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;
@@ -582,24 +573,9 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPl
582
573
  var gapFactor = 1 / (1 + scalingFactor * numberOfRows);
583
574
  var barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
584
575
  var _t = getTitles(input.layout), chartTitle = _t.chartTitle, xAxisTitle = _t.xAxisTitle, yAxisTitle = _t.yAxisTitle;
585
- return {
586
- data: chartData,
587
- chartTitle: chartTitle,
588
- xAxisTitle: xAxisTitle,
589
- yAxisTitle: yAxisTitle,
590
- secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
576
+ return tslib_1.__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'
591
577
  ? (_m = (_l = input.layout) === null || _l === void 0 ? void 0 : _l.yaxis2) === null || _m === void 0 ? void 0 : _m.title
592
- : ((_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) || '',
593
- barHeight: barHeight,
594
- showYAxisLables: true,
595
- height: chartHeight,
596
- width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width,
597
- hideTickOverlap: true,
598
- hideLegend: hideLegend,
599
- noOfCharsToTruncate: 20,
600
- showYAxisLablesTooltip: true,
601
- roundCorners: true,
602
- };
578
+ : ((_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));
603
579
  };
604
580
  exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
605
581
  var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
@@ -715,22 +691,7 @@ var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap,
715
691
  ? colorscale.map(function (arr) { return arr[1]; })
716
692
  : defaultRange;
717
693
  var _9 = getTitles(input.layout), chartTitle = _9.chartTitle, xAxisTitle = _9.xAxisTitle, yAxisTitle = _9.yAxisTitle;
718
- return {
719
- data: [heatmapData],
720
- domainValuesForColorScale: domainValuesForColorScale,
721
- rangeValuesForColorScale: rangeValuesForColorScale,
722
- hideLegend: true,
723
- showYAxisLables: true,
724
- chartTitle: chartTitle,
725
- xAxisTitle: xAxisTitle,
726
- yAxisTitle: yAxisTitle,
727
- sortOrder: 'none',
728
- width: (_6 = input.layout) === null || _6 === void 0 ? void 0 : _6.width,
729
- height: (_8 = (_7 = input.layout) === null || _7 === void 0 ? void 0 : _7.height) !== null && _8 !== void 0 ? _8 : 350,
730
- hideTickOverlap: true,
731
- noOfCharsToTruncate: 20,
732
- showYAxisLablesTooltip: true,
733
- };
694
+ return tslib_1.__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));
734
695
  };
735
696
  exports.transformPlotlyJsonToHeatmapProps = transformPlotlyJsonToHeatmapProps;
736
697
  var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
@@ -1424,4 +1385,44 @@ var getGridProperties = function (layout, isMultiPlot) {
1424
1385
  };
1425
1386
  };
1426
1387
  exports.getGridProperties = getGridProperties;
1388
+ /**
1389
+ * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/category_order_defaults.js#L50}
1390
+ */
1391
+ var getAxisCategoryOrderProps = function (data, layout) {
1392
+ var result = {};
1393
+ var axesById = {
1394
+ x: layout === null || layout === void 0 ? void 0 : layout.xaxis,
1395
+ y: layout === null || layout === void 0 ? void 0 : layout.yaxis,
1396
+ };
1397
+ Object.keys(axesById).forEach(function (axId) {
1398
+ var ax = axesById[axId];
1399
+ var axLetter = axId[0];
1400
+ var propName = "".concat(axLetter, "AxisCategoryOrder");
1401
+ var values = [];
1402
+ data.forEach(function (series) {
1403
+ var _a;
1404
+ (_a = series[axLetter]) === null || _a === void 0 ? void 0 : _a.forEach(function (val) {
1405
+ if (!(0, chart_utilities_1.isInvalidValue)(val)) {
1406
+ values.push(val);
1407
+ }
1408
+ });
1409
+ });
1410
+ var isAxisTypeCategory = (ax === null || ax === void 0 ? void 0 : ax.type) === 'category' || ((0, chart_utilities_1.isStringArray)(values) && !(0, chart_utilities_1.isNumberArray)(values) && !(0, chart_utilities_1.isDateArray)(values));
1411
+ if (!isAxisTypeCategory) {
1412
+ return;
1413
+ }
1414
+ var isValidArray = (0, chart_utilities_1.isArrayOrTypedArray)(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
1415
+ if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
1416
+ result[propName] = ax.categoryarray;
1417
+ return;
1418
+ }
1419
+ if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
1420
+ var categoriesInTraceOrder = Array.from(new Set(values));
1421
+ result[propName] = categoriesInTraceOrder;
1422
+ return;
1423
+ }
1424
+ result[propName] = ax.categoryorder;
1425
+ });
1426
+ return result;
1427
+ };
1427
1428
  //# sourceMappingURL=PlotlySchemaAdapter.js.map