@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
@@ -1,4 +1,4 @@
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) {
1
+ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../../utilities/colors", "../GaugeChart/index", "../../utilities/utilities", "@fluentui/chart-utilities", "d3-shape", "./PlotlyColorAdapter", "d3-color"], 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, d3_color_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
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;
@@ -240,7 +240,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
240
240
  var rangeXValues = series.x.slice(rangeStart, rangeEnd);
241
241
  var rangeYValues = series.y.slice(rangeStart, rangeEnd);
242
242
  rangeXValues.forEach(function (x, index2) {
243
- var _a, _b, _c, _d;
243
+ var _a, _b, _c, _d, _e, _f;
244
244
  if (!mapXToDataPoints[x]) {
245
245
  mapXToDataPoints[x] = {
246
246
  xAxisPoint: (0, exports.resolveXAxisPoint)(x, isXYearCategory, isXString, isXDate, isXNumber),
@@ -255,12 +255,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
255
255
  ? (_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]
256
256
  : 0)
257
257
  : (0, PlotlyColorAdapter_1.resolveColor)(extractedBarColors, index2, legend, colorMap, isDarkTheme);
258
+ var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index2);
258
259
  var yVal = rangeYValues[index2];
259
260
  if (series.type === 'bar') {
260
261
  mapXToDataPoints[x].chartData.push({
261
262
  legend: legend,
262
263
  data: yVal,
263
- color: color,
264
+ color: (_e = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _e !== void 0 ? _e : color,
264
265
  });
265
266
  if (typeof yVal === 'number') {
266
267
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -274,7 +275,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
274
275
  legend: legend + (validXYRanges.length > 1 ? ".".concat(rangeIdx + 1) : ''),
275
276
  legendShape: legendShape,
276
277
  y: yVal,
277
- color: lineColor,
278
+ color: (_f = (0, d3_color_1.rgb)(lineColor).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
278
279
  lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
279
280
  useSecondaryYScale: usesSecondaryYScale(series, input.layout),
280
281
  });
@@ -287,7 +288,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
287
288
  });
288
289
  });
289
290
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
290
- 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 });
291
+ 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));
291
292
  };
292
293
  exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
293
294
  var createColorScale = function (layout, series) {
@@ -323,7 +324,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
323
324
  // extract colors for each series only once
324
325
  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);
325
326
  (_m = series.x) === null || _m === void 0 ? void 0 : _m.forEach(function (x, xIndex) {
326
- var _a, _b, _c, _d, _e;
327
+ var _a, _b, _c, _d, _e, _f;
327
328
  if ((0, chart_utilities_1.isInvalidValue)(x) || (0, chart_utilities_1.isInvalidValue)((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
328
329
  return;
329
330
  }
@@ -337,12 +338,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
337
338
  ? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
338
339
  ? (_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]
339
340
  : 0)
340
- : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index1, legend, colorMap, isDarkTheme);
341
+ : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, xIndex, legend, colorMap, isDarkTheme);
342
+ var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, xIndex);
341
343
  mapXToDataPoints[x].series.push({
342
344
  key: legend,
343
345
  data: series.y[xIndex],
344
346
  xAxisCalloutData: x,
345
- color: color,
347
+ color: (_f = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
346
348
  legend: legend,
347
349
  useSecondaryYScale: usesSecondaryYScale(series, input.layout),
348
350
  });
@@ -350,7 +352,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
350
352
  });
351
353
  });
352
354
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
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 });
355
+ 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));
354
356
  };
355
357
  exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
356
358
  var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
@@ -399,7 +401,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
399
401
  return yVal;
400
402
  });
