@fluentui/react-charts 0.0.0-nightly-20251014-0406.1 → 0.0.0-nightly-20251015-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.
@@ -178,7 +178,7 @@ const getSecondaryYAxisValues = (data, layout, maxAllowedMinY, minAllowedMaxY)=>
178
178
  };
179
179
  export const _getGaugeAxisColor = (colorway, colorwayType, color, colorMap, isDarkTheme)=>{
180
180
  const extractedColors = extractColor(colorway, colorwayType, color, colorMap, isDarkTheme);
181
- return resolveColor(extractedColors, 0, '', colorMap, isDarkTheme);
181
+ return resolveColor(extractedColors, 0, '', colorMap, colorway, isDarkTheme);
182
182
  };
183
183
  export const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNumber)=>{
184
184
  if (x === null || x === undefined) {
@@ -320,54 +320,41 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
320
320
  // extract colors for each series only once
321
321
  // use piecolorway if available
322
322
  // otherwise, default to colorway from template
323
- const colors = extractColor((_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_input_layout_piecolorway1 = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.piecolorway) !== null && _input_layout_piecolorway1 !== void 0 ? _input_layout_piecolorway1 : firstData === null || firstData === void 0 ? void 0 : (_firstData_marker = firstData.marker) === null || _firstData_marker === void 0 ? void 0 : _firstData_marker.colors, colorMap, isDarkTheme);
323
+ const colors = extractColor((_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_input_layout_piecolorway1 = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.piecolorway) !== null && _input_layout_piecolorway1 !== void 0 ? _input_layout_piecolorway1 : firstData === null || firstData === void 0 ? void 0 : (_firstData_marker = firstData.marker) === null || _firstData_marker === void 0 ? void 0 : _firstData_marker.colors, colorMap, isDarkTheme, true);
324
324
  const mapLegendToDataPoint = {};
325
- if (colors) {
326
- var _firstData_labels;
327
- (_firstData_labels = firstData.labels) === null || _firstData_labels === void 0 ? void 0 : _firstData_labels.forEach((label, index)=>{
328
- const value = getNumberAtIndexOrDefault(firstData.values, index);
329
- if (isInvalidValue(value) || value < 0) {
330
- return;
331
- }
332
- const legend = `${label}`;
333
- // resolve color for each legend from the extracted colors
334
- const color = resolveColor(colors, index, legend, colorMap, isDarkTheme);
325
+ // clear colorMap for donut chart to reassign colors as the colorMap initially gets assigned by
326
+ // getAllupLegendsProps function without sorting labels by value
327
+ colorMap.current.clear();
328
+ // Sort labels by value descending before mapping
329
+ if (firstData.labels && firstData.values) {
330
+ var _firstData_marker1;
331
+ const markerColors = ((_firstData_marker1 = firstData.marker) === null || _firstData_marker1 === void 0 ? void 0 : _firstData_marker1.colors) || undefined;
332
+ const hasMarkerColors = Array.isArray(markerColors) && markerColors.length >= firstData.labels.length;
333
+ const labelValuePairs = firstData.labels.map((label, index)=>({
334
+ label,
335
+ value: getNumberAtIndexOrDefault(firstData.values, index),
336
+ index,
337
+ color: hasMarkerColors ? markerColors[index] : undefined
338
+ }));
339
+ // Filter out invalid values
340
+ const validPairs = labelValuePairs.filter((pair)=>!isInvalidValue(pair.value));
341
+ // Sort descending by value; when marker colors are present, keep color attached to the label
342
+ validPairs.sort((a, b)=>b.value - a.value);
343
+ validPairs.forEach((pair, sortedIdx)=>{
344
+ var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1;
345
+ const legend = `${pair.label}`;
346
+ var _input_layout_piecolorway, _pair_color;
347
+ const color = (_pair_color = pair.color) !== null && _pair_color !== void 0 ? _pair_color : resolveColor(colors, sortedIdx, legend, colorMap, (_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme, true);
335
348
  if (!mapLegendToDataPoint[legend]) {
336
349
  mapLegendToDataPoint[legend] = {
337
350
  legend,
338
- data: value,
351
+ data: pair.value,
339
352
  color
340
353
  };
341
354
  } else {
342
- mapLegendToDataPoint[legend].data += value;
355
+ mapLegendToDataPoint[legend].data += pair.value;
343
356
  }
344
357
  });
345
- } else {
346
- // Sort labels by value descending before mapping
347
- if (firstData.labels && firstData.values) {
348
- const labelValuePairs = firstData.labels.map((label, index)=>({
349
- label,
350
- value: getNumberAtIndexOrDefault(firstData.values, index),
351
- index
352
- }));
353
- // Filter out invalid values
354
- const validPairs = labelValuePairs.filter((pair)=>!isInvalidValue(pair.value));
355
- // Sort descending by value
356
- validPairs.sort((a, b)=>b.value - a.value);
357
- validPairs.forEach((pair, sortedIdx)=>{
358
- const legend = `${pair.label}`;
359
- const color = resolveColor(colors, sortedIdx, legend, colorMap, isDarkTheme);
360
- if (!mapLegendToDataPoint[legend]) {
361
- mapLegendToDataPoint[legend] = {
362
- legend,
363
- data: pair.value,
364
- color
365
- };
366
- } else {
367
- mapLegendToDataPoint[legend].data += pair.value;
368
- }
369
- });
370
- }
371
358
  }
372
359
  var _input_layout_width;
373
360
  const width = (_input_layout_width = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.width) !== null && _input_layout_width !== void 0 ? _input_layout_width : 440;
@@ -382,10 +369,25 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
382
369
  const donutMarginVertical = 40 + (hideLabels ? 0 : 40);
383
370
  const innerRadius = firstData.hole ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2) : MIN_DONUT_RADIUS;
384
371
  const { chartTitle } = getTitles(input.layout);
372
+ // Build anticlockwise order by keeping the first item, reversing the rest
373
+ const legends = Object.keys(mapLegendToDataPoint);
374
+ const reorderedEntries = legends.length > 1 ? [
375
+ [
376
+ legends[0],
377
+ mapLegendToDataPoint[legends[0]]
378
+ ],
379
+ ...legends.slice(1).reverse().map((key)=>[
380
+ key,
381
+ mapLegendToDataPoint[key]
382
+ ])
383
+ ] : legends.map((key)=>[
384
+ key,
385
+ mapLegendToDataPoint[key]
386
+ ]);
385
387
  return {
386
388
  data: {
387
389
  chartTitle,
388
- chartData: Object.values(mapLegendToDataPoint)
390
+ chartData: reorderedEntries.map(([, v])=>v)
389
391
  },
390
392
  hideLegend: isMultiPlot || ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false,
391
393
  width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
@@ -396,7 +398,8 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
396
398
  'percent',
397
399
  'label+percent'
398
400
  ].includes(firstData.textinfo) : true,
399
- roundCorners: true
401
+ roundCorners: true,
402
+ order: 'sorted'
400
403
  };
401
404
  };
402
405
  export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
@@ -425,7 +428,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
425
428
  const rangeXValues = series.x.slice(rangeStart, rangeEnd);
426
429
  const rangeYValues = series.y.slice(rangeStart, rangeEnd);
427
430
  rangeXValues.forEach((x, index2)=>{
428
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
431
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
429
432
  if (!mapXToDataPoints[x]) {
430
433
  mapXToDataPoints[x] = {
431
434
  xAxisPoint: resolveXAxisPoint(x, isXYearCategory, isXString, isXDate, isXNumber),
@@ -435,7 +438,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
435
438
  }
436
439
  const legend = legends[index1];
437
440
  // resolve color for each legend's bars from the colorscale or extracted colors
438
- const color = colorScale ? colorScale(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) : resolveColor(extractedBarColors, index2, legend, colorMap, isDarkTheme);
441
+ const color = colorScale ? colorScale(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) : resolveColor(extractedBarColors, index2, legend, colorMap, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme);
439
442
  const opacity = getOpacity(series, index2);
440
443
  const yVal = rangeYValues[index2];
441
444
  const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
@@ -453,8 +456,8 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
453
456
  yMaxValue = Math.max(yMaxValue, yVal);
454
457
  }
455
458
  } else if (series.type === 'scatter' || !!fallbackVSBC) {
456
- var _series_mode;
457
- const lineColor = resolveColor(extractedLineColors, index1, legend, colorMap, isDarkTheme);
459
+ var _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_mode;
460
+ const lineColor = resolveColor(extractedLineColors, index1, legend, colorMap, (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, isDarkTheme);
458
461
  const lineOptions = !((_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('text')) ? getLineOptions(series.line) : undefined;
459
462
  const legendShape = getLegendShape(series);
460
463
  var _rgb_copy_formatHex81;
@@ -561,10 +564,10 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
561
564
  };
562
565
  }
563
566
  if (series.type === 'bar') {
564
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
567
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _processedInput_layout_template_layout, _processedInput_layout_template, _processedInput_layout;
565
568
  const legend = legends[index1];
566
569
  // resolve color for each legend's bars from the colorscale or extracted colors
567
- const color = colorScale ? colorScale(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) : resolveColor(extractedColors, index2, legend, colorMap, isDarkTheme);
570
+ const color = colorScale ? colorScale(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) : resolveColor(extractedColors, index2, legend, colorMap, (_processedInput_layout = processedInput.layout) === null || _processedInput_layout === void 0 ? void 0 : (_processedInput_layout_template = _processedInput_layout.template) === null || _processedInput_layout_template === void 0 ? void 0 : (_processedInput_layout_template_layout = _processedInput_layout_template.layout) === null || _processedInput_layout_template_layout === void 0 ? void 0 : _processedInput_layout_template_layout.colorway, isDarkTheme);
568
571
  const opacity = getOpacity(series, index2);
569
572
  const yVal = series.y[index2];
570
573
  var _rgb_copy_formatHex8;
@@ -645,10 +648,10 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
645
648
  return yVal;
646
649
  });
647
650
  xBins.forEach((bin, index)=>{
648
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
651
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
649
652
  const legend = legends[seriesIdx];
650
653
  // resolve color for each legend's bars from the colorscale or extracted colors
651
- const color = colorScale ? colorScale(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[index % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
654
+ const color = colorScale ? colorScale(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[index % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedColors, index, legend, colorMap, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme);
652
655
  const opacity = getOpacity(series, index);
653
656
  const yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
654
657
  var _rgb_copy_formatHex8;
@@ -710,7 +713,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
710
713
  const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
711
714
  var shouldWrapLabels = false;
712
715
  const chartData = input.data.map((series, index)=>{
713
- var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _series_mode1;
716
+ var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_mode1;
714
717
  const colors = isScatterMarkers ? (series === null || series === void 0 ? void 0 : (_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('line')) ? (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color : (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color : (_series_line1 = series.line) === null || _series_line1 === void 0 ? void 0 : _series_line1.color;
715
718
  // extract colors for each series only once
716
719
  const extractedColors = extractColor((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, colors, colorMap, isDarkTheme);
@@ -722,7 +725,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
722
725
  shouldWrapLabels = shouldWrapLabels || isXString && !isXDate;
723
726
  const legend = legends[index];
724
727
  // resolve color for each legend's lines from the extracted colors
725
- const seriesColor = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
728
+ const seriesColor = resolveColor(extractedColors, index, legend, colorMap, (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, isDarkTheme);
726
729
  const seriesOpacity = getOpacity(series, index);
727
730
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
728
731
  // if mode contains 'text', we prioritize showing the text over curving the line
@@ -839,12 +842,12 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPl
839
842
  const extractedColors = extractColor((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
840
843
  const legend = legends[index];
841
844
  return series.y.map((yValue, i)=>{
842
- var _series_x, _series_marker, _series_marker1, _series_marker_color, _series_marker2;
845
+ var _series_x, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
843
846
  if (isInvalidValue((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]) || isInvalidValue(yValue)) {
844
847
  return null;
845
848
  }
846
849
  // resolve color for each legend's bars from the colorscale or extracted colors
847
- const color = colorScale ? colorScale(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[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedColors, i, legend, colorMap, isDarkTheme);
850
+ const color = colorScale ? colorScale(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[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedColors, i, legend, colorMap, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme);
848
851
  const opacity = getOpacity(series, i);
849
852
  var _rgb_copy_formatHex8;
850
853
  return {
@@ -902,12 +905,12 @@ export const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMa
902
905
  return isInvalidValue(value) ? 0 : isXDate ? +parseLocalDate(value) : +value;
903
906
  };
904
907
  return series.y.map((yVal, i)=>{
905
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _series_base, _series_x;
908
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_base, _series_x;
906
909
  if (isInvalidValue(yVal)) {
907
910
  return null;
908
911
  }
909
912
  // resolve color for each legend's bars from the colorscale or extracted colors
910
- const color = colorScale ? colorScale(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[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedColors, i, legend, colorMap, isDarkTheme);
913
+ const color = colorScale ? colorScale(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[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedColors, i, legend, colorMap, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme);
911
914
  const opacity = getOpacity(series, i);
912
915
  const base = convertXValueToNumber((_series_base = series.base) === null || _series_base === void 0 ? void 0 : _series_base[i]);
913
916
  const xVal = convertXValueToNumber((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]);
@@ -1096,7 +1099,8 @@ export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, c
1096
1099
  const extractedNodeColors = extractColor((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, node === null || node === void 0 ? void 0 : node.color, colorMap, isDarkTheme);
1097
1100
  const sankeyChartData = {
1098
1101
  nodes: (_node_label = node.label) === null || _node_label === void 0 ? void 0 : _node_label.map((label, index)=>{
1099
- const color = resolveColor(extractedNodeColors, index, label, colorMap, isDarkTheme);
1102
+ var _input_layout_template_layout, _input_layout_template, _input_layout;
1103
+ const color = resolveColor(extractedNodeColors, index, label, colorMap, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme);
1100
1104
  return {
1101
1105
  nodeId: index,
1102
1106
  name: label,
@@ -1133,9 +1137,9 @@ export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, co
1133
1137
  const extractedColors = extractColor((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, stepsColors, colorMap, isDarkTheme);
1134
1138
  var _firstData_gauge_axis_range_, _firstData_value, _firstData_gauge_axis_range_1, _firstData_value1;
1135
1139
  const segments = ((_firstData_gauge1 = firstData.gauge) === null || _firstData_gauge1 === void 0 ? void 0 : (_firstData_gauge_steps = _firstData_gauge1.steps) === null || _firstData_gauge_steps === void 0 ? void 0 : _firstData_gauge_steps.length) ? firstData.gauge.steps.map((step, index)=>{
1136
- var _step_range, _step_range1;
1140
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _step_range, _step_range1;
1137
1141
  const legend = step.name || `Segment ${index + 1}`;
1138
- const color = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
1142
+ const color = resolveColor(extractedColors, index, legend, colorMap, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme);
1139
1143
  return {
1140
1144
  legend,
1141
1145
  size: ((_step_range = step.range) === null || _step_range === void 0 ? void 0 : _step_range[1]) - ((_step_range1 = step.range) === null || _step_range1 === void 0 ? void 0 : _step_range1[0]),
@@ -1158,16 +1162,16 @@ export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, co
1158
1162
  if ((_firstData_delta = firstData.delta) === null || _firstData_delta === void 0 ? void 0 : _firstData_delta.reference) {
1159
1163
  const diff = firstData.value - firstData.delta.reference;
1160
1164
  if (diff >= 0) {
1161
- var _input_layout_template_layout2, _input_layout_template2, _input_layout4, _firstData_delta_increasing, _firstData_delta1;
1165
+ var _input_layout_template_layout2, _input_layout_template2, _input_layout4, _firstData_delta_increasing, _firstData_delta1, _input_layout_template_layout3, _input_layout_template3, _input_layout5;
1162
1166
  sublabel = `\u25B2 ${diff}`;
1163
1167
  const extractedIncreasingDeltaColors = extractColor((_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_template2 = _input_layout4.template) === null || _input_layout_template2 === void 0 ? void 0 : (_input_layout_template_layout2 = _input_layout_template2.layout) === null || _input_layout_template_layout2 === void 0 ? void 0 : _input_layout_template_layout2.colorway, colorwayType, (_firstData_delta1 = firstData.delta) === null || _firstData_delta1 === void 0 ? void 0 : (_firstData_delta_increasing = _firstData_delta1.increasing) === null || _firstData_delta_increasing === void 0 ? void 0 : _firstData_delta_increasing.color, colorMap, isDarkTheme);
1164
- const color = resolveColor(extractedIncreasingDeltaColors, 0, '', colorMap, isDarkTheme);
1168
+ const color = resolveColor(extractedIncreasingDeltaColors, 0, '', colorMap, (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_template3 = _input_layout5.template) === null || _input_layout_template3 === void 0 ? void 0 : (_input_layout_template_layout3 = _input_layout_template3.layout) === null || _input_layout_template_layout3 === void 0 ? void 0 : _input_layout_template_layout3.colorway, isDarkTheme);
1165
1169
  sublabelColor = color;
1166
1170
  } else {
1167
- var _input_layout_template_layout3, _input_layout_template3, _input_layout5, _firstData_delta_decreasing, _firstData_delta2;
1171
+ var _input_layout_template_layout4, _input_layout_template4, _input_layout6, _firstData_delta_decreasing, _firstData_delta2, _input_layout_template_layout5, _input_layout_template5, _input_layout7;
1168
1172
  sublabel = `\u25BC ${Math.abs(diff)}`;
1169
- const extractedDecreasingDeltaColors = extractColor((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_template3 = _input_layout5.template) === null || _input_layout_template3 === void 0 ? void 0 : (_input_layout_template_layout3 = _input_layout_template3.layout) === null || _input_layout_template_layout3 === void 0 ? void 0 : _input_layout_template_layout3.colorway, colorwayType, (_firstData_delta2 = firstData.delta) === null || _firstData_delta2 === void 0 ? void 0 : (_firstData_delta_decreasing = _firstData_delta2.decreasing) === null || _firstData_delta_decreasing === void 0 ? void 0 : _firstData_delta_decreasing.color, colorMap, isDarkTheme);
1170
- const color = resolveColor(extractedDecreasingDeltaColors, 0, '', colorMap, isDarkTheme);
1173
+ const extractedDecreasingDeltaColors = extractColor((_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : (_input_layout_template4 = _input_layout6.template) === null || _input_layout_template4 === void 0 ? void 0 : (_input_layout_template_layout4 = _input_layout_template4.layout) === null || _input_layout_template_layout4 === void 0 ? void 0 : _input_layout_template_layout4.colorway, colorwayType, (_firstData_delta2 = firstData.delta) === null || _firstData_delta2 === void 0 ? void 0 : (_firstData_delta_decreasing = _firstData_delta2.decreasing) === null || _firstData_delta_decreasing === void 0 ? void 0 : _firstData_delta_decreasing.color, colorMap, isDarkTheme);
1174
+ const color = resolveColor(extractedDecreasingDeltaColors, 0, '', colorMap, (_input_layout7 = input.layout) === null || _input_layout7 === void 0 ? void 0 : (_input_layout_template5 = _input_layout7.template) === null || _input_layout_template5 === void 0 ? void 0 : (_input_layout_template_layout5 = _input_layout_template5.layout) === null || _input_layout_template_layout5 === void 0 ? void 0 : _input_layout_template_layout5.colorway, isDarkTheme);
1171
1175
  sublabelColor = color;
1172
1176
  }
1173
1177
  }
@@ -1420,13 +1424,13 @@ export const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot, colorM
1420
1424
  // Assign a color per series/category and use it for all subValues of that category
1421
1425
  const seriesColors = {};
1422
1426
  input.data.forEach((series, seriesIdx)=>{
1423
- var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_marker1;
1427
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_marker1, _input_layout_template_layout1, _input_layout_template1, _input_layout1;
1424
1428
  const category = series.name || `Category ${seriesIdx + 1}`;
1425
1429
  var _series_marker_colors;
1426
1430
  // Use the same color for this category across all stages
1427
1431
  const extractedColors = extractColor((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker_colors = (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.colors) !== null && _series_marker_colors !== void 0 ? _series_marker_colors : (_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color, colorMap, isDarkTheme);
1428
1432
  // Always use the first color for the series/category
1429
- const color = resolveColor(extractedColors, 0, category, colorMap, isDarkTheme);
1433
+ const color = resolveColor(extractedColors, 0, category, colorMap, (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, isDarkTheme);
1430
1434
  seriesColors[category] = color;
1431
1435
  var _series_labels, _ref;
1432
1436
  const labels = (_ref = (_series_labels = series.labels) !== null && _series_labels !== void 0 ? _series_labels : series.y) !== null && _ref !== void 0 ? _ref : series.stage;
@@ -1474,7 +1478,8 @@ export const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot, colorM
1474
1478
  var _series_marker_colors;
1475
1479
  const extractedColors = extractColor((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker_colors = (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.colors) !== null && _series_marker_colors !== void 0 ? _series_marker_colors : (_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color, colorMap, isDarkTheme);
1476
1480
  categories.forEach((label, i)=>{
1477
- const color = resolveColor(extractedColors, i, label, colorMap, isDarkTheme);
1481
+ var _input_layout_template_layout, _input_layout_template, _input_layout;
1482
+ const color = resolveColor(extractedColors, i, label, colorMap, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme);
1478
1483
  const valueNum = Number(values[i]);
1479
1484
  if (isNaN(valueNum)) {
1480
1485
  return;
@@ -1813,11 +1818,13 @@ export const getAllupLegendsProps = (input, colorMap, colorwayType, traceInfo, i
1813
1818
  var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _pieSeries_marker, _pieSeries_labels;
1814
1819
  const pieSeries = series;
1815
1820
  var _input_layout_piecolorway, _input_layout_piecolorway1;
1816
- const colors = extractColor((_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_input_layout_piecolorway1 = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.piecolorway) !== null && _input_layout_piecolorway1 !== void 0 ? _input_layout_piecolorway1 : pieSeries === null || pieSeries === void 0 ? void 0 : (_pieSeries_marker = pieSeries.marker) === null || _pieSeries_marker === void 0 ? void 0 : _pieSeries_marker.colors, colorMap, isDarkTheme);
1821
+ const colors = extractColor((_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_input_layout_piecolorway1 = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.piecolorway) !== null && _input_layout_piecolorway1 !== void 0 ? _input_layout_piecolorway1 : pieSeries === null || pieSeries === void 0 ? void 0 : (_pieSeries_marker = pieSeries.marker) === null || _pieSeries_marker === void 0 ? void 0 : _pieSeries_marker.colors, colorMap, isDarkTheme, true);
1817
1822
  (_pieSeries_labels = pieSeries.labels) === null || _pieSeries_labels === void 0 ? void 0 : _pieSeries_labels.forEach((label, labelIndex)=>{
1823
+ var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1;
1818
1824
  const legend = `${label}`;
1825
+ var _input_layout_piecolorway;
1819
1826
  // resolve color for each legend from the extracted colors
1820
- const color = resolveColor(colors, labelIndex, legend, colorMap, isDarkTheme);
1827
+ const color = resolveColor(colors, labelIndex, legend, colorMap, (_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme, true);
1821
1828
  if (legend !== '' && allupLegends.some((group)=>group.title === legend) === false) {
1822
1829
  allupLegends.push({
1823
1830
  title: legend,
@@ -2089,6 +2096,7 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2089
2096
  });
2090
2097
  const isAxisTypeCategory = (ax === null || ax === void 0 ? void 0 : ax.type) === 'category' || isStringArray(values) && !isNumberArray(values) && !isDateArray(values);
2091
2098
  if (!isAxisTypeCategory) {
2099
+ result[propName] = 'data';
2092
2100
  return;
2093
2101
  }
2094
2102
  const isValidArray = isArrayOrTypedArray(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
@@ -2098,7 +2106,7 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2098
2106
  }
2099
2107
  if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
2100
2108
  const categoriesInTraceOrder = Array.from(new Set(values));
2101
- result[propName] = categoriesInTraceOrder;
2109
+ result[propName] = (ax === null || ax === void 0 ? void 0 : ax.autorange) === 'reversed' ? categoriesInTraceOrder.reverse() : categoriesInTraceOrder;
2102
2110
  return;
2103
2111
  }
2104
2112
  result[propName] = ax.categoryorder;