@fluentui/react-charting 5.23.95 → 5.23.97
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 +55 -1
- package/CHANGELOG.md +24 -2
- package/dist/react-charting.d.ts +8 -2
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +8 -2
- package/lib/components/ChartTable/ChartTable.base.js +2 -2
- package/lib/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.types.d.ts +9 -2
- package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +0 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +154 -35
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +1 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +40 -24
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/ChartTable/ChartTable.base.js +2 -2
- package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib-amd/components/ChartTable/ChartTable.types.d.ts +9 -2
- package/lib-amd/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +0 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +161 -44
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +1 -0
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +39 -24
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.base.js +2 -2
- package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.types.d.ts +9 -2
- package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +0 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +161 -43
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +39 -23
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/package.json +2 -2
- package/src/components/ChartTable/ChartTable.types.ts +3 -2
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getValidXYRanges = exports.getNumberAtIndexOrDefault = exports.
|
|
3
|
+
exports.getValidXYRanges = exports.getNumberAtIndexOrDefault = exports.findArrayAttributes = exports.projectPolarToCartesian = exports.transformPlotlyJsonToChartTableProps = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports._getGaugeAxisColor = exports.correctYearMonth = exports.isMonthArray = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var d3_array_1 = require("d3-array");
|
|
6
6
|
var d3_scale_1 = require("d3-scale");
|
|
7
|
+
var d3_format_1 = require("d3-format");
|
|
7
8
|
var colors_1 = require("../../utilities/colors");
|
|
8
9
|
var index_1 = require("../GaugeChart/index");
|
|
9
10
|
var utilities_1 = require("../../utilities/utilities");
|
|
@@ -156,14 +157,16 @@ var _getGaugeAxisColor = function (colorway, colorwayType, color, colorMap, isDa
|
|
|
156
157
|
};
|
|
157
158
|
exports._getGaugeAxisColor = _getGaugeAxisColor;
|
|
158
159
|
var transformPlotlyJsonToDonutProps = function (input, colorMap, colorwayType, isDarkTheme) {
|
|
159
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
160
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
160
161
|
var firstData = input.data[0];
|
|
161
162
|
// extract colors for each series only once
|
|
162
|
-
|
|
163
|
+
// use piecolorway if available
|
|
164
|
+
// otherwise, default to colorway from template
|
|
165
|
+
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);
|
|
163
166
|
var mapLegendToDataPoint = {};
|
|
164
|
-
(
|
|
167
|
+
(_j = firstData.labels) === null || _j === void 0 ? void 0 : _j.forEach(function (label, index) {
|
|
165
168
|
var value = (0, exports.getNumberAtIndexOrDefault)(firstData.values, index);
|
|
166
|
-
if ((0,
|
|
169
|
+
if ((0, chart_utilities_1.isInvalidValue)(value) || value < 0) {
|
|
167
170
|
return;
|
|
168
171
|
}
|
|
169
172
|
var legend = "".concat(label);
|
|
@@ -180,8 +183,8 @@ var transformPlotlyJsonToDonutProps = function (input, colorMap, colorwayType, i
|
|
|
180
183
|
mapLegendToDataPoint[legend].data += value;
|
|
181
184
|
}
|
|
182
185
|
});
|
|
183
|
-
var width = (
|
|
184
|
-
var height = (
|
|
186
|
+
var width = (_l = (_k = input.layout) === null || _k === void 0 ? void 0 : _k.width) !== null && _l !== void 0 ? _l : 440;
|
|
187
|
+
var height = (_o = (_m = input.layout) === null || _m === void 0 ? void 0 : _m.height) !== null && _o !== void 0 ? _o : 220;
|
|
185
188
|
var hideLabels = firstData.textinfo
|
|
186
189
|
? !['value', 'percent', 'label+percent'].includes(firstData.textinfo)
|
|
187
190
|
: false;
|
|
@@ -196,8 +199,8 @@ var transformPlotlyJsonToDonutProps = function (input, colorMap, colorwayType, i
|
|
|
196
199
|
chartTitle: chartTitle,
|
|
197
200
|
chartData: Object.values(mapLegendToDataPoint),
|
|
198
201
|
},
|
|
199
|
-
hideLegend: ((
|
|
200
|
-
width: (
|
|
202
|
+
hideLegend: ((_p = input.layout) === null || _p === void 0 ? void 0 : _p.showlegend) === false ? true : false,
|
|
203
|
+
width: (_q = input.layout) === null || _q === void 0 ? void 0 : _q.width,
|
|
201
204
|
height: height,
|
|
202
205
|
innerRadius: innerRadius,
|
|
203
206
|
hideLabels: hideLabels,
|
|
@@ -271,18 +274,41 @@ var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayType, is
|
|
|
271
274
|
return tslib_1.__assign(tslib_1.__assign({ data: Object.values(mapXToDataPoints), width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barWidth: 'auto', yMaxValue: yMaxValue, yMinValue: yMinValue, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2 });
|
|
272
275
|
};
|
|
273
276
|
exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
|
|
277
|
+
var createColorScale = function (colorscale, domain) {
|
|
278
|
+
var dMin = domain[0], dMax = domain[1];
|
|
279
|
+
// Normalize colorscale domain to actual data domain
|
|
280
|
+
var scaleDomain = colorscale.map(function (_a) {
|
|
281
|
+
var pos = _a[0];
|
|
282
|
+
return dMin + pos * (dMax - dMin);
|
|
283
|
+
});
|
|
284
|
+
var scaleColors = colorscale.map(function (item) { return item[1]; });
|
|
285
|
+
return (0, d3_scale_1.scaleLinear)().domain(scaleDomain).range(scaleColors);
|
|
286
|
+
};
|
|
274
287
|
var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayType, isDarkTheme) {
|
|
275
288
|
var _a, _b, _c;
|
|
276
289
|
var mapXToDataPoints = {};
|
|
277
290
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
|
|
278
291
|
var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
292
|
+
var colorScale = undefined;
|
|
279
293
|
input.data.forEach(function (series, index1) {
|
|
280
|
-
var _a, _b, _c, _d, _e;
|
|
294
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
295
|
+
if (((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.coloraxis) === null || _b === void 0 ? void 0 : _b.colorscale) === null || _c === void 0 ? void 0 : _c.length) &&
|
|
296
|
+
(0, chart_utilities_1.isArrayOrTypedArray)((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
|
|
297
|
+
((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
|
|
298
|
+
typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
|
|
299
|
+
var scale = input.layout.coloraxis.colorscale;
|
|
300
|
+
var colorValues = (_h = series.marker) === null || _h === void 0 ? void 0 : _h.color;
|
|
301
|
+
var _t = [
|
|
302
|
+
(_k = (_j = input.layout.coloraxis) === null || _j === void 0 ? void 0 : _j.cmin) !== null && _k !== void 0 ? _k : Math.min.apply(Math, colorValues),
|
|
303
|
+
(_m = (_l = input.layout.coloraxis) === null || _l === void 0 ? void 0 : _l.cmax) !== null && _m !== void 0 ? _m : Math.max.apply(Math, colorValues),
|
|
304
|
+
], dMin = _t[0], dMax = _t[1];
|
|
305
|
+
colorScale = createColorScale(scale, [dMin, dMax]);
|
|
306
|
+
}
|
|
281
307
|
// extract colors for each series only once
|
|
282
|
-
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((
|
|
283
|
-
(
|
|
284
|
-
var _a;
|
|
285
|
-
if ((0,
|
|
308
|
+
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_q = (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.template) === null || _p === void 0 ? void 0 : _p.layout) === null || _q === void 0 ? void 0 : _q.colorway, colorwayType, (_r = series.marker) === null || _r === void 0 ? void 0 : _r.color, colorMap, isDarkTheme);
|
|
309
|
+
(_s = series.x) === null || _s === void 0 ? void 0 : _s.forEach(function (x, xIndex) {
|
|
310
|
+
var _a, _b, _c, _d;
|
|
311
|
+
if ((0, chart_utilities_1.isInvalidValue)(x) || (0, chart_utilities_1.isInvalidValue)((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
|
|
286
312
|
return;
|
|
287
313
|
}
|
|
288
314
|
if (!mapXToDataPoints[x]) {
|
|
@@ -290,8 +316,10 @@ var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayType, is
|
|
|
290
316
|
}
|
|
291
317
|
if (series.type === 'bar') {
|
|
292
318
|
var legend = legends[index1];
|
|
293
|
-
// resolve color for each legend's bars from the extracted colors
|
|
294
|
-
var color =
|
|
319
|
+
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
320
|
+
var color = colorScale
|
|
321
|
+
? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) ? (_d = (_c = series.marker) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d[xIndex] : 0)
|
|
322
|
+
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index1, legend, colorMap, isDarkTheme);
|
|
295
323
|
mapXToDataPoints[x].series.push({
|
|
296
324
|
key: legend,
|
|
297
325
|
data: series.y[xIndex],
|
|
@@ -322,7 +350,7 @@ var transformPlotlyJsonToVBCProps = function (input, colorMap, colorwayType, isD
|
|
|
322
350
|
var yValues = [];
|
|
323
351
|
series.x.forEach(function (xVal, index) {
|
|
324
352
|
var yVal = (0, exports.getNumberAtIndexOrDefault)(series.y, index);
|
|
325
|
-
if ((0,
|
|
353
|
+
if ((0, chart_utilities_1.isInvalidValue)(xVal) || (0, chart_utilities_1.isInvalidValue)(yVal)) {
|
|
326
354
|
return;
|
|
327
355
|
}
|
|
328
356
|
xValues.push(xVal);
|
|
@@ -453,7 +481,7 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, colorMap,
|
|
|
453
481
|
return series.y
|
|
454
482
|
.map(function (yValue, i) {
|
|
455
483
|
var _a;
|
|
456
|
-
if ((0,
|
|
484
|
+
if ((0, chart_utilities_1.isInvalidValue)((_a = series.x) === null || _a === void 0 ? void 0 : _a[i]) || (0, chart_utilities_1.isInvalidValue)(yValue)) {
|
|
457
485
|
return null;
|
|
458
486
|
}
|
|
459
487
|
return {
|
|
@@ -511,7 +539,7 @@ var transformPlotlyJsonToHeatmapProps = function (input) {
|
|
|
511
539
|
(_a = firstData.x) === null || _a === void 0 ? void 0 : _a.forEach(function (xVal, index) {
|
|
512
540
|
var _a;
|
|
513
541
|
var zVal = (0, exports.getNumberAtIndexOrDefault)(firstData.z, index);
|
|
514
|
-
if ((0,
|
|
542
|
+
if ((0, chart_utilities_1.isInvalidValue)(xVal) || (0, chart_utilities_1.isInvalidValue)((_a = firstData.y) === null || _a === void 0 ? void 0 : _a[index]) || (0, chart_utilities_1.isInvalidValue)(zVal)) {
|
|
515
543
|
return;
|
|
516
544
|
}
|
|
517
545
|
xValues_1.push(xVal);
|
|
@@ -635,7 +663,7 @@ var transformPlotlyJsonToSankeyProps = function (input, colorMap, colorwayType,
|
|
|
635
663
|
var validLinks = ((_a = link === null || link === void 0 ? void 0 : link.value) !== null && _a !== void 0 ? _a : [])
|
|
636
664
|
.map(function (val, index) {
|
|
637
665
|
var _a, _b;
|
|
638
|
-
if ((0,
|
|
666
|
+
if ((0, chart_utilities_1.isInvalidValue)(val) || (0, chart_utilities_1.isInvalidValue)((_a = link === null || link === void 0 ? void 0 : link.source) === null || _a === void 0 ? void 0 : _a[index]) || (0, chart_utilities_1.isInvalidValue)((_b = link === null || link === void 0 ? void 0 : link.target) === null || _b === void 0 ? void 0 : _b[index])) {
|
|
639
667
|
return null;
|
|
640
668
|
}
|
|
641
669
|
return {
|
|
@@ -754,37 +782,132 @@ var cleanText = function (text) {
|
|
|
754
782
|
.replace(/\$[^$]*\$/g, '$')
|
|
755
783
|
.trim();
|
|
756
784
|
};
|
|
785
|
+
var formatValue = function (value, colIndex, cells) {
|
|
786
|
+
if (value === null || typeof value === 'boolean') {
|
|
787
|
+
return value;
|
|
788
|
+
}
|
|
789
|
+
var formatStr = Array.isArray(cells.format) ? cells.format[colIndex] : cells.format;
|
|
790
|
+
var prefix = Array.isArray(cells.prefix) ? cells.prefix[colIndex] : cells.prefix;
|
|
791
|
+
var suffix = Array.isArray(cells.suffix) ? cells.suffix[colIndex] : cells.suffix;
|
|
792
|
+
var formatted = value;
|
|
793
|
+
if (typeof value === 'number') {
|
|
794
|
+
if (typeof formatStr === 'string') {
|
|
795
|
+
try {
|
|
796
|
+
formatted = (0, d3_format_1.format)(formatStr)(value);
|
|
797
|
+
}
|
|
798
|
+
catch (_a) {
|
|
799
|
+
formatted = (0, utilities_1.formatValueLimitWidth)(value);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
else {
|
|
803
|
+
formatted = (0, utilities_1.formatValueLimitWidth)(value);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
return "".concat(prefix !== null && prefix !== void 0 ? prefix : '').concat(formatted).concat(suffix !== null && suffix !== void 0 ? suffix : '');
|
|
807
|
+
};
|
|
757
808
|
var transformPlotlyJsonToChartTableProps = function (input, colorMap, isDarkTheme) {
|
|
758
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
809
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
759
810
|
var tableData = input.data[0];
|
|
760
|
-
var normalizeHeaders = function (values) {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
return values.map(function (row) {
|
|
811
|
+
var normalizeHeaders = function (values, header) {
|
|
812
|
+
var cleanedValues = Array.isArray(values[0])
|
|
813
|
+
? values.map(function (row) {
|
|
764
814
|
return row
|
|
765
815
|
.map(function (cell) { return cleanText(cell); })
|
|
766
816
|
.filter(Boolean)
|
|
767
817
|
.join(' ');
|
|
768
|
-
})
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
818
|
+
})
|
|
819
|
+
: values.map(function (cell) { return cleanText(cell); });
|
|
820
|
+
return cleanedValues.map(function (value, colIndex) {
|
|
821
|
+
var _a, _b, _c;
|
|
822
|
+
var fontColorRaw = (_a = header === null || header === void 0 ? void 0 : header.font) === null || _a === void 0 ? void 0 : _a.color;
|
|
823
|
+
var fontColor;
|
|
824
|
+
if (Array.isArray(fontColorRaw)) {
|
|
825
|
+
var colorEntry = fontColorRaw[colIndex];
|
|
826
|
+
if (Array.isArray(colorEntry)) {
|
|
827
|
+
fontColor = typeof colorEntry[0] === 'string' ? colorEntry[0] : undefined;
|
|
828
|
+
}
|
|
829
|
+
else if (typeof colorEntry === 'string') {
|
|
830
|
+
fontColor = colorEntry;
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
else if (typeof fontColorRaw === 'string') {
|
|
834
|
+
fontColor = fontColorRaw;
|
|
835
|
+
}
|
|
836
|
+
var fontSizeRaw = (_b = header === null || header === void 0 ? void 0 : header.font) === null || _b === void 0 ? void 0 : _b.size;
|
|
837
|
+
var fontSize;
|
|
838
|
+
if (Array.isArray(fontSizeRaw)) {
|
|
839
|
+
fontSize = Array.isArray(fontSizeRaw[0]) ? fontSizeRaw[0][colIndex] : fontSizeRaw[colIndex];
|
|
840
|
+
}
|
|
841
|
+
else if (typeof fontSizeRaw === 'number') {
|
|
842
|
+
fontSize = fontSizeRaw;
|
|
843
|
+
}
|
|
844
|
+
var updatedColIndex = colIndex >= 1 ? 1 : 0;
|
|
845
|
+
var fillColorRaw = (_c = header === null || header === void 0 ? void 0 : header.fill) === null || _c === void 0 ? void 0 : _c.color;
|
|
846
|
+
var backgroundColor = Array.isArray(fillColorRaw) ? fillColorRaw[updatedColIndex] : fillColorRaw;
|
|
847
|
+
var textAlignRaw = header === null || header === void 0 ? void 0 : header.align;
|
|
848
|
+
var textAlign = Array.isArray(textAlignRaw) ? textAlignRaw[colIndex] : textAlignRaw;
|
|
849
|
+
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 } : {}));
|
|
850
|
+
return { value: value, style: style };
|
|
851
|
+
});
|
|
772
852
|
};
|
|
773
853
|
var columns = (_b = (_a = tableData.cells) === null || _a === void 0 ? void 0 : _a.values) !== null && _b !== void 0 ? _b : [];
|
|
854
|
+
var cells = tableData.cells.font ? tableData.cells : (_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[0].cells;
|
|
774
855
|
var rows = columns[0].map(function (_, rowIndex) {
|
|
775
|
-
return columns.map(function (col) {
|
|
776
|
-
var
|
|
777
|
-
|
|
856
|
+
return columns.map(function (col, colIndex) {
|
|
857
|
+
var _a, _b, _c;
|
|
858
|
+
var cellValue = col[rowIndex];
|
|
859
|
+
var cleanValue = typeof cellValue === 'string' ? cleanText(cellValue) : cellValue;
|
|
860
|
+
var formattedValue = typeof cleanValue === 'string' || typeof cleanValue === 'number'
|
|
861
|
+
? formatValue(cleanValue, colIndex, cells)
|
|
862
|
+
: cleanValue;
|
|
863
|
+
var rawFontColor = (_a = cells === null || cells === void 0 ? void 0 : cells.font) === null || _a === void 0 ? void 0 : _a.color;
|
|
864
|
+
var fontColor;
|
|
865
|
+
if (Array.isArray(rawFontColor)) {
|
|
866
|
+
var entry = rawFontColor[colIndex];
|
|
867
|
+
var colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
|
|
868
|
+
fontColor = typeof colorValue === 'string' ? colorValue : undefined;
|
|
869
|
+
}
|
|
870
|
+
else if (typeof rawFontColor === 'string') {
|
|
871
|
+
fontColor = rawFontColor;
|
|
872
|
+
}
|
|
873
|
+
var rawFontSize = (_b = cells === null || cells === void 0 ? void 0 : cells.font) === null || _b === void 0 ? void 0 : _b.size;
|
|
874
|
+
var fontSize;
|
|
875
|
+
if (Array.isArray(rawFontSize)) {
|
|
876
|
+
var entry = rawFontSize[colIndex];
|
|
877
|
+
var fontSizeValue = Array.isArray(entry) ? entry[rowIndex] : entry;
|
|
878
|
+
fontSize = typeof fontSizeValue === 'number' ? fontSizeValue : undefined;
|
|
879
|
+
}
|
|
880
|
+
else if (typeof rawFontSize === 'number') {
|
|
881
|
+
fontSize = rawFontSize;
|
|
882
|
+
}
|
|
883
|
+
var updatedColIndex = colIndex >= 1 ? 1 : 0;
|
|
884
|
+
var rawBackgroundColor = (_c = cells === null || cells === void 0 ? void 0 : cells.fill) === null || _c === void 0 ? void 0 : _c.color;
|
|
885
|
+
var backgroundColor;
|
|
886
|
+
if (Array.isArray(rawBackgroundColor)) {
|
|
887
|
+
var entry = rawBackgroundColor[updatedColIndex];
|
|
888
|
+
var colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
|
|
889
|
+
backgroundColor = typeof colorValue === 'string' ? colorValue : undefined;
|
|
890
|
+
}
|
|
891
|
+
else if (typeof rawBackgroundColor === 'string') {
|
|
892
|
+
backgroundColor = rawBackgroundColor;
|
|
893
|
+
}
|
|
894
|
+
var rawTextAlign = Array.isArray(cells === null || cells === void 0 ? void 0 : cells.align) ? cells.align[colIndex] : cells === null || cells === void 0 ? void 0 : cells.align;
|
|
895
|
+
var textAlign = rawTextAlign;
|
|
896
|
+
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 } : {}));
|
|
897
|
+
return {
|
|
898
|
+
value: formattedValue,
|
|
899
|
+
style: style,
|
|
900
|
+
};
|
|
778
901
|
});
|
|
779
902
|
});
|
|
780
903
|
var styles = {
|
|
781
|
-
root: tslib_1.__assign({}, (((
|
|
904
|
+
root: tslib_1.__assign({}, (((_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.font) === null || _g === void 0 ? void 0 : _g.size) ? { fontSize: input.layout.font.size } : {})),
|
|
782
905
|
};
|
|
783
906
|
return {
|
|
784
|
-
headers: normalizeHeaders((
|
|
907
|
+
headers: normalizeHeaders((_j = (_h = tableData.header) === null || _h === void 0 ? void 0 : _h.values) !== null && _j !== void 0 ? _j : [], ((_k = tableData.header) === null || _k === void 0 ? void 0 : _k.font) ? tableData.header : (_o = (_m = (_l = input.layout) === null || _l === void 0 ? void 0 : _l.template) === null || _m === void 0 ? void 0 : _m.data) === null || _o === void 0 ? void 0 : _o.table[0].header),
|
|
785
908
|
rows: rows,
|
|
786
|
-
width: (
|
|
787
|
-
height: (
|
|
909
|
+
width: (_p = input.layout) === null || _p === void 0 ? void 0 : _p.width,
|
|
910
|
+
height: (_q = input.layout) === null || _q === void 0 ? void 0 : _q.height,
|
|
788
911
|
styles: styles,
|
|
789
912
|
};
|
|
790
913
|
};
|
|
@@ -797,7 +920,7 @@ var projectPolarToCartesian = function (input) {
|
|
|
797
920
|
series.x = [];
|
|
798
921
|
series.y = [];
|
|
799
922
|
for (var ptindex = 0; ptindex < ((_b = (_a = series.r) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0); ptindex++) {
|
|
800
|
-
if ((0,
|
|
923
|
+
if ((0, chart_utilities_1.isInvalidValue)((_c = series.theta) === null || _c === void 0 ? void 0 : _c[ptindex]) || (0, chart_utilities_1.isInvalidValue)((_d = series.r) === null || _d === void 0 ? void 0 : _d[ptindex])) {
|
|
801
924
|
continue;
|
|
802
925
|
}
|
|
803
926
|
var thetaRad = (series.theta[ptindex] * Math.PI) / 180;
|
|
@@ -1003,11 +1126,6 @@ var getLegendProps = function (data, layout) {
|
|
|
1003
1126
|
hideLegend: (layout === null || layout === void 0 ? void 0 : layout.showlegend) === false || ((layout === null || layout === void 0 ? void 0 : layout.showlegend) !== true && legends.length < 2) ? true : hideLegends,
|
|
1004
1127
|
};
|
|
1005
1128
|
};
|
|
1006
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1007
|
-
var isInvalidValue = function (value) {
|
|
1008
|
-
return typeof value === 'undefined' || value === null || (typeof value === 'number' && !isFinite(value));
|
|
1009
|
-
};
|
|
1010
|
-
exports.isInvalidValue = isInvalidValue;
|
|
1011
1129
|
var getNumberAtIndexOrDefault = function (data, index) {
|
|
1012
1130
|
if ((0, chart_utilities_1.isArrayOrTypedArray)(data)) {
|
|
1013
1131
|
if (typeof data[index] !== 'number' || !isFinite(data[index])) {
|
|
@@ -1026,7 +1144,7 @@ var getValidXYRanges = function (series) {
|
|
|
1026
1144
|
var start = 0;
|
|
1027
1145
|
var end = 0;
|
|
1028
1146
|
for (; end < series.x.length; end++) {
|
|
1029
|
-
if ((0,
|
|
1147
|
+
if ((0, chart_utilities_1.isInvalidValue)(series.x[end]) || (0, chart_utilities_1.isInvalidValue)(series.y[end])) {
|
|
1030
1148
|
if (end - start > 0) {
|
|
1031
1149
|
ranges.push([start, end]);
|
|
1032
1150
|
}
|