401
403
  xBins.forEach(function (bin, index) {
402
- var _a, _b, _c, _d;
404
+ var _a, _b, _c, _d, _e;
403
405
  var legend = legends[seriesIdx];
404
406
  // resolve color for each legend's bars from the colorscale or extracted colors
405
407
  var color = colorScale
@@ -407,27 +409,15 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
407
409
  ? (_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
410
  : 0)
409
411
  : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
412
+ var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
410
413
  var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
411
- vbcData.push(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: color }, (isXString
414
+ 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
412
415
  ? {}
413
416
  : { xAxisCalloutData: "[".concat(bin.x0, " - ").concat(bin.x1, ")") })));
414
417
  });
415
418
  });
416
419
  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
- };
420
+ 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));
431
421
  };
432
422
  exports.transformPlotlyJsonToVBCProps = transformPlotlyJsonToVBCProps;
433
423
  var transformPlotlyJsonToAreaChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
@@ -445,6 +435,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
445
435
  var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme) {
446
436
  var _a, _b, _c, _d, _e, _f, _g;
447
437
  var isScatterMarkers = [
438
+ 'markers',
448
439
  'text+markers',
449
440
  'markers+text',
450
441
  'lines+markers',
@@ -474,12 +465,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
474
465
  var legend = legends[index];
475
466
  // resolve color for each legend's lines from the extracted colors
476
467
  var seriesColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
468
+ var seriesOpacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
477
469
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
478
470
  var lineOptions = getLineOptions(series.line);
479
471
  var legendShape = getLegendShape(series);
480
472
  var validXYRanges = (0, exports.getValidXYRanges)(series);
481
473
  return validXYRanges.map(function (_a, rangeIdx) {
482
- var _b;
474
+ var _b, _c;
483
475
  var rangeStart = _a[0], rangeEnd = _a[1];
484
476
  var rangeXValues = xValues.slice(rangeStart, rangeEnd);
485
477
  var rangeYValues = series.y.slice(rangeStart, rangeEnd);
@@ -498,7 +490,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
498
490
  ? { markerSize: series.marker.size }
499
491
  : {})), (textValues ? { text: textValues[i] } : {})));
500
492
  }),
501
- color: seriesColor,
493
+ color: (_c = (0, d3_color_1.rgb)(seriesColor).copy({ opacity: seriesOpacity }).formatHex8()) !== null && _c !== void 0 ? _c : seriesColor,
502
494
  lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
503
495
  useSecondaryYScale: usesSecondaryYScale(series, input.layout),
504
496
  };
@@ -541,7 +533,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
541
533
  var legend = legends[index];
542
534
  return series.y
543
535
  .map(function (yValue, i) {
544
- var _a, _b, _c, _d, _e;
536
+ var _a, _b, _c, _d, _e, _f;
545
537
  if ((0, chart_utilities_1.isInvalidValue)((_a = series.x) === null || _a === void 0 ? void 0 : _a[i]) || (0, chart_utilities_1.isInvalidValue)(yValue)) {
546
538
  return null;
547
539
  }
@@ -551,19 +543,17 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
551
543
  ? (_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]
552
544
  : 0)
553
545
  : (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
546
+ var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
554
547
  return {
555
548
  x: series.x[i],
556
549
  y: yValue,
557
550
  legend: legend,
558
- color: color,
551
+ color: (_f = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
559
552
  };
560
553
  })
561
554
  .filter(function (point) { return point !== null; });
562
555
  })
563
- .reverse()
564
- .flat()
565
- //reversing the order to invert the Y bars order as required by plotly.
566
- .reverse();
556
+ .flat();
567
557
  var chartHeight = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 450;
568
558
  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;
569
559
  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;
@@ -573,24 +563,9 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
573
563
  var gapFactor = 1 / (1 + scalingFactor * numberOfRows);
574
564
  var barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
575
565
  var _t = getTitles(input.layout), chartTitle = _t.chartTitle, xAxisTitle = _t.xAxisTitle, yAxisTitle = _t.yAxisTitle;
