@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
|
@@ -177,7 +177,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
177
177
|
};
|
|
178
178
|
var _getGaugeAxisColor = function (colorway, colorwayType, color, colorMap, isDarkTheme) {
|
|
179
179
|
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)(colorway, colorwayType, color, colorMap, isDarkTheme);
|
|
180
|
-
return (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, 0, '', colorMap, isDarkTheme);
|
|
180
|
+
return (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, 0, '', colorMap, colorway, isDarkTheme);
|
|
181
181
|
};
|
|
182
182
|
exports._getGaugeAxisColor = _getGaugeAxisColor;
|
|
183
183
|
var resolveXAxisPoint = function (x, isXYearCategory, isXString, isXDate, isXNumber) {
|
|
@@ -325,57 +325,41 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
325
325
|
// extract colors for each series only once
|
|
326
326
|
// use piecolorway if available
|
|
327
327
|
// otherwise, default to colorway from template
|
|
328
|
-
var colors = (0, PlotlyColorAdapter_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 = firstData === null || firstData === void 0 ? void 0 : firstData.marker) === null || _h === void 0 ? void 0 : _h.colors, colorMap, isDarkTheme);
|
|
328
|
+
var colors = (0, PlotlyColorAdapter_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 = firstData === null || firstData === void 0 ? void 0 : firstData.marker) === null || _h === void 0 ? void 0 : _h.colors, colorMap, isDarkTheme, true);
|
|
329
329
|
var mapLegendToDataPoint = {};
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
330
|
+
// clear colorMap for donut chart to reassign colors as the colorMap initially gets assigned by
|
|
331
|
+
// getAllupLegendsProps function without sorting labels by value
|
|
332
|
+
colorMap.current.clear();
|
|
333
|
+
// Sort labels by value descending before mapping
|
|
334
|
+
if (firstData.labels && firstData.values) {
|
|
335
|
+
var markerColors_1 = ((_j = firstData.marker) === null || _j === void 0 ? void 0 : _j.colors) || undefined;
|
|
336
|
+
var hasMarkerColors_1 = Array.isArray(markerColors_1) && markerColors_1.length >= firstData.labels.length;
|
|
337
|
+
var labelValuePairs = firstData.labels.map(function (label, index) { return ({
|
|
338
|
+
label: label,
|
|
339
|
+
value: (0, exports.getNumberAtIndexOrDefault)(firstData.values, index),
|
|
340
|
+
index: index,
|
|
341
|
+
color: hasMarkerColors_1 ? markerColors_1[index] : undefined,
|
|
342
|
+
}); });
|
|
343
|
+
// Filter out invalid values
|
|
344
|
+
var validPairs = labelValuePairs.filter(function (pair) { return !(0, chart_utilities_1.isInvalidValue)(pair.value); });
|
|
345
|
+
// Sort descending by value; when marker colors are present, keep color attached to the label
|
|
346
|
+
validPairs.sort(function (a, b) { return b.value - a.value; });
|
|
347
|
+
validPairs.forEach(function (pair, sortedIdx) {
|
|
348
|
+
var _a, _b, _c, _d, _e, _f;
|
|
349
|
+
var legend = "".concat(pair.label);
|
|
350
|
+
var color = (_a = pair.color) !== null && _a !== void 0 ? _a : (0, PlotlyColorAdapter_1.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);
|
|
339
351
|
if (!mapLegendToDataPoint[legend]) {
|
|
340
352
|
mapLegendToDataPoint[legend] = {
|
|
341
353
|
legend: legend,
|
|
342
|
-
data: value,
|
|
354
|
+
data: pair.value,
|
|
343
355
|
color: color,
|
|
344
356
|
};
|
|
345
357
|
}
|
|
346
358
|
else {
|
|
347
|
-
mapLegendToDataPoint[legend].data += value;
|
|
359
|
+
mapLegendToDataPoint[legend].data += pair.value;
|
|
348
360
|
}
|
|
349
361
|
});
|
|
350
362
|
}
|
|
351
|
-
else {
|
|
352
|
-
// Sort labels by value descending before mapping
|
|
353
|
-
if (firstData.labels && firstData.values) {
|
|
354
|
-
var labelValuePairs = firstData.labels.map(function (label, index) { return ({
|
|
355
|
-
label: label,
|
|
356
|
-
value: (0, exports.getNumberAtIndexOrDefault)(firstData.values, index),
|
|
357
|
-
index: index,
|
|
358
|
-
}); });
|
|
359
|
-
// Filter out invalid values
|
|
360
|
-
var validPairs = labelValuePairs.filter(function (pair) { return !(0, chart_utilities_1.isInvalidValue)(pair.value); });
|
|
361
|
-
// Sort descending by value
|
|
362
|
-
validPairs.sort(function (a, b) { return b.value - a.value; });
|
|
363
|
-
validPairs.forEach(function (pair, sortedIdx) {
|
|
364
|
-
var legend = "".concat(pair.label);
|
|
365
|
-
var color = (0, PlotlyColorAdapter_1.resolveColor)(colors, sortedIdx, legend, colorMap, isDarkTheme);
|
|
366
|
-
if (!mapLegendToDataPoint[legend]) {
|
|
367
|
-
mapLegendToDataPoint[legend] = {
|
|
368
|
-
legend: legend,
|
|
369
|
-
data: pair.value,
|
|
370
|
-
color: color,
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
else {
|
|
374
|
-
mapLegendToDataPoint[legend].data += pair.value;
|
|
375
|
-
}
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
363
|
var width = (_l = (_k = input.layout) === null || _k === void 0 ? void 0 : _k.width) !== null && _l !== void 0 ? _l : 440;
|
|
380
364
|
var height = (_o = (_m = input.layout) === null || _m === void 0 ? void 0 : _m.height) !== null && _o !== void 0 ? _o : 220;
|
|
381
365
|
var hideLabels = firstData.textinfo
|
|
@@ -387,10 +371,23 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
387
371
|
? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2)
|
|
388
372
|
: utilities_1.MIN_DONUT_RADIUS;
|
|
389
373
|
var chartTitle = getTitles(input.layout).chartTitle;
|
|
374
|
+
// Build anticlockwise order by keeping the first item, reversing the rest
|
|
375
|
+
var legends = Object.keys(mapLegendToDataPoint);
|
|
376
|
+
var reorderedEntries = legends.length > 1
|
|
377
|
+
? tslib_1.__spreadArray([
|
|
378
|
+
[legends[0], mapLegendToDataPoint[legends[0]]]
|
|
379
|
+
], legends
|
|
380
|
+
.slice(1)
|
|
381
|
+
.reverse()
|
|
382
|
+
.map(function (key) { return [key, mapLegendToDataPoint[key]]; }), true)
|
|
383
|
+
: legends.map(function (key) { return [key, mapLegendToDataPoint[key]]; });
|
|
390
384
|
return {
|
|
391
385
|
data: {
|
|
392
386
|
chartTitle: chartTitle,
|
|
393
|
-
chartData:
|
|
387
|
+
chartData: reorderedEntries.map(function (_a) {
|
|
388
|
+
var v = _a[1];
|
|
389
|
+
return v;
|
|
390
|
+
}),
|
|
394
391
|
},
|
|
395
392
|
hideLegend: isMultiPlot || ((_p = input.layout) === null || _p === void 0 ? void 0 : _p.showlegend) === false,
|
|
396
393
|
width: (_q = input.layout) === null || _q === void 0 ? void 0 : _q.width,
|
|
@@ -399,6 +396,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
399
396
|
hideLabels: hideLabels,
|
|
400
397
|
showLabelsInPercent: firstData.textinfo ? ['percent', 'label+percent'].includes(firstData.textinfo) : true,
|
|
401
398
|
roundCorners: true,
|
|
399
|
+
order: 'sorted',
|
|
402
400
|
};
|
|
403
401
|
};
|
|
404
402
|
exports.transformPlotlyJsonToDonutProps = transformPlotlyJsonToDonutProps;
|
|
@@ -429,7 +427,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
429
427
|
var rangeXValues = series.x.slice(rangeStart, rangeEnd);
|
|
430
428
|
var rangeYValues = series.y.slice(rangeStart, rangeEnd);
|
|
431
429
|
rangeXValues.forEach(function (x, index2) {
|
|
432
|
-
var _a, _b, _c, _d, _e, _f;
|
|
430
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
433
431
|
if (!mapXToDataPoints[x]) {
|
|
434
432
|
mapXToDataPoints[x] = {
|
|
435
433
|
xAxisPoint: (0, exports.resolveXAxisPoint)(x, isXYearCategory, isXString, isXDate, isXNumber),
|
|
@@ -443,7 +441,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
443
441
|
? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
|
|
444
442
|
? (_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]
|
|
445
443
|
: 0)
|
|
446
|
-
: (0, PlotlyColorAdapter_1.resolveColor)(extractedBarColors, index2, legend, colorMap, isDarkTheme);
|
|
444
|
+
: (0, PlotlyColorAdapter_1.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);
|
|
447
445
|
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index2);
|
|
448
446
|
var yVal = rangeYValues[index2];
|
|
449
447
|
var yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
|
|
@@ -451,7 +449,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
451
449
|
mapXToDataPoints[x].chartData.push({
|
|
452
450
|
legend: legend,
|
|
453
451
|
data: yVal,
|
|
454
|
-
color: (
|
|
452
|
+
color: (_h = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _h !== void 0 ? _h : color,
|
|
455
453
|
yAxisCalloutData: yAxisCalloutData,
|
|
456
454
|
});
|
|
457
455
|
if (typeof yVal === 'number') {
|
|
@@ -459,14 +457,14 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
459
457
|
}
|
|
460
458
|
}
|
|
461
459
|
else if (series.type === 'scatter' || !!fallbackVSBC) {
|
|
462
|
-
var lineColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedLineColors, index1, legend, colorMap, isDarkTheme);
|
|
460
|
+
var lineColor = (0, PlotlyColorAdapter_1.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);
|
|
463
461
|
var lineOptions = getLineOptions(series.line);
|
|
464
462
|
var legendShape = getLegendShape(series);
|
|
465
463
|
mapXToDataPoints[x].lineData.push({
|
|
466
464
|
legend: legend + (validXYRanges.length > 1 ? ".".concat(rangeIdx + 1) : ''),
|
|
467
465
|
legendShape: legendShape,
|
|
468
466
|
y: yVal,
|
|
469
|
-
color: (
|
|
467
|
+
color: (_m = (0, d3_color_1.rgb)(lineColor).copy({ opacity: opacity }).formatHex8()) !== null && _m !== void 0 ? _m : color,
|
|
470
468
|
lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
|
|
471
469
|
useSecondaryYScale: usesSecondaryYScale(series, input.layout),
|
|
472
470
|
yAxisCalloutData: yAxisCalloutData,
|
|
@@ -517,7 +515,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
517
515
|
// extract colors for each series only once
|
|
518
516
|
var extractedColors = (0, PlotlyColorAdapter_1.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);
|
|
519
517
|
(_e = series.x) === null || _e === void 0 ? void 0 : _e.forEach(function (x, xIndex) {
|
|
520
|
-
var _a, _b, _c, _d, _e, _f;
|
|
518
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
521
519
|
if ((0, chart_utilities_1.isInvalidValue)(x) || (0, chart_utilities_1.isInvalidValue)((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
|
|
522
520
|
return;
|
|
523
521
|
}
|
|
@@ -531,14 +529,14 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
531
529
|
? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
|
|
532
530
|
? (_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]
|
|
533
531
|
: 0)
|
|
534
|
-
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, xIndex, legend, colorMap, isDarkTheme);
|
|
532
|
+
: (0, PlotlyColorAdapter_1.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);
|
|
535
533
|
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, xIndex);
|
|
536
534
|
var yVal = series.y[xIndex];
|
|
537
535
|
mapXToDataPoints[x].series.push({
|
|
538
536
|
key: legend,
|
|
539
537
|
data: yVal,
|
|
540
538
|
xAxisCalloutData: x,
|
|
541
|
-
color: (
|
|
539
|
+
color: (_j = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color,
|
|
542
540
|
legend: legend,
|
|
543
541
|
useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout),
|
|
544
542
|
yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
|
|
@@ -591,17 +589,17 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
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((0, chart_utilities_1.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
|
-
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
599
|
+
: (0, PlotlyColorAdapter_1.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 = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
|
|
603
601
|
var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
|
|
604
|
-
vbcData.push(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: (
|
|
602
|
+
vbcData.push(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: (_h = (0, d3_color_1.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
|
});
|
|
@@ -641,7 +639,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
641
639
|
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
642
640
|
var chartData = input.data
|
|
643
641
|
.map(function (series, index) {
|
|
644
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
642
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
645
643
|
var colors = isScatterMarkers
|
|
646
644
|
? ((_a = series === null || series === void 0 ? void 0 : series.mode) === null || _a === void 0 ? void 0 : _a.includes('line'))
|
|
647
645
|
? (_b = series.line) === null || _b === void 0 ? void 0 : _b.color
|
|
@@ -656,11 +654,11 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
656
654
|
var isXYearCategory = (0, chart_utilities_1.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
|
|
657
655
|
var legend = legends[index];
|
|
658
656
|
// resolve color for each legend's lines from the extracted colors
|
|
659
|
-
var seriesColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
657
|
+
var seriesColor = (0, PlotlyColorAdapter_1.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);
|
|
660
658
|
var seriesOpacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
|
|
661
659
|
mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
|
|
662
660
|
// if mode contains 'text', we prioritize showing the text over curving the line
|
|
663
|
-
var lineOptions = !((
|
|
661
|
+
var lineOptions = !((_l = series.mode) === null || _l === void 0 ? void 0 : _l.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
|
|
664
662
|
var legendShape = getLegendShape(series);
|
|
665
663
|
var validXYRanges = (0, exports.getValidXYRanges)(series);
|
|
666
664
|
return validXYRanges.map(function (_a, rangeIdx) {
|
|
@@ -734,7 +732,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
734
732
|
var legend = legends[index];
|
|
735
733
|
return series.y
|
|
736
734
|
.map(function (yValue, i) {
|
|
737
|
-
var _a, _b, _c, _d, _e, _f;
|
|
735
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
738
736
|
if ((0, chart_utilities_1.isInvalidValue)((_a = series.x) === null || _a === void 0 ? void 0 : _a[i]) || (0, chart_utilities_1.isInvalidValue)(yValue)) {
|
|
739
737
|
return null;
|
|
740
738
|
}
|
|
@@ -743,13 +741,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
743
741
|
? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
|
|
744
742
|
? (_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]
|
|
745
743
|
: 0)
|
|
746
|
-
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
|
|
744
|
+
: (0, PlotlyColorAdapter_1.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);
|
|
747
745
|
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
|
|
748
746
|
return {
|
|
749
747
|
x: series.x[i],
|
|
750
748
|
y: yValue,
|
|
751
749
|
legend: legend,
|
|
752
|
-
color: (
|
|
750
|
+
color: (_j = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color,
|
|
753
751
|
};
|
|
754
752
|
})
|
|
755
753
|
.filter(function (point) { return point !== null; });
|
|
@@ -786,7 +784,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
786
784
|
};
|
|
787
785
|
return series.y
|
|
788
786
|
.map(function (yVal, i) {
|
|
789
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
787
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
790
788
|
if ((0, chart_utilities_1.isInvalidValue)(yVal)) {
|
|
791
789
|
return null;
|
|
792
790
|
}
|
|
@@ -795,10 +793,10 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
795
793
|
? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
|
|
796
794
|
? (_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]
|
|
797
795
|
: 0)
|
|
798
|
-
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
|
|
796
|
+
: (0, PlotlyColorAdapter_1.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);
|
|
799
797
|
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
|
|
800
|
-
var base = convertXValueToNumber((
|
|
801
|
-
var xVal = convertXValueToNumber((
|
|
798
|
+
var base = convertXValueToNumber((_h = series.base) === null || _h === void 0 ? void 0 : _h[i]);
|
|
799
|
+
var xVal = convertXValueToNumber((_j = series.x) === null || _j === void 0 ? void 0 : _j[i]);
|
|
802
800
|
return {
|
|
803
801
|
x: {
|
|
804
802
|
start: isXDate ? new Date(base) : base,
|
|
@@ -806,7 +804,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
806
804
|
},
|
|
807
805
|
y: yVal,
|
|
808
806
|
legend: legend,
|
|
809
|
-
color: (
|
|
807
|
+
color: (_k = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _k !== void 0 ? _k : color,
|
|
810
808
|
};
|
|
811
809
|
})
|
|
812
810
|
.filter(function (point) { return point !== null; });
|
|
@@ -950,7 +948,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
950
948
|
var extractedNodeColors = (0, PlotlyColorAdapter_1.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);
|
|
951
949
|
var sankeyChartData = {
|
|
952
950
|
nodes: (_e = node.label) === null || _e === void 0 ? void 0 : _e.map(function (label, index) {
|
|
953
|
-
var
|
|
951
|
+
var _a, _b, _c;
|
|
952
|
+
var color = (0, PlotlyColorAdapter_1.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);
|
|
954
953
|
return {
|
|
955
954
|
nodeId: index,
|
|
956
955
|
name: label,
|
|
@@ -979,19 +978,19 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
979
978
|
};
|
|
980
979
|
exports.transformPlotlyJsonToSankeyProps = transformPlotlyJsonToSankeyProps;
|
|
981
980
|
var transformPlotlyJsonToGaugeProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
982
|
-
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;
|
|
981
|
+
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;
|
|
983
982
|
var firstData = input.data[0];
|
|
984
983
|
var stepsColors = ((_a = firstData.gauge) === null || _a === void 0 ? void 0 : _a.steps) ? firstData.gauge.steps.map(function (step) { return step.color; }) : undefined;
|
|
985
984
|
var extractedColors = (0, PlotlyColorAdapter_1.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);
|
|
986
985
|
var segments = ((_f = (_e = firstData.gauge) === null || _e === void 0 ? void 0 : _e.steps) === null || _f === void 0 ? void 0 : _f.length)
|
|
987
986
|
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
988
987
|
firstData.gauge.steps.map(function (step, index) {
|
|
989
|
-
var _a, _b;
|
|
988
|
+
var _a, _b, _c, _d, _e;
|
|
990
989
|
var legend = step.name || "Segment ".concat(index + 1);
|
|
991
|
-
var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
990
|
+
var color = (0, PlotlyColorAdapter_1.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);
|
|
992
991
|
return {
|
|
993
992
|
legend: legend,
|
|
994
|
-
size: ((
|
|
993
|
+
size: ((_d = step.range) === null || _d === void 0 ? void 0 : _d[1]) - ((_e = step.range) === null || _e === void 0 ? void 0 : _e[0]),
|
|
995
994
|
color: color,
|
|
996
995
|
};
|
|
997
996
|
})
|
|
@@ -1014,13 +1013,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1014
1013
|
if (diff >= 0) {
|
|
1015
1014
|
sublabel = "\u25B2 ".concat(diff);
|
|
1016
1015
|
var extractedIncreasingDeltaColors = (0, PlotlyColorAdapter_1.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);
|
|
1017
|
-
var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedIncreasingDeltaColors, 0, '', colorMap, isDarkTheme);
|
|
1016
|
+
var color = (0, PlotlyColorAdapter_1.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);
|
|
1018
1017
|
sublabelColor = color;
|
|
1019
1018
|
}
|
|
1020
1019
|
else {
|
|
1021
1020
|
sublabel = "\u25BC ".concat(Math.abs(diff));
|
|
1022
|
-
var extractedDecreasingDeltaColors = (0, PlotlyColorAdapter_1.extractColor)((
|
|
1023
|
-
var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedDecreasingDeltaColors, 0, '', colorMap, isDarkTheme);
|
|
1021
|
+
var extractedDecreasingDeltaColors = (0, PlotlyColorAdapter_1.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);
|
|
1022
|
+
var color = (0, PlotlyColorAdapter_1.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);
|
|
1024
1023
|
sublabelColor = color;
|
|
1025
1024
|
}
|
|
1026
1025
|
}
|
|
@@ -1032,17 +1031,17 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1032
1031
|
var chartTitle = getTitles(input.layout).chartTitle;
|
|
1033
1032
|
return {
|
|
1034
1033
|
segments: segments,
|
|
1035
|
-
chartValue: (
|
|
1034
|
+
chartValue: (_14 = firstData.value) !== null && _14 !== void 0 ? _14 : 0,
|
|
1036
1035
|
chartTitle: chartTitle,
|
|
1037
1036
|
sublabel: sublabel,
|
|
1038
1037
|
// range values can be null
|
|
1039
|
-
minValue: typeof ((
|
|
1040
|
-
maxValue: typeof ((
|
|
1038
|
+
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,
|
|
1039
|
+
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,
|
|
1041
1040
|
chartValueFormat: function () { var _a, _b; return (_b = (_a = firstData.value) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ''; },
|
|
1042
|
-
width: (
|
|
1043
|
-
height: (
|
|
1041
|
+
width: (_27 = input.layout) === null || _27 === void 0 ? void 0 : _27.width,
|
|
1042
|
+
height: (_29 = (_28 = input.layout) === null || _28 === void 0 ? void 0 : _28.height) !== null && _29 !== void 0 ? _29 : 220,
|
|
1044
1043
|
styles: styles,
|
|
1045
|
-
variant: ((
|
|
1044
|
+
variant: ((_31 = (_30 = firstData.gauge) === null || _30 === void 0 ? void 0 : _30.steps) === null || _31 === void 0 ? void 0 : _31.length) ? index_1.GaugeChartVariant.MultipleSegments : index_1.GaugeChartVariant.SingleSegment,
|
|
1046
1045
|
roundCorners: true,
|
|
1047
1046
|
};
|
|
1048
1047
|
};
|
|
@@ -1078,6 +1077,17 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1078
1077
|
}
|
|
1079
1078
|
return "".concat(prefix !== null && prefix !== void 0 ? prefix : '').concat(formatted).concat(suffix !== null && suffix !== void 0 ? suffix : '');
|
|
1080
1079
|
};
|
|
1080
|
+
function resolveCellStyle(raw, rowIndex, colIndex) {
|
|
1081
|
+
var _a, _b;
|
|
1082
|
+
if (Array.isArray(raw)) {
|
|
1083
|
+
var rowEntry = (_a = raw[colIndex]) !== null && _a !== void 0 ? _a : raw[0];
|
|
1084
|
+
if (Array.isArray(rowEntry)) {
|
|
1085
|
+
return (_b = rowEntry[rowIndex]) !== null && _b !== void 0 ? _b : rowEntry[0];
|
|
1086
|
+
}
|
|
1087
|
+
return rowEntry;
|
|
1088
|
+
}
|
|
1089
|
+
return raw;
|
|
1090
|
+
}
|
|
1081
1091
|
var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
1082
1092
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
1083
1093
|
var tableData = input.data[0];
|
|
@@ -1091,41 +1101,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1091
1101
|
})
|
|
1092
1102
|
: values.map(function (cell) { return cleanText(cell); });
|
|
1093
1103
|
return cleanedValues.map(function (value, colIndex) {
|
|
1094
|
-
var _a, _b, _c
|
|
1095
|
-
|
|
1096
|
-
var
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
}
|
|
1102
|
-
else if (typeof colorEntry === 'string') {
|
|
1103
|
-
fontColor = colorEntry;
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
else if (typeof fontColorRaw === 'string') {
|
|
1107
|
-
fontColor = fontColorRaw;
|
|
1108
|
-
}
|
|
1109
|
-
var fontSizeRaw = (_c = header === null || header === void 0 ? void 0 : header.font) === null || _c === void 0 ? void 0 : _c.size;
|
|
1110
|
-
var fontSize;
|
|
1111
|
-
if (Array.isArray(fontSizeRaw)) {
|
|
1112
|
-
var fontSizeEntry = (_d = fontSizeRaw[colIndex]) !== null && _d !== void 0 ? _d : fontSizeRaw[0];
|
|
1113
|
-
fontSize = Array.isArray(fontSizeRaw[0])
|
|
1114
|
-
? (_e = fontSizeRaw[0][colIndex]) !== null && _e !== void 0 ? _e : fontSizeRaw[0][0]
|
|
1115
|
-
: typeof fontSizeEntry === 'number'
|
|
1116
|
-
? fontSizeEntry
|
|
1117
|
-
: undefined;
|
|
1118
|
-
}
|
|
1119
|
-
else if (typeof fontSizeRaw === 'number') {
|
|
1120
|
-
fontSize = fontSizeRaw;
|
|
1121
|
-
}
|
|
1122
|
-
var updatedColIndex = colIndex >= 1 ? 1 : 0;
|
|
1123
|
-
var fillColorRaw = (_f = header === null || header === void 0 ? void 0 : header.fill) === null || _f === void 0 ? void 0 : _f.color;
|
|
1124
|
-
var backgroundColor = Array.isArray(fillColorRaw)
|
|
1125
|
-
? (_g = fillColorRaw[updatedColIndex]) !== null && _g !== void 0 ? _g : fillColorRaw[0]
|
|
1126
|
-
: fillColorRaw;
|
|
1127
|
-
var textAlignRaw = header === null || header === void 0 ? void 0 : header.align;
|
|
1128
|
-
var textAlign = Array.isArray(textAlignRaw) ? (_h = textAlignRaw[colIndex]) !== null && _h !== void 0 ? _h : textAlignRaw[0] : textAlignRaw;
|
|
1104
|
+
var _a, _b, _c;
|
|
1105
|
+
//headers are at first row only
|
|
1106
|
+
var rowIndex = 0;
|
|
1107
|
+
var fontColor = resolveCellStyle((_a = header === null || header === void 0 ? void 0 : header.font) === null || _a === void 0 ? void 0 : _a.color, rowIndex, colIndex);
|
|
1108
|
+
var fontSize = resolveCellStyle((_b = header === null || header === void 0 ? void 0 : header.font) === null || _b === void 0 ? void 0 : _b.size, rowIndex, colIndex);
|
|
1109
|
+
var backgroundColor = resolveCellStyle((_c = header === null || header === void 0 ? void 0 : header.fill) === null || _c === void 0 ? void 0 : _c.color, rowIndex, colIndex);
|
|
1110
|
+
var textAlign = resolveCellStyle(header === null || header === void 0 ? void 0 : header.align, rowIndex, colIndex);
|
|
1129
1111
|
var style = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, (typeof fontColor === 'string' ? { color: fontColor } : {})), (typeof fontSize === 'number' ? { fontSize: fontSize } : {})), (typeof backgroundColor === 'string' ? { backgroundColor: backgroundColor } : {})), (textAlign ? { textAlign: textAlign } : {}));
|
|
1130
1112
|
return { value: value, style: style };
|
|
1131
1113
|
});
|
|
@@ -1136,45 +1118,16 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1136
1118
|
: (_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;
|
|
1137
1119
|
var rows = columns[0].map(function (_, rowIndex) {
|
|
1138
1120
|
return columns.map(function (col, colIndex) {
|
|
1139
|
-
var _a, _b, _c
|
|
1121
|
+
var _a, _b, _c;
|
|
1140
1122
|
var cellValue = col[rowIndex];
|
|
1141
1123
|
var cleanValue = typeof cellValue === 'string' ? cleanText(cellValue) : cellValue;
|
|
1142
1124
|
var formattedValue = typeof cleanValue === 'string' || typeof cleanValue === 'number'
|
|
1143
1125
|
? formatValue(cleanValue, colIndex, cells)
|
|
1144
1126
|
: cleanValue;
|
|
1145
|
-
var
|
|
1146
|
-
var
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
var colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
|
|
1150
|
-
fontColor = typeof colorValue === 'string' ? colorValue : undefined;
|
|
1151
|
-
}
|
|
1152
|
-
else if (typeof rawFontColor === 'string') {
|
|
1153
|
-
fontColor = rawFontColor;
|
|
1154
|
-
}
|
|
1155
|
-
var rawFontSize = (_c = cells === null || cells === void 0 ? void 0 : cells.font) === null || _c === void 0 ? void 0 : _c.size;
|
|
1156
|
-
var fontSize;
|
|
1157
|
-
if (Array.isArray(rawFontSize)) {
|
|
1158
|
-
var entry = (_d = rawFontSize[colIndex]) !== null && _d !== void 0 ? _d : rawFontSize[0];
|
|
1159
|
-
var fontSizeValue = Array.isArray(entry) ? entry[rowIndex] : entry;
|
|
1160
|
-
fontSize = typeof fontSizeValue === 'number' ? fontSizeValue : undefined;
|
|
1161
|
-
}
|
|
1162
|
-
else if (typeof rawFontSize === 'number') {
|
|
1163
|
-
fontSize = rawFontSize;
|
|
1164
|
-
}
|
|
1165
|
-
var updatedColIndex = colIndex >= 1 ? 1 : 0;
|
|
1166
|
-
var rawBackgroundColor = (_e = cells === null || cells === void 0 ? void 0 : cells.fill) === null || _e === void 0 ? void 0 : _e.color;
|
|
1167
|
-
var backgroundColor;
|
|
1168
|
-
if (Array.isArray(rawBackgroundColor)) {
|
|
1169
|
-
var entry = (_f = rawBackgroundColor[updatedColIndex]) !== null && _f !== void 0 ? _f : rawBackgroundColor[0];
|
|
1170
|
-
var colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
|
|
1171
|
-
backgroundColor = typeof colorValue === 'string' ? colorValue : undefined;
|
|
1172
|
-
}
|
|
1173
|
-
else if (typeof rawBackgroundColor === 'string') {
|
|
1174
|
-
backgroundColor = rawBackgroundColor;
|
|
1175
|
-
}
|
|
1176
|
-
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;
|
|
1177
|
-
var textAlign = rawTextAlign;
|
|
1127
|
+
var fontColor = resolveCellStyle((_a = cells === null || cells === void 0 ? void 0 : cells.font) === null || _a === void 0 ? void 0 : _a.color, rowIndex, colIndex);
|
|
1128
|
+
var fontSize = resolveCellStyle((_b = cells === null || cells === void 0 ? void 0 : cells.font) === null || _b === void 0 ? void 0 : _b.size, rowIndex, colIndex);
|
|
1129
|
+
var backgroundColor = resolveCellStyle((_c = cells === null || cells === void 0 ? void 0 : cells.fill) === null || _c === void 0 ? void 0 : _c.color, rowIndex, colIndex);
|
|
1130
|
+
var textAlign = resolveCellStyle(cells === null || cells === void 0 ? void 0 : cells.align, rowIndex, colIndex);
|
|
1178
1131
|
var style = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, (fontColor ? { color: fontColor } : {})), (typeof fontSize === 'number' ? { fontSize: fontSize } : {})), (backgroundColor ? { backgroundColor: backgroundColor } : {})), (textAlign ? { textAlign: textAlign } : {}));
|
|
1179
1132
|
return {
|
|
1180
1133
|
value: formattedValue,
|
|
@@ -1253,15 +1206,15 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1253
1206
|
// Assign a color per series/category and use it for all subValues of that category
|
|
1254
1207
|
var seriesColors_1 = {};
|
|
1255
1208
|
input.data.forEach(function (series, seriesIdx) {
|
|
1256
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1209
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
1257
1210
|
var category = series.name || "Category ".concat(seriesIdx + 1);
|
|
1258
1211
|
// Use the same color for this category across all stages
|
|
1259
1212
|
var extractedColors = (0, PlotlyColorAdapter_1.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);
|
|
1260
1213
|
// Always use the first color for the series/category
|
|
1261
|
-
var color = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, 0, category, colorMap, isDarkTheme);
|
|
1214
|
+
var color = (0, PlotlyColorAdapter_1.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);
|
|
1262
1215
|
seriesColors_1[category] = color;
|
|
1263
|
-
var labels = (
|
|
1264
|
-
var values = (
|
|
1216
|
+
var labels = (_l = (_k = series.labels) !== null && _k !== void 0 ? _k : series.y) !== null && _l !== void 0 ? _l : series.stage;
|
|
1217
|
+
var values = (_o = (_m = series.values) !== null && _m !== void 0 ? _m : series.x) !== null && _o !== void 0 ? _o : series.value;
|
|
1265
1218
|
if (!(0, chart_utilities_1.isArrayOrTypedArray)(labels) || !(0, chart_utilities_1.isArrayOrTypedArray)(values)) {
|
|
1266
1219
|
return;
|
|
1267
1220
|
}
|
|
@@ -1295,7 +1248,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1295
1248
|
}
|
|
1296
1249
|
var extractedColors = (0, PlotlyColorAdapter_1.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);
|
|
1297
1250
|
categories.forEach(function (label, i) {
|
|
1298
|
-
var
|
|
1251
|
+
var _a, _b, _c;
|
|
1252
|
+
var color = (0, PlotlyColorAdapter_1.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);
|
|
1299
1253
|
var valueNum = Number(values[i]);
|
|
1300
1254
|
if (isNaN(valueNum)) {
|
|
1301
1255
|
return;
|
|
@@ -1631,11 +1585,12 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1631
1585
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
1632
1586
|
if (traceInfo[index].type === 'donut') {
|
|
1633
1587
|
var pieSeries = series;
|
|
1634
|
-
var colors_2 = (0, PlotlyColorAdapter_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);
|
|
1588
|
+
var colors_2 = (0, PlotlyColorAdapter_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);
|
|
1635
1589
|
(_j = pieSeries.labels) === null || _j === void 0 ? void 0 : _j.forEach(function (label, labelIndex) {
|
|
1590
|
+
var _a, _b, _c, _d, _e;
|
|
1636
1591
|
var legend = "".concat(label);
|
|
1637
1592
|
// resolve color for each legend from the extracted colors
|
|
1638
|
-
var color = (0, PlotlyColorAdapter_1.resolveColor)(colors_2, labelIndex, legend, colorMap, isDarkTheme);
|
|
1593
|
+
var color = (0, PlotlyColorAdapter_1.resolveColor)(colors_2, 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);
|
|
1639
1594
|
if (legend !== '' && allupLegends.some(function (group) { return group.title === legend; }) === false) {
|
|
1640
1595
|
allupLegends.push({
|
|
1641
1596
|
title: legend,
|