@fluentui/react-charting 5.24.26 → 5.24.28
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 +31 -1
- package/CHANGELOG.md +20 -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 +109 -154
- 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 +109 -154
- 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 +109 -154
- 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 +1 -1
- 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
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
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:
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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 = !((
|
|
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: (
|
|
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((
|
|
796
|
-
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]);
|
|
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: (
|
|
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
|
|
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: ((
|
|
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((
|
|
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: (
|
|
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 ((
|
|
1032
|
-
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,
|
|
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: (
|
|
1035
|
-
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,
|
|
1036
1035
|
styles: styles,
|
|
1037
|
-
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,
|
|
1038
1037
|
roundCorners: true,
|
|
1039
1038
|
};
|
|
1040
1039
|
};
|
|
@@ -1069,6 +1068,17 @@ var formatValue = function (value, colIndex, cells) {
|
|
|
1069
1068
|
}
|
|
1070
1069
|
return "".concat(prefix !== null && prefix !== void 0 ? prefix : '').concat(formatted).concat(suffix !== null && suffix !== void 0 ? suffix : '');
|
|
1071
1070
|
};
|
|
1071
|
+
function resolveCellStyle(raw, rowIndex, colIndex) {
|
|
1072
|
+
var _a, _b;
|
|
1073
|
+
if (Array.isArray(raw)) {
|
|
1074
|
+
var rowEntry = (_a = raw[colIndex]) !== null && _a !== void 0 ? _a : raw[0];
|
|
1075
|
+
if (Array.isArray(rowEntry)) {
|
|
1076
|
+
return (_b = rowEntry[rowIndex]) !== null && _b !== void 0 ? _b : rowEntry[0];
|
|
1077
|
+
}
|
|
1078
|
+
return rowEntry;
|
|
1079
|
+
}
|
|
1080
|
+
return raw;
|
|
1081
|
+
}
|
|
1072
1082
|
export var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
1073
1083
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
1074
1084
|
var tableData = input.data[0];
|
|
@@ -1082,41 +1092,13 @@ export var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot,
|
|
|
1082
1092
|
})
|
|
1083
1093
|
: values.map(function (cell) { return cleanText(cell); });
|
|
1084
1094
|
return cleanedValues.map(function (value, colIndex) {
|
|
1085
|
-
var _a, _b, _c
|
|
1086
|
-
|
|
1087
|
-
var
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
}
|
|
1093
|
-
else if (typeof colorEntry === 'string') {
|
|
1094
|
-
fontColor = colorEntry;
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
else if (typeof fontColorRaw === 'string') {
|
|
1098
|
-
fontColor = fontColorRaw;
|
|
1099
|
-
}
|
|
1100
|
-
var fontSizeRaw = (_c = header === null || header === void 0 ? void 0 : header.font) === null || _c === void 0 ? void 0 : _c.size;
|
|
1101
|
-
var fontSize;
|
|
1102
|
-
if (Array.isArray(fontSizeRaw)) {
|
|
1103
|
-
var fontSizeEntry = (_d = fontSizeRaw[colIndex]) !== null && _d !== void 0 ? _d : fontSizeRaw[0];
|
|
1104
|
-
fontSize = Array.isArray(fontSizeRaw[0])
|
|
1105
|
-
? (_e = fontSizeRaw[0][colIndex]) !== null && _e !== void 0 ? _e : fontSizeRaw[0][0]
|
|
1106
|
-
: typeof fontSizeEntry === 'number'
|
|
1107
|
-
? fontSizeEntry
|
|
1108
|
-
: undefined;
|
|
1109
|
-
}
|
|
1110
|
-
else if (typeof fontSizeRaw === 'number') {
|
|
1111
|
-
fontSize = fontSizeRaw;
|
|
1112
|
-
}
|
|
1113
|
-
var updatedColIndex = colIndex >= 1 ? 1 : 0;
|
|
1114
|
-
var fillColorRaw = (_f = header === null || header === void 0 ? void 0 : header.fill) === null || _f === void 0 ? void 0 : _f.color;
|
|
1115
|
-
var backgroundColor = Array.isArray(fillColorRaw)
|
|
1116
|
-
? (_g = fillColorRaw[updatedColIndex]) !== null && _g !== void 0 ? _g : fillColorRaw[0]
|
|
1117
|
-
: fillColorRaw;
|
|
1118
|
-
var textAlignRaw = header === null || header === void 0 ? void 0 : header.align;
|
|
1119
|
-
var textAlign = Array.isArray(textAlignRaw) ? (_h = textAlignRaw[colIndex]) !== null && _h !== void 0 ? _h : textAlignRaw[0] : textAlignRaw;
|
|
1095
|
+
var _a, _b, _c;
|
|
1096
|
+
//headers are at first row only
|
|
1097
|
+
var rowIndex = 0;
|
|
1098
|
+
var fontColor = resolveCellStyle((_a = header === null || header === void 0 ? void 0 : header.font) === null || _a === void 0 ? void 0 : _a.color, rowIndex, colIndex);
|
|
1099
|
+
var fontSize = resolveCellStyle((_b = header === null || header === void 0 ? void 0 : header.font) === null || _b === void 0 ? void 0 : _b.size, rowIndex, colIndex);
|
|
1100
|
+
var backgroundColor = resolveCellStyle((_c = header === null || header === void 0 ? void 0 : header.fill) === null || _c === void 0 ? void 0 : _c.color, rowIndex, colIndex);
|
|
1101
|
+
var textAlign = resolveCellStyle(header === null || header === void 0 ? void 0 : header.align, rowIndex, colIndex);
|
|
1120
1102
|
var style = __assign(__assign(__assign(__assign({}, (typeof fontColor === 'string' ? { color: fontColor } : {})), (typeof fontSize === 'number' ? { fontSize: fontSize } : {})), (typeof backgroundColor === 'string' ? { backgroundColor: backgroundColor } : {})), (textAlign ? { textAlign: textAlign } : {}));
|
|
1121
1103
|
return { value: value, style: style };
|
|
1122
1104
|
});
|
|
@@ -1127,45 +1109,16 @@ export var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot,
|
|
|
1127
1109
|
: (_g = (_f = (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.table) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.cells;
|
|
1128
1110
|
var rows = columns[0].map(function (_, rowIndex) {
|
|
1129
1111
|
return columns.map(function (col, colIndex) {
|
|
1130
|
-
var _a, _b, _c
|
|
1112
|
+
var _a, _b, _c;
|
|
1131
1113
|
var cellValue = col[rowIndex];
|
|
1132
1114
|
var cleanValue = typeof cellValue === 'string' ? cleanText(cellValue) : cellValue;
|
|
1133
1115
|
var formattedValue = typeof cleanValue === 'string' || typeof cleanValue === 'number'
|
|
1134
1116
|
? formatValue(cleanValue, colIndex, cells)
|
|
1135
1117
|
: cleanValue;
|
|
1136
|
-
var
|
|
1137
|
-
var
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
var colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
|
|
1141
|
-
fontColor = typeof colorValue === 'string' ? colorValue : undefined;
|
|
1142
|
-
}
|
|
1143
|
-
else if (typeof rawFontColor === 'string') {
|
|
1144
|
-
fontColor = rawFontColor;
|
|
1145
|
-
}
|
|
1146
|
-
var rawFontSize = (_c = cells === null || cells === void 0 ? void 0 : cells.font) === null || _c === void 0 ? void 0 : _c.size;
|
|
1147
|
-
var fontSize;
|
|
1148
|
-
if (Array.isArray(rawFontSize)) {
|
|
1149
|
-
var entry = (_d = rawFontSize[colIndex]) !== null && _d !== void 0 ? _d : rawFontSize[0];
|
|
1150
|
-
var fontSizeValue = Array.isArray(entry) ? entry[rowIndex] : entry;
|
|
1151
|
-
fontSize = typeof fontSizeValue === 'number' ? fontSizeValue : undefined;
|
|
1152
|
-
}
|
|
1153
|
-
else if (typeof rawFontSize === 'number') {
|
|
1154
|
-
fontSize = rawFontSize;
|
|
1155
|
-
}
|
|
1156
|
-
var updatedColIndex = colIndex >= 1 ? 1 : 0;
|
|
1157
|
-
var rawBackgroundColor = (_e = cells === null || cells === void 0 ? void 0 : cells.fill) === null || _e === void 0 ? void 0 : _e.color;
|
|
1158
|
-
var backgroundColor;
|
|
1159
|
-
if (Array.isArray(rawBackgroundColor)) {
|
|
1160
|
-
var entry = (_f = rawBackgroundColor[updatedColIndex]) !== null && _f !== void 0 ? _f : rawBackgroundColor[0];
|
|
1161
|
-
var colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
|
|
1162
|
-
backgroundColor = typeof colorValue === 'string' ? colorValue : undefined;
|
|
1163
|
-
}
|
|
1164
|
-
else if (typeof rawBackgroundColor === 'string') {
|
|
1165
|
-
backgroundColor = rawBackgroundColor;
|
|
1166
|
-
}
|
|
1167
|
-
var rawTextAlign = Array.isArray(cells === null || cells === void 0 ? void 0 : cells.align) ? (_g = cells.align[colIndex]) !== null && _g !== void 0 ? _g : cells.align[0] : cells === null || cells === void 0 ? void 0 : cells.align;
|
|
1168
|
-
var textAlign = rawTextAlign;
|
|
1118
|
+
var fontColor = resolveCellStyle((_a = cells === null || cells === void 0 ? void 0 : cells.font) === null || _a === void 0 ? void 0 : _a.color, rowIndex, colIndex);
|
|
1119
|
+
var fontSize = resolveCellStyle((_b = cells === null || cells === void 0 ? void 0 : cells.font) === null || _b === void 0 ? void 0 : _b.size, rowIndex, colIndex);
|
|
1120
|
+
var backgroundColor = resolveCellStyle((_c = cells === null || cells === void 0 ? void 0 : cells.fill) === null || _c === void 0 ? void 0 : _c.color, rowIndex, colIndex);
|
|
1121
|
+
var textAlign = resolveCellStyle(cells === null || cells === void 0 ? void 0 : cells.align, rowIndex, colIndex);
|
|
1169
1122
|
var style = __assign(__assign(__assign(__assign({}, (fontColor ? { color: fontColor } : {})), (typeof fontSize === 'number' ? { fontSize: fontSize } : {})), (backgroundColor ? { backgroundColor: backgroundColor } : {})), (textAlign ? { textAlign: textAlign } : {}));
|
|
1170
1123
|
return {
|
|
1171
1124
|
value: formattedValue,
|
|
@@ -1243,15 +1196,15 @@ export var transformPlotlyJsonToFunnelChartProps = function (input, isMultiPlot,
|
|
|
1243
1196
|
// Assign a color per series/category and use it for all subValues of that category
|
|
1244
1197
|
var seriesColors_1 = {};
|
|
1245
1198
|
input.data.forEach(function (series, seriesIdx) {
|
|
1246
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1199
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
1247
1200
|
var category = series.name || "Category ".concat(seriesIdx + 1);
|
|
1248
1201
|
// Use the same color for this category across all stages
|
|
1249
1202
|
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
1203
|
// Always use the first color for the series/category
|
|
1251
|
-
var color = resolveColor(extractedColors, 0, category, colorMap, isDarkTheme);
|
|
1204
|
+
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
1205
|
seriesColors_1[category] = color;
|
|
1253
|
-
var labels = (
|
|
1254
|
-
var values = (
|
|
1206
|
+
var labels = (_l = (_k = series.labels) !== null && _k !== void 0 ? _k : series.y) !== null && _l !== void 0 ? _l : series.stage;
|
|
1207
|
+
var values = (_o = (_m = series.values) !== null && _m !== void 0 ? _m : series.x) !== null && _o !== void 0 ? _o : series.value;
|
|
1255
1208
|
if (!isArrayOrTypedArray(labels) || !isArrayOrTypedArray(values)) {
|
|
1256
1209
|
return;
|
|
1257
1210
|
}
|
|
@@ -1285,7 +1238,8 @@ export var transformPlotlyJsonToFunnelChartProps = function (input, isMultiPlot,
|
|
|
1285
1238
|
}
|
|
1286
1239
|
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
1240
|
categories.forEach(function (label, i) {
|
|
1288
|
-
var
|
|
1241
|
+
var _a, _b, _c;
|
|
1242
|
+
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
1243
|
var valueNum = Number(values[i]);
|
|
1290
1244
|
if (isNaN(valueNum)) {
|
|
1291
1245
|
return;
|
|
@@ -1619,11 +1573,12 @@ export var getAllupLegendsProps = function (input, colorMap, colorwayType, trace
|
|
|
1619
1573
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
1620
1574
|
if (traceInfo[index].type === 'donut') {
|
|
1621
1575
|
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);
|
|
1576
|
+
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
1577
|
(_j = pieSeries.labels) === null || _j === void 0 ? void 0 : _j.forEach(function (label, labelIndex) {
|
|
1578
|
+
var _a, _b, _c, _d, _e;
|
|
1624
1579
|
var legend = "".concat(label);
|
|
1625
1580
|
// resolve color for each legend from the extracted colors
|
|
1626
|
-
var color = resolveColor(colors_1, labelIndex, legend, colorMap, isDarkTheme);
|
|
1581
|
+
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
1582
|
if (legend !== '' && allupLegends.some(function (group) { return group.title === legend; }) === false) {
|
|
1628
1583
|
allupLegends.push({
|
|
1629
1584
|
title: legend,
|