@fluentui/react-charting 5.24.25 → 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.
- package/CHANGELOG.json +49 -1
- package/CHANGELOG.md +23 -2
- package/dist/react-charting.d.ts +7 -0
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +1 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.js +16 -5
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.d.ts +8 -4
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +70 -19
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +96 -65
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.base.js +7 -2
- package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.d.ts +7 -0
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +16 -5
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +8 -4
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +71 -20
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +96 -65
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.base.js +7 -2
- package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.types.d.ts +7 -0
- package/lib-amd/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +16 -5
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +8 -4
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +71 -20
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +96 -65
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.base.js +7 -2
- package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.d.ts +7 -0
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/package.json +4 -4
- 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,27 +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
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
var
|
|
339
|
-
|
|
340
|
-
var
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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);
|
|
354
|
+
if (!mapLegendToDataPoint[legend]) {
|
|
355
|
+
mapLegendToDataPoint[legend] = {
|
|
356
|
+
legend: legend,
|
|
357
|
+
data: pair.value,
|
|
358
|
+
color: color,
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
mapLegendToDataPoint[legend].data += pair.value;
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
}
|
|
352
366
|
var width = (_l = (_k = input.layout) === null || _k === void 0 ? void 0 : _k.width) !== null && _l !== void 0 ? _l : 440;
|
|
353
367
|
var height = (_o = (_m = input.layout) === null || _m === void 0 ? void 0 : _m.height) !== null && _o !== void 0 ? _o : 220;
|
|
354
368
|
var hideLabels = firstData.textinfo
|
|
@@ -360,10 +374,23 @@ export var transformPlotlyJsonToDonutProps = function (input, isMultiPlot, color
|
|
|
360
374
|
? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2)
|
|
361
375
|
: MIN_DONUT_RADIUS;
|
|
362
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]]; });
|
|
363
387
|
return {
|
|
364
388
|
data: {
|
|
365
389
|
chartTitle: chartTitle,
|
|
366
|
-
chartData:
|
|
390
|
+
chartData: reorderedEntries.map(function (_a) {
|
|
391
|
+
var v = _a[1];
|
|
392
|
+
return v;
|
|
393
|
+
}),
|
|
367
394
|
},
|
|
368
395
|
hideLegend: isMultiPlot || ((_p = input.layout) === null || _p === void 0 ? void 0 : _p.showlegend) === false,
|
|
369
396
|
width: (_q = input.layout) === null || _q === void 0 ? void 0 : _q.width,
|
|
@@ -372,6 +399,7 @@ export var transformPlotlyJsonToDonutProps = function (input, isMultiPlot, color
|
|
|
372
399
|
hideLabels: hideLabels,
|
|
373
400
|
showLabelsInPercent: firstData.textinfo ? ['percent', 'label+percent'].includes(firstData.textinfo) : true,
|
|
374
401
|
roundCorners: true,
|
|
402
|
+
order: 'sorted',
|
|
375
403
|
};
|
|
376
404
|
};
|
|
377
405
|
export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC) {
|
|
@@ -401,7 +429,7 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
|
|
|
401
429
|
var rangeXValues = series.x.slice(rangeStart, rangeEnd);
|
|
402
430
|
var rangeYValues = series.y.slice(rangeStart, rangeEnd);
|
|
403
431
|
rangeXValues.forEach(function (x, index2) {
|
|
404
|
-
var _a, _b, _c, _d, _e, _f;
|
|
432
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
405
433
|
if (!mapXToDataPoints[x]) {
|
|
406
434
|
mapXToDataPoints[x] = {
|
|
407
435
|
xAxisPoint: resolveXAxisPoint(x, isXYearCategory, isXString, isXDate, isXNumber),
|
|
@@ -415,7 +443,7 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
|
|
|
415
443
|
? colorScale(isArrayOrTypedArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
|
|
416
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]
|
|
417
445
|
: 0)
|
|
418
|
-
: 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);
|
|
419
447
|
var opacity = getOpacity(series, index2);
|
|
420
448
|
var yVal = rangeYValues[index2];
|
|
421
449
|
var yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
|
|
@@ -423,7 +451,7 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
|
|
|
423
451
|
mapXToDataPoints[x].chartData.push({
|
|
424
452
|
legend: legend,
|
|
425
453
|
data: yVal,
|
|
426
|
-
color: (
|
|
454
|
+
color: (_h = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _h !== void 0 ? _h : color,
|
|
427
455
|
yAxisCalloutData: yAxisCalloutData,
|
|
428
456
|
});
|
|
429
457
|
if (typeof yVal === 'number') {
|
|
@@ -431,14 +459,14 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
|
|
|
431
459
|
}
|
|
432
460
|
}
|
|
433
461
|
else if (series.type === 'scatter' || !!fallbackVSBC) {
|
|
434
|
-
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);
|
|
435
463
|
var lineOptions = getLineOptions(series.line);
|
|
436
464
|
var legendShape = getLegendShape(series);
|
|
437
465
|
mapXToDataPoints[x].lineData.push({
|
|
438
466
|
legend: legend + (validXYRanges.length > 1 ? ".".concat(rangeIdx + 1) : ''),
|
|
439
467
|
legendShape: legendShape,
|
|
440
468
|
y: yVal,
|
|
441
|
-
color: (
|
|
469
|
+
color: (_m = rgb(lineColor).copy({ opacity: opacity }).formatHex8()) !== null && _m !== void 0 ? _m : color,
|
|
442
470
|
lineOptions: __assign(__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
|
|
443
471
|
useSecondaryYScale: usesSecondaryYScale(series, input.layout),
|
|
444
472
|
yAxisCalloutData: yAxisCalloutData,
|
|
@@ -488,7 +516,7 @@ export var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorM
|
|
|
488
516
|
// extract colors for each series only once
|
|
489
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);
|
|
490
518
|
(_e = series.x) === null || _e === void 0 ? void 0 : _e.forEach(function (x, xIndex) {
|
|
491
|
-
var _a, _b, _c, _d, _e, _f;
|
|
519
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
492
520
|
if (isInvalidValue(x) || isInvalidValue((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
|
|
493
521
|
return;
|
|
494
522
|
}
|
|
@@ -502,14 +530,14 @@ export var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorM
|
|
|
502
530
|
? colorScale(isArrayOrTypedArray((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
|
|
503
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]
|
|
504
532
|
: 0)
|
|
505
|
-
: 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);
|
|
506
534
|
var opacity = getOpacity(series, xIndex);
|
|
507
535
|
var yVal = series.y[xIndex];
|
|
508
536
|
mapXToDataPoints[x].series.push({
|
|
509
537
|
key: legend,
|
|
510
538
|
data: yVal,
|
|
511
539
|
xAxisCalloutData: x,
|
|
512
|
-
color: (
|
|
540
|
+
color: (_j = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color,
|
|
513
541
|
legend: legend,
|
|
514
542
|
useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout),
|
|
515
543
|
yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
|
|
@@ -561,17 +589,17 @@ export var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMa
|
|
|
561
589
|
return yVal;
|
|
562
590
|
});
|
|
563
591
|
xBins.forEach(function (bin, index) {
|
|
564
|
-
var _a, _b, _c, _d, _e;
|
|
592
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
565
593
|
var legend = legends[seriesIdx];
|
|
566
594
|
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
567
595
|
var color = colorScale
|
|
568
596
|
? colorScale(isArrayOrTypedArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
|
|
569
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]
|
|
570
598
|
: 0)
|
|
571
|
-
: 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);
|
|
572
600
|
var opacity = getOpacity(series, index);
|
|
573
601
|
var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
|
|
574
|
-
vbcData.push(__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: (
|
|
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
|
|
575
603
|
? {}
|
|
576
604
|
: { xAxisCalloutData: "[".concat(bin.x0, " - ").concat(bin.x1, ")") })));
|
|
577
605
|
});
|
|
@@ -607,7 +635,7 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
607
635
|
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
608
636
|
var chartData = input.data
|
|
609
637
|
.map(function (series, index) {
|
|
610
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
638
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
611
639
|
var colors = isScatterMarkers
|
|
612
640
|
? ((_a = series === null || series === void 0 ? void 0 : series.mode) === null || _a === void 0 ? void 0 : _a.includes('line'))
|
|
613
641
|
? (_b = series.line) === null || _b === void 0 ? void 0 : _b.color
|
|
@@ -622,11 +650,11 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
622
650
|
var isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis
|
|
623
651
|
var legend = legends[index];
|
|
624
652
|
// resolve color for each legend's lines from the extracted colors
|
|
625
|
-
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);
|
|
626
654
|
var seriesOpacity = getOpacity(series, index);
|
|
627
655
|
mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
|
|
628
656
|
// if mode contains 'text', we prioritize showing the text over curving the line
|
|
629
|
-
var lineOptions = !((
|
|
657
|
+
var lineOptions = !((_l = series.mode) === null || _l === void 0 ? void 0 : _l.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
|
|
630
658
|
var legendShape = getLegendShape(series);
|
|
631
659
|
var validXYRanges = getValidXYRanges(series);
|
|
632
660
|
return validXYRanges.map(function (_a, rangeIdx) {
|
|
@@ -700,7 +728,7 @@ export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, is
|
|
|
700
728
|
var legend = legends[index];
|
|
701
729
|
return series.y
|
|
702
730
|
.map(function (yValue, i) {
|
|
703
|
-
var _a, _b, _c, _d, _e, _f;
|
|
731
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
704
732
|
if (isInvalidValue((_a = series.x) === null || _a === void 0 ? void 0 : _a[i]) || isInvalidValue(yValue)) {
|
|
705
733
|
return null;
|
|
706
734
|
}
|
|
@@ -709,13 +737,13 @@ export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, is
|
|
|
709
737
|
? colorScale(isArrayOrTypedArray((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
|
|
710
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]
|
|
711
739
|
: 0)
|
|
712
|
-
: 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);
|
|
713
741
|
var opacity = getOpacity(series, i);
|
|
714
742
|
return {
|
|
715
743
|
x: series.x[i],
|
|
716
744
|
y: yValue,
|
|
717
745
|
legend: legend,
|
|
718
|
-
color: (
|
|
746
|
+
color: (_j = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color,
|
|
719
747
|
};
|
|
720
748
|
})
|
|
721
749
|
.filter(function (point) { return point !== null; });
|
|
@@ -751,7 +779,7 @@ export var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot,
|
|
|
751
779
|
};
|
|
752
780
|
return series.y
|
|
753
781
|
.map(function (yVal, i) {
|
|
754
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
782
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
755
783
|
if (isInvalidValue(yVal)) {
|
|
756
784
|
return null;
|
|
757
785
|
}
|
|
@@ -760,10 +788,10 @@ export var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot,
|
|
|
760
788
|
? colorScale(isArrayOrTypedArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
|
|
761
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]
|
|
762
790
|
: 0)
|
|
763
|
-
: 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);
|
|
764
792
|
var opacity = getOpacity(series, i);
|
|
765
|
-
var base = convertXValueToNumber((
|
|
766
|
-
var xVal = convertXValueToNumber((
|
|
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]);
|
|
767
795
|
return {
|
|
768
796
|
x: {
|
|
769
797
|
start: isXDate ? new Date(base) : base,
|
|
@@ -771,7 +799,7 @@ export var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot,
|
|
|
771
799
|
},
|
|
772
800
|
y: yVal,
|
|
773
801
|
legend: legend,
|
|
774
|
-
color: (
|
|
802
|
+
color: (_k = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _k !== void 0 ? _k : color,
|
|
775
803
|
};
|
|
776
804
|
})
|
|
777
805
|
.filter(function (point) { return point !== null; });
|
|
@@ -913,7 +941,8 @@ export var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot, colo
|
|
|
913
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);
|
|
914
942
|
var sankeyChartData = {
|
|
915
943
|
nodes: (_e = node.label) === null || _e === void 0 ? void 0 : _e.map(function (label, index) {
|
|
916
|
-
var
|
|
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);
|
|
917
946
|
return {
|
|
918
947
|
nodeId: index,
|
|
919
948
|
name: label,
|
|
@@ -941,19 +970,19 @@ export var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot, colo
|
|
|
941
970
|
};
|
|
942
971
|
};
|
|
943
972
|
export var transformPlotlyJsonToGaugeProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
944
|
-
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;
|
|
945
974
|
var firstData = input.data[0];
|
|
946
975
|
var stepsColors = ((_a = firstData.gauge) === null || _a === void 0 ? void 0 : _a.steps) ? firstData.gauge.steps.map(function (step) { return step.color; }) : undefined;
|
|
947
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);
|
|
948
977
|
var segments = ((_f = (_e = firstData.gauge) === null || _e === void 0 ? void 0 : _e.steps) === null || _f === void 0 ? void 0 : _f.length)
|
|
949
978
|
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
950
979
|
firstData.gauge.steps.map(function (step, index) {
|
|
951
|
-
var _a, _b;
|
|
980
|
+
var _a, _b, _c, _d, _e;
|
|
952
981
|
var legend = step.name || "Segment ".concat(index + 1);
|
|
953
|
-
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);
|
|
954
983
|
return {
|
|
955
984
|
legend: legend,
|
|
956
|
-
size: ((
|
|
985
|
+
size: ((_d = step.range) === null || _d === void 0 ? void 0 : _d[1]) - ((_e = step.range) === null || _e === void 0 ? void 0 : _e[0]),
|
|
957
986
|
color: color,
|
|
958
987
|
};
|
|
959
988
|
})
|
|
@@ -976,13 +1005,13 @@ export var transformPlotlyJsonToGaugeProps = function (input, isMultiPlot, color
|
|
|
976
1005
|
if (diff >= 0) {
|
|
977
1006
|
sublabel = "\u25B2 ".concat(diff);
|
|
978
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);
|
|
979
|
-
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);
|
|
980
1009
|
sublabelColor = color;
|
|
981
1010
|
}
|
|
982
1011
|
else {
|
|
983
1012
|
sublabel = "\u25BC ".concat(Math.abs(diff));
|
|
984
|
-
var extractedDecreasingDeltaColors = extractColor((
|
|
985
|
-
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);
|
|
986
1015
|
sublabelColor = color;
|
|
987
1016
|
}
|
|
988
1017
|
}
|
|
@@ -994,17 +1023,17 @@ export var transformPlotlyJsonToGaugeProps = function (input, isMultiPlot, color
|
|
|
994
1023
|
var chartTitle = getTitles(input.layout).chartTitle;
|
|
995
1024
|
return {
|
|
996
1025
|
segments: segments,
|
|
997
|
-
chartValue: (
|
|
1026
|
+
chartValue: (_14 = firstData.value) !== null && _14 !== void 0 ? _14 : 0,
|
|
998
1027
|
chartTitle: chartTitle,
|
|
999
1028
|
sublabel: sublabel,
|
|
1000
1029
|
// range values can be null
|
|
1001
|
-
minValue: typeof ((
|
|
1002
|
-
maxValue: typeof ((
|
|
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,
|
|
1003
1032
|
chartValueFormat: function () { var _a, _b; return (_b = (_a = firstData.value) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''; },
|
|
1004
|
-
width: (
|
|
1005
|
-
height: (
|
|
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,
|
|
1006
1035
|
styles: styles,
|
|
1007
|
-
variant: ((
|
|
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,
|
|
1008
1037
|
roundCorners: true,
|
|
1009
1038
|
};
|
|
1010
1039
|
};
|
|
@@ -1213,15 +1242,15 @@ export var transformPlotlyJsonToFunnelChartProps = function (input, isMultiPlot,
|
|
|
1213
1242
|
// Assign a color per series/category and use it for all subValues of that category
|
|
1214
1243
|
var seriesColors_1 = {};
|
|
1215
1244
|
input.data.forEach(function (series, seriesIdx) {
|
|
1216
|
-
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;
|
|
1217
1246
|
var category = series.name || "Category ".concat(seriesIdx + 1);
|
|
1218
1247
|
// Use the same color for this category across all stages
|
|
1219
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);
|
|
1220
1249
|
// Always use the first color for the series/category
|
|
1221
|
-
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);
|
|
1222
1251
|
seriesColors_1[category] = color;
|
|
1223
|
-
var labels = (
|
|
1224
|
-
var values = (
|
|
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;
|
|
1225
1254
|
if (!isArrayOrTypedArray(labels) || !isArrayOrTypedArray(values)) {
|
|
1226
1255
|
return;
|
|
1227
1256
|
}
|
|
@@ -1255,7 +1284,8 @@ export var transformPlotlyJsonToFunnelChartProps = function (input, isMultiPlot,
|
|
|
1255
1284
|
}
|
|
1256
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);
|
|
1257
1286
|
categories.forEach(function (label, i) {
|
|
1258
|
-
var
|
|
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);
|
|
1259
1289
|
var valueNum = Number(values[i]);
|
|
1260
1290
|
if (isNaN(valueNum)) {
|
|
1261
1291
|
return;
|
|
@@ -1589,11 +1619,12 @@ export var getAllupLegendsProps = function (input, colorMap, colorwayType, trace
|
|
|
1589
1619
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
1590
1620
|
if (traceInfo[index].type === 'donut') {
|
|
1591
1621
|
var pieSeries = series;
|
|
1592
|
-
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);
|
|
1593
1623
|
(_j = pieSeries.labels) === null || _j === void 0 ? void 0 : _j.forEach(function (label, labelIndex) {
|
|
1624
|
+
var _a, _b, _c, _d, _e;
|
|
1594
1625
|
var legend = "".concat(label);
|
|
1595
1626
|
// resolve color for each legend from the extracted colors
|
|
1596
|
-
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);
|
|
1597
1628
|
if (legend !== '' && allupLegends.some(function (group) { return group.title === legend; }) === false) {
|
|
1598
1629
|
allupLegends.push({
|
|
1599
1630
|
title: legend,
|