@fluentui/react-charts 0.0.0-nightly-20250820-0406.1 → 0.0.0-nightly-20250821-0406.1

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 (34) hide show
  1. package/CHANGELOG.md +15 -15
  2. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +1 -1
  3. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  4. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +53 -8
  5. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  6. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +23 -4
  7. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  8. package/lib/components/HeatMapChart/HeatMapChart.js +175 -114
  9. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  10. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +26 -6
  11. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  12. package/lib/components/ScatterChart/ScatterChart.js +4 -2
  13. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  14. package/lib/components/VerticalBarChart/VerticalBarChart.js +27 -4
  15. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  16. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +61 -44
  17. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  18. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +1 -1
  19. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  20. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +53 -8
  21. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  22. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +22 -3
  23. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  24. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +174 -113
  25. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  26. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +25 -5
  27. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  28. package/lib-commonjs/components/ScatterChart/ScatterChart.js +4 -2
  29. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  30. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +26 -3
  31. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  32. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +60 -43
  33. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  34. package/package.json +12 -12
@@ -389,7 +389,8 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
389
389
  roundCorners: true,
390
390
  showYAxisLables: true,
391
391
  noOfCharsToTruncate: 20,
392
- showYAxisLablesTooltip: true
392
+ showYAxisLablesTooltip: true,
393
+ ...getAxisCategoryOrderProps(input.data, input.layout)
393
394
  };
394
395
  };
395
396
  const createColorScale = (layout, series)=>{
@@ -434,7 +435,7 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
434
435
  var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
435
436
  const legend = legends[index1];
436
437
  // resolve color for each legend's bars from the colorscale or extracted colors
437
- const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index1, legend, colorMap, isDarkTheme);
438
+ const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index2, legend, colorMap, isDarkTheme);
438
439
  const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
439
440
  var _rgb_copy_formatHex8;
440
441
  mapXToDataPoints[x].series.push({
@@ -466,7 +467,8 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
466
467
  hideTickOverlap: true,
467
468
  wrapXAxisLables: typeof ((_gvbcData_ = gvbcData[0]) === null || _gvbcData_ === void 0 ? void 0 : _gvbcData_.name) === 'string',
468
469
  hideLegend,
469
- roundCorners: true
470
+ roundCorners: true,
471
+ ...getAxisCategoryOrderProps(input.data, input.layout)
470
472
  };
471
473
  };
472
474
  const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -546,7 +548,8 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
546
548
  wrapXAxisLables: typeof ((_vbcData_ = vbcData[0]) === null || _vbcData_ === void 0 ? void 0 : _vbcData_.x) === 'string',
547
549
  maxBarWidth: 50,
548
550
  hideLegend,
549
- roundCorners: true
551
+ roundCorners: true,
552
+ ...getAxisCategoryOrderProps(input.data, input.layout)
550
553
  };
551
554
  };
552
555
  const transformPlotlyJsonToAreaChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -706,8 +709,7 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
706
709
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
707
710
  };
708
711
  }).filter((point)=>point !== null);
709
- }).reverse().flat() //reversing the order to invert the Y bars order as required by plotly.
710
- .reverse();
712
+ }).flat();
711
713
  var _input_layout_height;
712
714
  const chartHeight = (_input_layout_height = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 450;
713
715
  var _input_layout_margin_l;
@@ -734,7 +736,8 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
734
736
  noOfCharsToTruncate: 20,
735
737
  showYAxisLablesTooltip: true,
736
738
  hideLegend,
737
- roundCorners: true
739
+ roundCorners: true,
740
+ ...getAxisCategoryOrderProps(input.data, input.layout)
738
741
  };
739
742
  };
740
743
  const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -866,7 +869,10 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
866
869
  hideTickOverlap: true,
867
870
  noOfCharsToTruncate: 20,
868
871
  showYAxisLablesTooltip: true,
869
- wrapXAxisLables: true
872
+ wrapXAxisLables: true,
873
+ ...getAxisCategoryOrderProps([
874
+ firstData
875
+ ], input.layout)
870
876
  };
871
877
  };
872
878
  const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -1587,3 +1593,42 @@ const getGridProperties = (layout, isMultiPlot)=>{
1587
1593
  layout: reversedGridLayout
1588
1594
  };
1589
1595
  };
1596
+ /**
1597
+ * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/category_order_defaults.js#L50}
1598
+ */ const getAxisCategoryOrderProps = (data, layout)=>{
1599
+ const result = {};
1600
+ const axesById = {
1601
+ x: layout === null || layout === void 0 ? void 0 : layout.xaxis,
1602
+ y: layout === null || layout === void 0 ? void 0 : layout.yaxis
1603
+ };
1604
+ Object.keys(axesById).forEach((axId)=>{
1605
+ const ax = axesById[axId];
1606
+ const axLetter = axId[0];
1607
+ const propName = `${axLetter}AxisCategoryOrder`;
1608
+ const values = [];
1609
+ data.forEach((series)=>{
1610
+ var _series_axLetter;
1611
+ (_series_axLetter = series[axLetter]) === null || _series_axLetter === void 0 ? void 0 : _series_axLetter.forEach((val)=>{
1612
+ if (!(0, _chartutilities.isInvalidValue)(val)) {
1613
+ values.push(val);
1614
+ }
1615
+ });
1616
+ });
1617
+ const isAxisTypeCategory = (ax === null || ax === void 0 ? void 0 : ax.type) === 'category' || (0, _chartutilities.isStringArray)(values) && !(0, _chartutilities.isNumberArray)(values) && !(0, _chartutilities.isDateArray)(values);
1618
+ if (!isAxisTypeCategory) {
1619
+ return;
1620
+ }
1621
+ const isValidArray = (0, _chartutilities.isArrayOrTypedArray)(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
1622
+ if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
1623
+ result[propName] = ax.categoryarray;
1624
+ return;
1625
+ }
1626
+ if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
1627
+ const categoriesInTraceOrder = Array.from(new Set(values));
1628
+ result[propName] = categoriesInTraceOrder;
1629
+ return;
1630
+ }
1631
+ result[propName] = ax.categoryorder;
1632
+ });
1633
+ return result;
1634
+ };