@fluentui/react-charting 5.24.26 → 5.24.27

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 (41) hide show
  1. package/CHANGELOG.json +16 -1
  2. package/CHANGELOG.md +11 -2
  3. package/dist/react-charting.d.ts +7 -0
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +1 -0
  7. package/lib/components/DeclarativeChart/DeclarativeChart.js +16 -5
  8. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  9. package/lib/components/DeclarativeChart/PlotlyColorAdapter.d.ts +8 -4
  10. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +70 -19
  11. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  12. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +86 -85
  13. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  14. package/lib/components/DonutChart/DonutChart.base.js +7 -2
  15. package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
  16. package/lib/components/DonutChart/DonutChart.types.d.ts +7 -0
  17. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  18. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +16 -5
  19. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  20. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +8 -4
  21. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +71 -20
  22. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  23. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +86 -85
  24. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  25. package/lib-amd/components/DonutChart/DonutChart.base.js +7 -2
  26. package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
  27. package/lib-amd/components/DonutChart/DonutChart.types.d.ts +7 -0
  28. package/lib-amd/components/DonutChart/DonutChart.types.js.map +1 -1
  29. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +16 -5
  30. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  31. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +8 -4
  32. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +71 -20
  33. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  34. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +86 -85
  35. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  36. package/lib-commonjs/components/DonutChart/DonutChart.base.js +7 -2
  37. package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
  38. package/lib-commonjs/components/DonutChart/DonutChart.types.d.ts +7 -0
  39. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  40. package/package.json +1 -1
  41. package/src/components/DonutChart/DonutChart.types.ts +8 -0
@@ -183,7 +183,7 @@ var getSecondaryYAxisValues = function (data, layout, maxAllowedMinY, minAllowed
183
183
  };
184
184
  export var _getGaugeAxisColor = function (colorway, colorwayType, color, colorMap, isDarkTheme) {
185
185
  var extractedColors = extractColor(colorway, colorwayType, color, colorMap, isDarkTheme);
186
- return resolveColor(extractedColors, 0, '', colorMap, isDarkTheme);
186
+ return resolveColor(extractedColors, 0, '', colorMap, colorway, isDarkTheme);
187
187
  };
