@fluentui/react-charts 0.0.0-nightly-20250813-0406.1 → 0.0.0-nightly-20250815-0407.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -15
- package/dist/index.d.ts +16 -9
- package/lib/components/CommonComponents/CartesianChart.js +12 -16
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +3 -2
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +41 -9
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +130 -35
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/utilities.js +10 -4
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +12 -15
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +2 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +46 -9
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +129 -34
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +10 -4
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +12 -12
|
@@ -24,9 +24,15 @@ _export(exports, {
|
|
|
24
24
|
getValidXYRanges: function() {
|
|
25
25
|
return getValidXYRanges;
|
|
26
26
|
},
|
|
27
|
+
isStringArray: function() {
|
|
28
|
+
return isStringArray;
|
|
29
|
+
},
|
|
27
30
|
projectPolarToCartesian: function() {
|
|
28
31
|
return projectPolarToCartesian;
|
|
29
32
|
},
|
|
33
|
+
resolveXAxisPoint: function() {
|
|
34
|
+
return resolveXAxisPoint;
|
|
35
|
+
},
|
|
30
36
|
transformPlotlyJsonToChartTableProps: function() {
|
|
31
37
|
return transformPlotlyJsonToChartTableProps;
|
|
32
38
|
},
|
|
@@ -194,6 +200,25 @@ const _getGaugeAxisColor = (colorway, colorwayType, color, colorMap, isDarkTheme
|
|
|
194
200
|
const extractedColors = (0, _PlotlyColorAdapter.extractColor)(colorway, colorwayType, color, colorMap, isDarkTheme);
|
|
195
201
|
return (0, _PlotlyColorAdapter.resolveColor)(extractedColors, 0, '', colorMap, isDarkTheme);
|
|
196
202
|
};
|
|
203
|
+
const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNumber)=>{
|
|
204
|
+
if (x === null || x === undefined) {
|
|
205
|
+
return '';
|
|
206
|
+
}
|
|
207
|
+
if (isXYearCategory) {
|
|
208
|
+
return x.toString();
|
|
209
|
+
}
|
|
210
|
+
if (isXString) {
|
|
211
|
+
if (isXDate) {
|
|
212
|
+
const date = new Date(x);
|
|
213
|
+
return date;
|
|
214
|
+
}
|
|
215
|
+
if (isXNumber) {
|
|
216
|
+
return parseFloat(x);
|
|
217
|
+
}
|
|
218
|
+
return x;
|
|
219
|
+
}
|
|
220
|
+
return x;
|
|
221
|
+
};
|
|
197
222
|
const transformPlotlyJsonToDonutProps = (input, colorMap, colorwayType, isDarkTheme)=>{
|
|
198
223
|
var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _firstData_marker, _firstData_labels, _input_layout3, _input_layout4, _input_layout5, _input_layout6;
|
|
199
224
|
const firstData = input.data[0];
|
|
@@ -265,6 +290,10 @@ const transformPlotlyJsonToVSBCProps = (input, colorMap, colorwayType, isDarkThe
|
|
|
265
290
|
const extractedBarColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
|
|
266
291
|
// extract line colors for each series only once
|
|
267
292
|
const extractedLineColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, colorwayType, (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color, colorMap, isDarkTheme);
|
|
293
|
+
const xValues = series.x;
|
|
294
|
+
const isXDate = (0, _chartutilities.isDateArray)(xValues);
|
|
295
|
+
const isXString = isStringArray(xValues);
|
|
296
|
+
const isXNumber = (0, _chartutilities.isNumberArray)(xValues);
|
|
268
297
|
const validXYRanges = getValidXYRanges(series);
|
|
269
298
|
validXYRanges.forEach(([rangeStart, rangeEnd], rangeIdx)=>{
|
|
270
299
|
const rangeXValues = series.x.slice(rangeStart, rangeEnd);
|
|
@@ -272,7 +301,7 @@ const transformPlotlyJsonToVSBCProps = (input, colorMap, colorwayType, isDarkThe
|
|
|
272
301
|
rangeXValues.forEach((x, index2)=>{
|
|
273
302
|
if (!mapXToDataPoints[x]) {
|
|
274
303
|
mapXToDataPoints[x] = {
|
|
275
|
-
xAxisPoint: isXYearCategory
|
|
304
|
+
xAxisPoint: resolveXAxisPoint(x, isXYearCategory, isXString, isXDate, isXNumber),
|
|
276
305
|
chartData: [],
|
|
277
306
|
lineData: []
|
|
278
307
|
};
|
|
@@ -287,6 +316,9 @@ const transformPlotlyJsonToVSBCProps = (input, colorMap, colorwayType, isDarkThe
|
|
|
287
316
|
data: yVal,
|
|
288
317
|
color
|
|
289
318
|
});
|
|
319
|
+
if (typeof yVal === 'number') {
|
|
320
|
+
yMaxValue = Math.max(yMaxValue, yVal);
|
|
321
|
+
}
|
|
290
322
|
} else if (series.type === 'scatter' || !!fallbackVSBC) {
|
|
291
323
|
var _series_line;
|
|
292
324
|
const lineColor = (0, _PlotlyColorAdapter.resolveColor)(extractedLineColors, index1, legend, colorMap, isDarkTheme);
|
|
@@ -303,7 +335,7 @@ const transformPlotlyJsonToVSBCProps = (input, colorMap, colorwayType, isDarkThe
|
|
|
303
335
|
} : {},
|
|
304
336
|
useSecondaryYScale: usesSecondaryYScale(series)
|
|
305
337
|
});
|
|
306
|
-
if (!usesSecondaryYScale(series)) {
|
|
338
|
+
if (!usesSecondaryYScale(series) && typeof yVal === 'number') {
|
|
307
339
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
308
340
|
yMinValue = Math.min(yMinValue, yVal);
|
|
309
341
|
}
|
|
@@ -331,7 +363,10 @@ const transformPlotlyJsonToVSBCProps = (input, colorMap, colorwayType, isDarkThe
|
|
|
331
363
|
hideTickOverlap: true,
|
|
332
364
|
barGapMax: 2,
|
|
333
365
|
hideLegend,
|
|
334
|
-
roundCorners: true
|
|
366
|
+
roundCorners: true,
|
|
367
|
+
showYAxisLables: true,
|
|
368
|
+
noOfCharsToTruncate: 20,
|
|
369
|
+
showYAxisLablesTooltip: true
|
|
335
370
|
};
|
|
336
371
|
};
|
|
337
372
|
const createColorScale = (colorscale, domain)=>{
|
|
@@ -487,19 +522,22 @@ const transformPlotlyJsonToScatterChartProps = (input, isAreaChart, isScatterMar
|
|
|
487
522
|
let mode = 'tonexty';
|
|
488
523
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout);
|
|
489
524
|
const chartData = input.data.map((series, index)=>{
|
|
490
|
-
var
|
|
525
|
+
var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _series_line2;
|
|
526
|
+
const colors = isScatterMarkers ? (series === null || series === void 0 ? void 0 : (_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('line')) ? (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color : (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color : (_series_line1 = series.line) === null || _series_line1 === void 0 ? void 0 : _series_line1.color;
|
|
491
527
|
// extract colors for each series only once
|
|
492
|
-
const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType,
|
|
528
|
+
const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, colors, colorMap, isDarkTheme);
|
|
493
529
|
const xValues = series.x;
|
|
494
|
-
const
|
|
530
|
+
const isXString = isStringArray(xValues);
|
|
495
531
|
const isXDate = (0, _chartutilities.isDateArray)(xValues);
|
|
496
532
|
const isXNumber = (0, _chartutilities.isNumberArray)(xValues);
|
|
533
|
+
// string case is not possible for scatter chart as it is already filtered out in declarative chart
|
|
534
|
+
const isXYearCategory = false;
|
|
497
535
|
const legend = legends[index];
|
|
498
536
|
// resolve color for each legend's lines from the extracted colors
|
|
499
537
|
const seriesColor = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
500
538
|
mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
|
|
501
539
|
const lineOptions = getLineOptions(series.line);
|
|
502
|
-
const dashType = ((
|
|
540
|
+
const dashType = ((_series_line2 = series.line) === null || _series_line2 === void 0 ? void 0 : _series_line2.dash) || 'solid';
|
|
503
541
|
const legendShape = dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot' ? 'dottedLine' : 'default';
|
|
504
542
|
const validXYRanges = getValidXYRanges(series);
|
|
505
543
|
return validXYRanges.map(([rangeStart, rangeEnd], rangeIdx)=>{
|
|
@@ -513,7 +551,7 @@ const transformPlotlyJsonToScatterChartProps = (input, isAreaChart, isScatterMar
|
|
|
513
551
|
data: rangeXValues.map((x, i)=>{
|
|
514
552
|
var _series_marker, _series_marker1;
|
|
515
553
|
return {
|
|
516
|
-
x:
|
|
554
|
+
x: resolveXAxisPoint(x, isXYearCategory, isXString, isXDate, isXNumber),
|
|
517
555
|
y: rangeYValues[i],
|
|
518
556
|
...Array.isArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? {
|
|
519
557
|
markerSize: markerSizes[i]
|
|
@@ -1121,7 +1159,6 @@ function getLineOptions(line) {
|
|
|
1121
1159
|
}
|
|
1122
1160
|
return Object.keys(lineOptions).length > 0 ? lineOptions : undefined;
|
|
1123
1161
|
}
|
|
1124
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1125
1162
|
const isStringArray = (arr)=>{
|
|
1126
1163
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1127
1164
|
return (0, _chartutilities.isArrayOfType)(arr, (value)=>typeof value === 'string' || value === null);
|