576
- return {
577
- data: chartData,
578
- chartTitle: chartTitle,
579
- xAxisTitle: xAxisTitle,
580
- yAxisTitle: yAxisTitle,
581
- secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
566
+ 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'
582
567
  ? (_m = (_l = input.layout) === null || _l === void 0 ? void 0 : _l.yaxis2) === null || _m === void 0 ? void 0 : _m.title
583
- : ((_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) || '',
584
- barHeight: barHeight,
585
- showYAxisLables: true,
586
- height: chartHeight,
587
- width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width,
588
- hideTickOverlap: true,
589
- hideLegend: hideLegend,
590
- noOfCharsToTruncate: 20,
591
- showYAxisLablesTooltip: true,
592
- roundCorners: true,
593
- };
568
+ : ((_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));
594
569
  };
595
570
  exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
596
571
  var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
@@ -706,22 +681,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
706
681
  ? colorscale.map(function (arr) { return arr[1]; })
707
682
  : defaultRange;
708
683
  var _9 = getTitles(input.layout), chartTitle = _9.chartTitle, xAxisTitle = _9.xAxisTitle, yAxisTitle = _9.yAxisTitle;
709
- return {
710
- data: [heatmapData],
711
- domainValuesForColorScale: domainValuesForColorScale,
712
- rangeValuesForColorScale: rangeValuesForColorScale,
713
- hideLegend: true,
714
- showYAxisLables: true,
715
- chartTitle: chartTitle,
716
- xAxisTitle: xAxisTitle,
717
- yAxisTitle: yAxisTitle,
718
- sortOrder: 'none',
719
- width: (_6 = input.layout) === null || _6 === void 0 ? void 0 : _6.width,
720
- height: (_8 = (_7 = input.layout) === null || _7 === void 0 ? void 0 : _7.height) !== null && _8 !== void 0 ? _8 : 350,
721
- hideTickOverlap: true,
722
- noOfCharsToTruncate: 20,
723
- showYAxisLablesTooltip: true,
724
- };
684
+ 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));
725
685
  };
726
686
  exports.transformPlotlyJsonToHeatmapProps = transformPlotlyJsonToHeatmapProps;
727
687
  var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
@@ -1415,5 +1375,45 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
1415
1375
  };
1416
1376
  };
1417
1377
  exports.getGridProperties = getGridProperties;
1378
+ /**
1379
+ * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/category_order_defaults.js#L50}
1380
+ */
1381
+ var getAxisCategoryOrderProps = function (data, layout) {
1382
+ var result = {};
1383
+ var axesById = {
1384
+ x: layout === null || layout === void 0 ? void 0 : layout.xaxis,
1385
+ y: layout === null || layout === void 0 ? void 0 : layout.yaxis,
1386
+ };
1387
+ Object.keys(axesById).forEach(function (axId) {
1388
+ var ax = axesById[axId];
1389
+ var axLetter = axId[0];
1390
+ var propName = "".concat(axLetter, "AxisCategoryOrder");
1391
+ var values = [];
1392
+ data.forEach(function (series) {
1393
+ var _a;
1394
+ (_a = series[axLetter]) === null || _a === void 0 ? void 0 : _a.forEach(function (val) {
1395
+ if (!(0, chart_utilities_1.isInvalidValue)(val)) {
1396
+ values.push(val);
1397
+ }
1398
+ });
1399
+ });
1400
+ 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));
1401
+ if (!isAxisTypeCategory) {
1402
+ return;
1403
+ }
1404
+ var isValidArray = (0, chart_utilities_1.isArrayOrTypedArray)(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
1405
+ if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
1406
+ result[propName] = ax.categoryarray;
1407
+ return;
1408
+ }
1409
+ if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
1410
+ var categoriesInTraceOrder = Array.from(new Set(values));
1411
+ result[propName] = categoriesInTraceOrder;
1412
+ return;
1413
+ }
1414
+ result[propName] = ax.categoryorder;
1415
+ });
1416
+ return result;
1417
+ };
1418
1418
  });
1419
1419
  //# sourceMappingURL=PlotlySchemaAdapter.js.map