188
188
  export var resolveXAxisPoint = function (x, isXYearCategory, isXString, isXDate, isXNumber) {
189
189
  if (x === null || x === undefined) {
@@ -328,57 +328,41 @@ export var transformPlotlyJsonToDonutProps = function (input, isMultiPlot, color
328
328
  // extract colors for each series only once
329
329
  // use piecolorway if available
330
330
  // otherwise, default to colorway from template
331
- var colors = extractColor((_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.piecolorway) !== null && _b !== void 0 ? _b : (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.layout) === null || _e === void 0 ? void 0 : _e.colorway, colorwayType, (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.piecolorway) !== null && _g !== void 0 ? _g : (_h = firstData === null || firstData === void 0 ? void 0 : firstData.marker) === null || _h === void 0 ? void 0 : _h.colors, colorMap, isDarkTheme);
331
+ var colors = extractColor((_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.piecolorway) !== null && _b !== void 0 ? _b : (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.layout) === null || _e === void 0 ? void 0 : _e.colorway, colorwayType, (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.piecolorway) !== null && _g !== void 0 ? _g : (_h = firstData === null || firstData === void 0 ? void 0 : firstData.marker) === null || _h === void 0 ? void 0 : _h.colors, colorMap, isDarkTheme, true);
332
332
  var mapLegendToDataPoint = {};
333
- if (colors) {
334
- (_j = firstData.labels) === null || _j === void 0 ? void 0 : _j.forEach(function (label, index) {
335
- var value = getNumberAtIndexOrDefault(firstData.values, index);
336
- if (isInvalidValue(value) || value < 0) {
337
- return;
338
- }
339
- var legend = "".concat(label);
340
- // resolve color for each legend from the extracted colors
341
- var color = resolveColor(colors, index, legend, colorMap, isDarkTheme);
333
+ // clear colorMap for donut chart to reassign colors as the colorMap initially gets assigned by
334
+ // getAllupLegendsProps function without sorting labels by value
335
+ colorMap.current.clear();
336
+ // Sort labels by value descending before mapping
337
+ if (firstData.labels && firstData.values) {
338
+ var markerColors_1 = ((_j = firstData.marker) === null || _j === void 0 ? void 0 : _j.colors) || undefined;
339
+ var hasMarkerColors_1 = Array.isArray(markerColors_1) && markerColors_1.length >= firstData.labels.length;
340
+ var labelValuePairs = firstData.labels.map(function (label, index) { return ({
341
+ label: label,
342
+ value: getNumberAtIndexOrDefault(firstData.values, index),
343
+ index: index,
344
+ color: hasMarkerColors_1 ? markerColors_1[index] : undefined,
345
+ }); });
346
+ // Filter out invalid values
347
+ var validPairs = labelValuePairs.filter(function (pair) { return !isInvalidValue(pair.value); });
348
+ // Sort descending by value; when marker colors are present, keep color attached to the label
349
+ validPairs.sort(function (a, b) { return b.value - a.value; });
350
+ validPairs.forEach(function (pair, sortedIdx) {
351
+ var _a, _b, _c, _d, _e, _f;
352
+ var legend = "".concat(pair.label);
353
+ var color = (_a = pair.color) !== null && _a !== void 0 ? _a : resolveColor(colors, sortedIdx, legend, colorMap, (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.piecolorway) !== null && _c !== void 0 ? _c : (_f = (_e = (_d = input.layout) === null || _d === void 0 ? void 0 : _d.template) === null || _e === void 0 ? void 0 : _e.layout) === null || _f === void 0 ? void 0 : _f.colorway, isDarkTheme, true);
342
354
  if (!mapLegendToDataPoint[legend]) {
343
355
  mapLegendToDataPoint[legend] = {
344
356
  legend: legend,
345
- data: value,
357
+ data: pair.value,
346
358
  color: color,
347
359
  };
348
360
  }
349
361
  else {
350
- mapLegendToDataPoint[legend].data += value;
362
+ mapLegendToDataPoint[legend].data += pair.value;
351
363
  }
352
364
  });
353
365
  }
354
- else {
355
- // Sort labels by value descending before mapping
356
- if (firstData.labels && firstData.values) {
357
- var labelValuePairs = firstData.labels.map(function (label, index) { return ({
358
- label: label,
359
- value: getNumberAtIndexOrDefault(firstData.values, index),
360
- index: index,
361
- }); });
362
- // Filter out invalid values
363
- var validPairs = labelValuePairs.filter(function (pair) { return !isInvalidValue(pair.value); });
364
- // Sort descending by value
365
- validPairs.sort(function (a, b) { return b.value - a.value; });
366
- validPairs.forEach(function (pair, sortedIdx) {
367
- var legend = "".concat(pair.label);
368
- var color = resolveColor(colors, sortedIdx, legend, colorMap, isDarkTheme);
369
- if (!mapLegendToDataPoint[legend]) {
370
- mapLegendToDataPoint[legend] = {
371
- legend: legend,
372
- data: pair.value,
373
- color: color,
374
- };
375
- }
376
- else {
377
- mapLegendToDataPoint[legend].data += pair.value;
378
- }
379
- });
380
- }
381
- }
382
366
  var width = (_l = (_k = input.layout) === null || _k === void 0 ? void 0 : _k.width) !== null && _l !== void 0 ? _l : 440;
383
367
  var height = (_o = (_m = input.layout) === null || _m === void 0 ? void 0 : _m.height) !== null && _o !== void 0 ? _o : 220;
384
368
  var hideLabels = firstData.textinfo
@@ -390,10 +374,23 @@ export var transformPlotlyJsonToDonutProps = function (input, isMultiPlot, color
390
374
  ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2)
391
375
  : MIN_DONUT_RADIUS;
392
376
  var chartTitle = getTitles(input.layout).chartTitle;
377
+ // Build anticlockwise order by keeping the first item, reversing the rest
378
+ var legends = Object.keys(mapLegendToDataPoint);
379
+ var reorderedEntries = legends.length > 1
380
+ ? __spreadArray([
381
+ [legends[0], mapLegendToDataPoint[legends[0]]]
382
+ ], legends
383
+ .slice(1)
384
+ .reverse()
385
+ .map(function (key) { return [key, mapLegendToDataPoint[key]]; }), true)
386
+ : legends.map(function (key) { return [key, mapLegendToDataPoint[key]]; });
393
387
  return {
394
388
  data: {
395
389
  chartTitle: chartTitle,
396
- chartData: Object.values(mapLegendToDataPoint),
390
+ chartData: reorderedEntries.map(function (_a) {
391
+ var v = _a[1];
392
+ return v;
393
+ }),
397
394
  },
398
395
  hideLegend: isMultiPlot || ((_p = input.layout) === null || _p === void 0 ? void 0 : _p.showlegend) === false,
399
396
  width: (_q = input.layout) === null || _q === void 0 ? void 0 : _q.width,
@@ -402,6 +399,7 @@ export var transformPlotlyJsonToDonutProps = function (input, isMultiPlot, color
402
399
  hideLabels: hideLabels,
403
400
  showLabelsInPercent: firstData.textinfo ? ['percent', 'label+percent'].includes(firstData.textinfo) : true,
404
401
  roundCorners: true,
402
+ order: 'sorted',
405
403
  };
406
404
  };
407
405
  export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC) {
@@ -431,7 +429,7 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
431
429
  var rangeXValues = series.x.slice(rangeStart, rangeEnd);
432
430
  var rangeYValues = series.y.slice(rangeStart, rangeEnd);
433
431
  rangeXValues.forEach(function (x, index2) {
434
- var _a, _b, _c, _d, _e, _f;
432
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
435
433
  if (!mapXToDataPoints[x]) {
436
434
  mapXToDataPoints[x] = {
437
435
  xAxisPoint: resolveXAxisPoint(x, isXYearCategory, isXString, isXDate, isXNumber),
@@ -445,7 +443,7 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
445
443
  ? colorScale(isArrayOrTypedArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
446
444
  ? (_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]
447
445
  : 0)
448
- : resolveColor(extractedBarColors, index2, legend, colorMap, isDarkTheme);
446
+ : resolveColor(extractedBarColors, index2, legend, colorMap, (_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, isDarkTheme);
449
447
  var opacity = getOpacity(series, index2);
450
448
  var yVal = rangeYValues[index2];
451
449
  var yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
@@ -453,7 +451,7 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
453
451
  mapXToDataPoints[x].chartData.push({
454
452
  legend: legend,
455
453
  data: yVal,
456
- color: (_e = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _e !== void 0 ? _e : color,
454
+ color: (_h = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _h !== void 0 ? _h : color,
457
455
  yAxisCalloutData: yAxisCalloutData,
458
456
  });
459
457
  if (typeof yVal === 'number') {
@@ -461,14 +459,14 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
461
459
  }
462
460
  }
463
461
  else if (series.type === 'scatter' || !!fallbackVSBC) {
464
- var lineColor = resolveColor(extractedLineColors, index1, legend, colorMap, isDarkTheme);
462
+ var lineColor = resolveColor(extractedLineColors, index1, legend, colorMap, (_l = (_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.template) === null || _k === void 0 ? void 0 : _k.layout) === null || _l === void 0 ? void 0 : _l.colorway, isDarkTheme);
465
463
  var lineOptions = getLineOptions(series.line);
466
464
  var legendShape = getLegendShape(series);
467
465
  mapXToDataPoints[x].lineData.push({
468
466
  legend: legend + (validXYRanges.length > 1 ? ".".concat(rangeIdx + 1) : ''),
469
467
  legendShape: legendShape,
470
468
  y: yVal,
471
- color: (_f = rgb(lineColor).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
469
+ color: (_m = rgb(lineColor).copy({ opacity: opacity }).formatHex8()) !== null && _m !== void 0 ? _m : color,
472
470
  lineOptions: __assign(__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
473
471
  useSecondaryYScale: usesSecondaryYScale(series, input.layout),
474
472
  yAxisCalloutData: yAxisCalloutData,
@@ -518,7 +516,7 @@ export var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorM
518
516
  // extract colors for each series only once
519
517
  var extractedColors = extractColor((_c = (_b = (_a = processedInput.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
520
518
  (_e = series.x) === null || _e === void 0 ? void 0 : _e.forEach(function (x, xIndex) {
521
- var _a, _b, _c, _d, _e, _f;
519
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
522
520
  if (isInvalidValue(x) || isInvalidValue((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
523
521
  return;
524
522
  }
@@ -532,14 +530,14 @@ export var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorM
532
530
  ? colorScale(isArrayOrTypedArray((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
533
531
  ? (_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]
534
532
  : 0)
535
- : resolveColor(extractedColors, xIndex, legend, colorMap, isDarkTheme);
533
+ : resolveColor(extractedColors, xIndex, legend, colorMap, (_h = (_g = (_f = processedInput.layout) === null || _f === void 0 ? void 0 : _f.template) === null || _g === void 0 ? void 0 : _g.layout) === null || _h === void 0 ? void 0 : _h.colorway, isDarkTheme);
536
534
  var opacity = getOpacity(series, xIndex);
537
535
  var yVal = series.y[xIndex];
538
536
  mapXToDataPoints[x].series.push({
539
537
  key: legend,
540
538
  data: yVal,
541
539
  xAxisCalloutData: x,
542
- color: (_f = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
540
+ color: (_j = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color,
543
541
  legend: legend,
544
542
  useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout),
545
543
  yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
@@ -591,17 +589,17 @@ export var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMa
591
589
  return yVal;
592
590
  });
593
591
  xBins.forEach(function (bin, index) {
594
- var _a, _b, _c, _d, _e;
592
+ var _a, _b, _c, _d, _e, _f, _g, _h;
595
593
  var legend = legends[seriesIdx];
596
594
  // resolve color for each legend's bars from the colorscale or extracted colors
597
595
  var color = colorScale
598
596
  ? colorScale(isArrayOrTypedArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
599
597
  ? (_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]
600
598
  : 0)
601
- : resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
599
+ : resolveColor(extractedColors, index, legend, colorMap, (_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, isDarkTheme);
602
600
  var opacity = getOpacity(series, index);
603
601
  var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
604
- 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
602
+ vbcData.push(__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: (_h = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _h !== void 0 ? _h : color }, (isXString
605
603
  ? {}
606
604
  : { xAxisCalloutData: "[".concat(bin.x0, " - ").concat(bin.x1, ")") })));
607
605
  });
@@ -637,7 +635,7 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
637
635
  var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
638
636
  var chartData = input.data
639
637
  .map(function (series, index) {
640
- var _a, _b, _c, _d, _e, _f, _g, _h;
638
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
641
639
  var colors = isScatterMarkers
642
640
  ? ((_a = series === null || series === void 0 ? void 0 : series.mode) === null || _a === void 0 ? void 0 : _a.includes('line'))
643
641
  ? (_b = series.line) === null || _b === void 0 ? void 0 : _b.color
@@ -652,11 +650,11 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
652
650
  var isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis
653
651
  var legend = legends[index];
654
652
  // resolve color for each legend's lines from the extracted colors
655
- var seriesColor = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
653
+ var seriesColor = resolveColor(extractedColors, index, legend, colorMap, (_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, isDarkTheme);
656
654
  var seriesOpacity = getOpacity(series, index);
657
655
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
658
656
  // if mode contains 'text', we prioritize showing the text over curving the line
659
- var lineOptions = !((_h = series.mode) === null || _h === void 0 ? void 0 : _h.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
657
+ var lineOptions = !((_l = series.mode) === null || _l === void 0 ? void 0 : _l.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
660
658
  var legendShape = getLegendShape(series);
661
659
  var validXYRanges = getValidXYRanges(series);
662
660
  return validXYRanges.map(function (_a, rangeIdx) {
@@ -730,7 +728,7 @@ export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, is
730
728
  var legend = legends[index];
731
729
  return series.y
732
730
  .map(function (yValue, i) {
733
- var _a, _b, _c, _d, _e, _f;
731
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
734
732
  if (isInvalidValue((_a = series.x) === null || _a === void 0 ? void 0 : _a[i]) || isInvalidValue(yValue)) {
735
733
  return null;
736
734
  }
@@ -739,13 +737,13 @@ export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, is
739
737
  ? colorScale(isArrayOrTypedArray((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
740
738
  ? (_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]
741
739
  : 0)
742
- : resolveColor(extractedColors, i, legend, colorMap, isDarkTheme);
740
+ : resolveColor(extractedColors, i, legend, colorMap, (_h = (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.template) === null || _g === void 0 ? void 0 : _g.layout) === null || _h === void 0 ? void 0 : _h.colorway, isDarkTheme);
743
741
  var opacity = getOpacity(series, i);
744
742
  return {
745
743
  x: series.x[i],
746
744
  y: yValue,
747
745
  legend: legend,
748
- color: (_f = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
746
+ color: (_j = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color,
749
747
  };
750
748
  })
751
749
  .filter(function (point) { return point !== null; });
@@ -781,7 +779,7 @@ export var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot,
781
779
  };
782
780
  return series.y
783
781
  .map(function (yVal, i) {
784
- var _a, _b, _c, _d, _e, _f, _g;
782
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
785
783
  if (isInvalidValue(yVal)) {
786
784
  return null;
787
785
  }
@@ -790,10 +788,10 @@ export var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot,
790
788
  ? colorScale(isArrayOrTypedArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
791
789
  ? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[i % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
792
790
  : 0)
793
- : resolveColor(extractedColors, i, legend, colorMap, isDarkTheme);
791
+ : resolveColor(extractedColors, i, legend, colorMap, (_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, isDarkTheme);
794
792
  var opacity = getOpacity(series, i);
795
- var base = convertXValueToNumber((_e = series.base) === null || _e === void 0 ? void 0 : _e[i]);
796
- var xVal = convertXValueToNumber((_f = series.x) === null || _f === void 0 ? void 0 : _f[i]);
793
+ var base = convertXValueToNumber((_h = series.base) === null || _h === void 0 ? void 0 : _h[i]);
794
+ var xVal = convertXValueToNumber((_j = series.x) === null || _j === void 0 ? void 0 : _j[i]);
797
795
  return {
798
796
  x: {
799
797
  start: isXDate ? new Date(base) : base,
@@ -801,7 +799,7 @@ export var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot,
801
799
  },
802
800
  y: yVal,
803
801
  legend: legend,
804
- color: (_g = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _g !== void 0 ? _g : color,
802
+ color: (_k = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _k !== void 0 ? _k : color,
805
803
  };
806
804
  })
807
805
  .filter(function (point) { return point !== null; });
@@ -943,7 +941,8 @@ export var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot, colo
943
941
  var extractedNodeColors = extractColor((_d = (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.template) === null || _c === void 0 ? void 0 : _c.layout) === null || _d === void 0 ? void 0 : _d.colorway, colorwayType, node === null || node === void 0 ? void 0 : node.color, colorMap, isDarkTheme);
944
942
  var sankeyChartData = {
945
943
  nodes: (_e = node.label) === null || _e === void 0 ? void 0 : _e.map(function (label, index) {
946
- var color = resolveColor(extractedNodeColors, index, label, colorMap, isDarkTheme);
944
+ var _a, _b, _c;
945
+ var color = resolveColor(extractedNodeColors, index, label, colorMap, (_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, isDarkTheme);
947
946
  return {
948
947
  nodeId: index,
949
948
  name: label,
@@ -971,19 +970,19 @@ export var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot, colo
971
970
  };
972
971
  };
973
972
  export var transformPlotlyJsonToGaugeProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
974
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25;
973
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31;
975
974
  var firstData = input.data[0];
976
975
  var stepsColors = ((_a = firstData.gauge) === null || _a === void 0 ? void 0 : _a.steps) ? firstData.gauge.steps.map(function (step) { return step.color; }) : undefined;
977
976
  var extractedColors = extractColor((_d = (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.template) === null || _c === void 0 ? void 0 : _c.layout) === null || _d === void 0 ? void 0 : _d.colorway, colorwayType, stepsColors, colorMap, isDarkTheme);
978
977
  var segments = ((_f = (_e = firstData.gauge) === null || _e === void 0 ? void 0 : _e.steps) === null || _f === void 0 ? void 0 : _f.length)
979
978
  ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
980
979
  firstData.gauge.steps.map(function (step, index) {
981
- var _a, _b;
980
+ var _a, _b, _c, _d, _e;
982
981
  var legend = step.name || "Segment ".concat(index + 1);
983
- var color = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
982
+ var color = resolveColor(extractedColors, index, legend, colorMap, (_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, isDarkTheme);
984
983
  return {
985
984
  legend: legend,
986
- size: ((_a = step.range) === null || _a === void 0 ? void 0 : _a[1]) - ((_b = step.range) === null || _b === void 0 ? void 0 : _b[0]),
985
+ size: ((_d = step.range) === null || _d === void 0 ? void 0 : _d[1]) - ((_e = step.range) === null || _e === void 0 ? void 0 : _e[0]),
987
986
  color: color,
988
987
  };
989
988
  })
@@ -1006,13 +1005,13 @@ export var transformPlotlyJsonToGaugeProps = function (input, isMultiPlot, color
1006
1005
  if (diff >= 0) {
1007
1006
  sublabel = "\u25B2 ".concat(diff);
1008
1007
  var extractedIncreasingDeltaColors = extractColor((_0 = (_z = (_y = input.layout) === null || _y === void 0 ? void 0 : _y.template) === null || _z === void 0 ? void 0 : _z.layout) === null || _0 === void 0 ? void 0 : _0.colorway, colorwayType, (_2 = (_1 = firstData.delta) === null || _1 === void 0 ? void 0 : _1.increasing) === null || _2 === void 0 ? void 0 : _2.color, colorMap, isDarkTheme);
1009
- var color = resolveColor(extractedIncreasingDeltaColors, 0, '', colorMap, isDarkTheme);
1008
+ var color = resolveColor(extractedIncreasingDeltaColors, 0, '', colorMap, (_5 = (_4 = (_3 = input.layout) === null || _3 === void 0 ? void 0 : _3.template) === null || _4 === void 0 ? void 0 : _4.layout) === null || _5 === void 0 ? void 0 : _5.colorway, isDarkTheme);
1010
1009
  sublabelColor = color;
1011
1010
  }
1012
1011
  else {
1013
1012
  sublabel = "\u25BC ".concat(Math.abs(diff));
1014
- var extractedDecreasingDeltaColors = extractColor((_5 = (_4 = (_3 = input.layout) === null || _3 === void 0 ? void 0 : _3.template) === null || _4 === void 0 ? void 0 : _4.layout) === null || _5 === void 0 ? void 0 : _5.colorway, colorwayType, (_7 = (_6 = firstData.delta) === null || _6 === void 0 ? void 0 : _6.decreasing) === null || _7 === void 0 ? void 0 : _7.color, colorMap, isDarkTheme);
1015
- var color = resolveColor(extractedDecreasingDeltaColors, 0, '', colorMap, isDarkTheme);
1013
+ var extractedDecreasingDeltaColors = extractColor((_8 = (_7 = (_6 = input.layout) === null || _6 === void 0 ? void 0 : _6.template) === null || _7 === void 0 ? void 0 : _7.layout) === null || _8 === void 0 ? void 0 : _8.colorway, colorwayType, (_10 = (_9 = firstData.delta) === null || _9 === void 0 ? void 0 : _9.decreasing) === null || _10 === void 0 ? void 0 : _10.color, colorMap, isDarkTheme);
1014
+ var color = resolveColor(extractedDecreasingDeltaColors, 0, '', colorMap, (_13 = (_12 = (_11 = input.layout) === null || _11 === void 0 ? void 0 : _11.template) === null || _12 === void 0 ? void 0 : _12.layout) === null || _13 === void 0 ? void 0 : _13.colorway, isDarkTheme);
1016
1015
  sublabelColor = color;
1017
1016
  }
1018
1017
  }
@@ -1024,17 +1023,17 @@ export var transformPlotlyJsonToGaugeProps = function (input, isMultiPlot, color
1024
1023
  var chartTitle = getTitles(input.layout).chartTitle;
1025
1024
  return {
1026
1025
  segments: segments,
1027
- chartValue: (_8 = firstData.value) !== null && _8 !== void 0 ? _8 : 0,
1026
+ chartValue: (_14 = firstData.value) !== null && _14 !== void 0 ? _14 : 0,
1028
1027
  chartTitle: chartTitle,
1029
1028
  sublabel: sublabel,
1030
1029
  // range values can be null
1031
- minValue: typeof ((_11 = (_10 = (_9 = firstData.gauge) === null || _9 === void 0 ? void 0 : _9.axis) === null || _10 === void 0 ? void 0 : _10.range) === null || _11 === void 0 ? void 0 : _11[0]) === 'number' ? (_14 = (_13 = (_12 = firstData.gauge) === null || _12 === void 0 ? void 0 : _12.axis) === null || _13 === void 0 ? void 0 : _13.range) === null || _14 === void 0 ? void 0 : _14[0] : undefined,
1032
- maxValue: typeof ((_17 = (_16 = (_15 = firstData.gauge) === null || _15 === void 0 ? void 0 : _15.axis) === null || _16 === void 0 ? void 0 : _16.range) === null || _17 === void 0 ? void 0 : _17[1]) === 'number' ? (_20 = (_19 = (_18 = firstData.gauge) === null || _18 === void 0 ? void 0 : _18.axis) === null || _19 === void 0 ? void 0 : _19.range) === null || _20 === void 0 ? void 0 : _20[1] : undefined,
1030
+ minValue: typeof ((_17 = (_16 = (_15 = firstData.gauge) === null || _15 === void 0 ? void 0 : _15.axis) === null || _16 === void 0 ? void 0 : _16.range) === null || _17 === void 0 ? void 0 : _17[0]) === 'number' ? (_20 = (_19 = (_18 = firstData.gauge) === null || _18 === void 0 ? void 0 : _18.axis) === null || _19 === void 0 ? void 0 : _19.range) === null || _20 === void 0 ? void 0 : _20[0] : undefined,
1031
+ maxValue: typeof ((_23 = (_22 = (_21 = firstData.gauge) === null || _21 === void 0 ? void 0 : _21.axis) === null || _22 === void 0 ? void 0 : _22.range) === null || _23 === void 0 ? void 0 : _23[1]) === 'number' ? (_26 = (_25 = (_24 = firstData.gauge) === null || _24 === void 0 ? void 0 : _24.axis) === null || _25 === void 0 ? void 0 : _25.range) === null || _26 === void 0 ? void 0 : _26[1] : undefined,
1033
1032
  chartValueFormat: function () { var _a, _b; return (_b = (_a = firstData.value) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''; },
1034
- width: (_21 = input.layout) === null || _21 === void 0 ? void 0 : _21.width,
1035
- height: (_23 = (_22 = input.layout) === null || _22 === void 0 ? void 0 : _22.height) !== null && _23 !== void 0 ? _23 : 220,
1033
+ width: (_27 = input.layout) === null || _27 === void 0 ? void 0 : _27.width,
1034
+ height: (_29 = (_28 = input.layout) === null || _28 === void 0 ? void 0 : _28.height) !== null && _29 !== void 0 ? _29 : 220,
1036
1035
  styles: styles,
1037
- variant: ((_25 = (_24 = firstData.gauge) === null || _24 === void 0 ? void 0 : _24.steps) === null || _25 === void 0 ? void 0 : _25.length) ? GaugeChartVariant.MultipleSegments : GaugeChartVariant.SingleSegment,
1036
+ variant: ((_31 = (_30 = firstData.gauge) === null || _30 === void 0 ? void 0 : _30.steps) === null || _31 === void 0 ? void 0 : _31.length) ? GaugeChartVariant.MultipleSegments : GaugeChartVariant.SingleSegment,
1038
1037
  roundCorners: true,
1039
1038
  };
1040
1039
  };
@@ -1243,15 +1242,15 @@ export var transformPlotlyJsonToFunnelChartProps = function (input, isMultiPlot,
1243
1242
  // Assign a color per series/category and use it for all subValues of that category
1244
1243
  var seriesColors_1 = {};
1245
1244
  input.data.forEach(function (series, seriesIdx) {
1246
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1245
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
1247
1246
  var category = series.name || "Category ".concat(seriesIdx + 1);
1248
1247
  // Use the same color for this category across all stages
1249
1248
  var extractedColors = extractColor((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_e = (_d = series.marker) === null || _d === void 0 ? void 0 : _d.colors) !== null && _e !== void 0 ? _e : (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color, colorMap, isDarkTheme);
1250
1249
  // Always use the first color for the series/category
1251
- var color = resolveColor(extractedColors, 0, category, colorMap, isDarkTheme);
1250
+ var color = resolveColor(extractedColors, 0, category, colorMap, (_j = (_h = (_g = input.layout) === null || _g === void 0 ? void 0 : _g.template) === null || _h === void 0 ? void 0 : _h.layout) === null || _j === void 0 ? void 0 : _j.colorway, isDarkTheme);
1252
1251
  seriesColors_1[category] = color;
1253
- var labels = (_h = (_g = series.labels) !== null && _g !== void 0 ? _g : series.y) !== null && _h !== void 0 ? _h : series.stage;
1254
- var values = (_k = (_j = series.values) !== null && _j !== void 0 ? _j : series.x) !== null && _k !== void 0 ? _k : series.value;
1252
+ var labels = (_l = (_k = series.labels) !== null && _k !== void 0 ? _k : series.y) !== null && _l !== void 0 ? _l : series.stage;
1253
+ var values = (_o = (_m = series.values) !== null && _m !== void 0 ? _m : series.x) !== null && _o !== void 0 ? _o : series.value;
1255
1254
  if (!isArrayOrTypedArray(labels) || !isArrayOrTypedArray(values)) {
1256
1255
  return;
1257
1256
  }
@@ -1285,7 +1284,8 @@ export var transformPlotlyJsonToFunnelChartProps = function (input, isMultiPlot,
1285
1284
  }
1286
1285
  var extractedColors = extractColor((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_e = (_d = series.marker) === null || _d === void 0 ? void 0 : _d.colors) !== null && _e !== void 0 ? _e : (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color, colorMap, isDarkTheme);
1287
1286
  categories.forEach(function (label, i) {
1288
- var color = resolveColor(extractedColors, i, label, colorMap, isDarkTheme);
1287
+ var _a, _b, _c;
1288
+ var color = resolveColor(extractedColors, i, label, colorMap, (_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, isDarkTheme);
1289
1289
  var valueNum = Number(values[i]);
1290
1290
  if (isNaN(valueNum)) {
1291
1291
  return;
@@ -1619,11 +1619,12 @@ export var getAllupLegendsProps = function (input, colorMap, colorwayType, trace
1619
1619
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1620
1620
  if (traceInfo[index].type === 'donut') {
1621
1621
  var pieSeries = series;
1622
- var colors_1 = extractColor((_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.piecolorway) !== null && _b !== void 0 ? _b : (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.layout) === null || _e === void 0 ? void 0 : _e.colorway, colorwayType, (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.piecolorway) !== null && _g !== void 0 ? _g : (_h = pieSeries === null || pieSeries === void 0 ? void 0 : pieSeries.marker) === null || _h === void 0 ? void 0 : _h.colors, colorMap, isDarkTheme);
1622
+ var colors_1 = extractColor((_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.piecolorway) !== null && _b !== void 0 ? _b : (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.layout) === null || _e === void 0 ? void 0 : _e.colorway, colorwayType, (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.piecolorway) !== null && _g !== void 0 ? _g : (_h = pieSeries === null || pieSeries === void 0 ? void 0 : pieSeries.marker) === null || _h === void 0 ? void 0 : _h.colors, colorMap, isDarkTheme, true);
1623
1623
  (_j = pieSeries.labels) === null || _j === void 0 ? void 0 : _j.forEach(function (label, labelIndex) {
1624
+ var _a, _b, _c, _d, _e;
1624
1625
  var legend = "".concat(label);
1625
1626
  // resolve color for each legend from the extracted colors
1626
- var color = resolveColor(colors_1, labelIndex, legend, colorMap, isDarkTheme);
1627
+ var color = resolveColor(colors_1, labelIndex, legend, colorMap, (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.piecolorway) !== null && _b !== void 0 ? _b : (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.layout) === null || _e === void 0 ? void 0 : _e.colorway, isDarkTheme, true);
1627
1628
  if (legend !== '' && allupLegends.some(function (group) { return group.title === legend; }) === false) {
1628
1629
  allupLegends.push({
1629
1630
  title: legend,