@fluentui/react-charts 0.0.0-nightly-20250822-0407.1 → 0.0.0-nightly-20250826-0412.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 +11 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +2 -2
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +3 -15
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +24 -27
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +17 -14
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +6 -33
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +32 -16
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +149 -134
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +6 -1
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +21 -4
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +8 -4
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +4 -17
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +4 -21
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +111 -81
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +23 -10
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js +4 -21
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +12 -25
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -12
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +11 -7
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +4 -22
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +8 -6
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +5 -19
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +7 -6
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +4 -19
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib/utilities/Common.styles.js +47 -0
- package/lib/utilities/Common.styles.js.map +1 -0
- package/lib/utilities/Common.styles.raw.js +47 -0
- package/lib/utilities/Common.styles.raw.js.map +1 -0
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/index.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -14
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +24 -27
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +15 -13
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -32
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +31 -15
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +158 -134
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +6 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +32 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +8 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -19
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +3 -20
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +111 -81
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +30 -9
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +2 -20
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +23 -33
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +1 -12
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +13 -7
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +2 -20
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +5 -3
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +3 -17
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +5 -3
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +3 -18
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.js +71 -0
- package/lib-commonjs/utilities/Common.styles.js.map +1 -0
- package/lib-commonjs/utilities/Common.styles.raw.js +71 -0
- package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -0
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/index.js +1 -0
- package/lib-commonjs/utilities/index.js.map +1 -1
- package/package.json +12 -12
|
@@ -8,6 +8,8 @@ import { isArrayOrTypedArray, isDate, isDateArray, isNumberArray, isStringArray,
|
|
|
8
8
|
import { curveCardinal as d3CurveCardinal } from 'd3-shape';
|
|
9
9
|
import { getOpacity, extractColor, resolveColor } from './PlotlyColorAdapter';
|
|
10
10
|
import { rgb } from 'd3-color';
|
|
11
|
+
export const NON_PLOT_KEY_PREFIX = 'nonplot_';
|
|
12
|
+
export const SINGLE_REPEAT = 'repeat(1, 1fr)';
|
|
11
13
|
const dashOptions = {
|
|
12
14
|
dot: {
|
|
13
15
|
strokeDasharray: '1, 5',
|
|
@@ -241,7 +243,7 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
|
|
|
241
243
|
chartTitle,
|
|
242
244
|
chartData: Object.values(mapLegendToDataPoint)
|
|
243
245
|
},
|
|
244
|
-
hideLegend: ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false
|
|
246
|
+
hideLegend: isMultiPlot || ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false,
|
|
245
247
|
width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
|
|
246
248
|
height,
|
|
247
249
|
innerRadius,
|
|
@@ -562,6 +564,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
562
564
|
const seriesColor = resolveColor(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
563
565
|
const seriesOpacity = getOpacity(series, index);
|
|
564
566
|
mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
|
|
567
|
+
// if mode contains 'text', we prioritize showing the text over curving the line
|
|
565
568
|
const lineOptions = !((_series_mode1 = series.mode) === null || _series_mode1 === void 0 ? void 0 : _series_mode1.includes('text')) ? getLineOptions(series.line) : undefined;
|
|
566
569
|
const legendShape = getLegendShape(series);
|
|
567
570
|
const validXYRanges = getValidXYRanges(series);
|
|
@@ -1305,25 +1308,44 @@ const getLegendShape = (series)=>{
|
|
|
1305
1308
|
}
|
|
1306
1309
|
return 'default';
|
|
1307
1310
|
};
|
|
1308
|
-
export const getAllupLegendsProps = (input, colorMap, colorwayType, isDarkTheme)=>{
|
|
1311
|
+
export const getAllupLegendsProps = (input, colorMap, colorwayType, traceInfo, isDarkTheme)=>{
|
|
1309
1312
|
const allupLegends = [];
|
|
1310
1313
|
// reduce on showlegend boolean propperty. reduce should return true if at least one series has showlegend true
|
|
1311
1314
|
const toShowLegend = input.data.reduce((acc, series)=>{
|
|
1312
|
-
return acc || series.showlegend === true;
|
|
1315
|
+
return acc || series.showlegend === true || series.showlegend === undefined;
|
|
1313
1316
|
}, false);
|
|
1314
1317
|
if (toShowLegend) {
|
|
1315
1318
|
input.data.forEach((series, index)=>{
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
color
|
|
1325
|
-
|
|
1319
|
+
if (traceInfo[index].type === 'donut') {
|
|
1320
|
+
var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _pieSeries_marker, _pieSeries_labels;
|
|
1321
|
+
const pieSeries = series;
|
|
1322
|
+
var _input_layout_piecolorway, _input_layout_piecolorway1;
|
|
1323
|
+
const colors = extractColor((_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.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, (_input_layout_piecolorway1 = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.piecolorway) !== null && _input_layout_piecolorway1 !== void 0 ? _input_layout_piecolorway1 : pieSeries === null || pieSeries === void 0 ? void 0 : (_pieSeries_marker = pieSeries.marker) === null || _pieSeries_marker === void 0 ? void 0 : _pieSeries_marker.colors, colorMap, isDarkTheme);
|
|
1324
|
+
(_pieSeries_labels = pieSeries.labels) === null || _pieSeries_labels === void 0 ? void 0 : _pieSeries_labels.forEach((label, labelIndex)=>{
|
|
1325
|
+
const legend = `${label}`;
|
|
1326
|
+
// resolve color for each legend from the extracted colors
|
|
1327
|
+
const color = resolveColor(colors, labelIndex, legend, colorMap, isDarkTheme);
|
|
1328
|
+
if (legend !== '' && allupLegends.some((group)=>group.title === legend) === false) {
|
|
1329
|
+
allupLegends.push({
|
|
1330
|
+
title: legend,
|
|
1331
|
+
color
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1326
1334
|
});
|
|
1335
|
+
} else if (isNonPlotType(traceInfo[index].type) === false) {
|
|
1336
|
+
var _plotSeries_line, _plotSeries_marker, _input_layout_template_layout1, _input_layout_template1, _input_layout3;
|
|
1337
|
+
const plotSeries = series;
|
|
1338
|
+
const name = plotSeries.legendgroup;
|
|
1339
|
+
const color = ((_plotSeries_line = plotSeries.line) === null || _plotSeries_line === void 0 ? void 0 : _plotSeries_line.color) || ((_plotSeries_marker = plotSeries.marker) === null || _plotSeries_marker === void 0 ? void 0 : _plotSeries_marker.color);
|
|
1340
|
+
const legendShape = getLegendShape(plotSeries);
|
|
1341
|
+
const resolvedColor = extractColor((_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_template1 = _input_layout3.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, color, colorMap, isDarkTheme);
|
|
1342
|
+
if (name !== undefined && name !== '' && allupLegends.some((group)=>group.title === name) === false) {
|
|
1343
|
+
allupLegends.push({
|
|
1344
|
+
title: name,
|
|
1345
|
+
color: resolvedColor,
|
|
1346
|
+
shape: legendShape
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1327
1349
|
}
|
|
1328
1350
|
});
|
|
1329
1351
|
}
|
|
@@ -1389,28 +1411,21 @@ const getIndexFromKey = (key, pattern)=>{
|
|
|
1389
1411
|
const normalizedKey = key.replace(pattern, '') === '' ? '1' : key.replace(pattern, '');
|
|
1390
1412
|
return parseInt(normalizedKey, 10) - 1;
|
|
1391
1413
|
};
|
|
1392
|
-
export const
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1414
|
+
export const isNonPlotType = (chartType)=>{
|
|
1415
|
+
return [
|
|
1416
|
+
'donut',
|
|
1417
|
+
'sankey',
|
|
1418
|
+
'pie'
|
|
1419
|
+
].includes(chartType);
|
|
1420
|
+
};
|
|
1421
|
+
export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
1422
|
+
const domainX = [];
|
|
1423
|
+
const domainY = [];
|
|
1424
|
+
let cartesianDomains = 0;
|
|
1396
1425
|
const annotations = {};
|
|
1397
1426
|
let templateRows = '1fr';
|
|
1398
1427
|
let templateColumns = '1fr';
|
|
1399
1428
|
const gridLayout = {};
|
|
1400
|
-
if (layout === undefined || layout === null || Object.keys(layout).length === 0) {
|
|
1401
|
-
return {
|
|
1402
|
-
templateRows,
|
|
1403
|
-
templateColumns,
|
|
1404
|
-
layout: gridLayout
|
|
1405
|
-
};
|
|
1406
|
-
}
|
|
1407
|
-
if (!layout.xaxis || !layout.yaxis) {
|
|
1408
|
-
return {
|
|
1409
|
-
templateRows,
|
|
1410
|
-
templateColumns,
|
|
1411
|
-
layout: gridLayout
|
|
1412
|
-
};
|
|
1413
|
-
}
|
|
1414
1429
|
if (!isMultiPlot) {
|
|
1415
1430
|
return {
|
|
1416
1431
|
templateRows,
|
|
@@ -1418,144 +1433,144 @@ export const getGridProperties = (layout, isMultiPlot)=>{
|
|
|
1418
1433
|
layout: gridLayout
|
|
1419
1434
|
};
|
|
1420
1435
|
}
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
if (
|
|
1440
|
-
var
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1436
|
+
const layout = schema === null || schema === void 0 ? void 0 : schema.layout;
|
|
1437
|
+
if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
|
|
1438
|
+
Object.keys(layout !== null && layout !== void 0 ? layout : {}).forEach((key)=>{
|
|
1439
|
+
if (key.startsWith('xaxis')) {
|
|
1440
|
+
var _layout_key;
|
|
1441
|
+
const index = getIndexFromKey(key, 'xaxis');
|
|
1442
|
+
var _layout_key_anchor;
|
|
1443
|
+
const anchor = (_layout_key_anchor = (_layout_key = layout[key]) === null || _layout_key === void 0 ? void 0 : _layout_key.anchor) !== null && _layout_key_anchor !== void 0 ? _layout_key_anchor : 'y';
|
|
1444
|
+
const anchorIndex = getIndexFromKey(anchor, 'y');
|
|
1445
|
+
if (index !== anchorIndex) {
|
|
1446
|
+
throw new Error(`Invalid layout: xaxis ${index + 1} anchor should be y${anchorIndex + 1}`);
|
|
1447
|
+
}
|
|
1448
|
+
const xAxisLayout = layout[key];
|
|
1449
|
+
const domainXInfo = {
|
|
1450
|
+
start: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[0] : 0,
|
|
1451
|
+
end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1
|
|
1452
|
+
};
|
|
1453
|
+
domainX.push(domainXInfo);
|
|
1454
|
+
} else if (key.startsWith('yaxis')) {
|
|
1455
|
+
var _layout_key1;
|
|
1456
|
+
const index = getIndexFromKey(key, 'yaxis');
|
|
1457
|
+
var _layout_key_anchor1;
|
|
1458
|
+
const anchor = (_layout_key_anchor1 = (_layout_key1 = layout[key]) === null || _layout_key1 === void 0 ? void 0 : _layout_key1.anchor) !== null && _layout_key_anchor1 !== void 0 ? _layout_key_anchor1 : 'x';
|
|
1459
|
+
const anchorIndex = getIndexFromKey(anchor, 'x');
|
|
1460
|
+
if (index !== anchorIndex) {
|
|
1461
|
+
var _layout_yaxis2;
|
|
1462
|
+
if (index === 1 && anchorIndex === 0 || ((_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.side) === 'right') {
|
|
1463
|
+
// Special case for secondary y axis where yaxis2 can anchor to x1
|
|
1464
|
+
return {
|
|
1465
|
+
templateRows,
|
|
1466
|
+
templateColumns
|
|
1467
|
+
};
|
|
1468
|
+
}
|
|
1469
|
+
throw new Error(`Invalid layout: yaxis ${index + 1} anchor should be x${anchorIndex + 1}`);
|
|
1447
1470
|
}
|
|
1448
|
-
|
|
1471
|
+
const yAxisLayout = layout[key];
|
|
1472
|
+
const domainYInfo = {
|
|
1473
|
+
start: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[0] : 0,
|
|
1474
|
+
end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1
|
|
1475
|
+
};
|
|
1476
|
+
domainY.push(domainYInfo);
|
|
1449
1477
|
}
|
|
1450
|
-
|
|
1451
|
-
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1480
|
+
cartesianDomains = domainX.length; // Assuming that the number of x and y axes is the same
|
|
1481
|
+
validTracesInfo.forEach((trace, index)=>{
|
|
1482
|
+
if (isNonPlotType(trace.type)) {
|
|
1483
|
+
var _schema_data, _series_domain, _series_domain1, _series_domain2, _series_domain3;
|
|
1484
|
+
const series = schema === null || schema === void 0 ? void 0 : (_schema_data = schema.data) === null || _schema_data === void 0 ? void 0 : _schema_data[index];
|
|
1485
|
+
const domainXInfo = {
|
|
1486
|
+
start: ((_series_domain = series.domain) === null || _series_domain === void 0 ? void 0 : _series_domain.x) ? series.domain.x[0] : 0,
|
|
1487
|
+
end: ((_series_domain1 = series.domain) === null || _series_domain1 === void 0 ? void 0 : _series_domain1.x) ? series.domain.x[1] : 1
|
|
1488
|
+
};
|
|
1489
|
+
const domainYInfo = {
|
|
1490
|
+
start: ((_series_domain2 = series.domain) === null || _series_domain2 === void 0 ? void 0 : _series_domain2.y) ? series.domain.y[0] : 0,
|
|
1491
|
+
end: ((_series_domain3 = series.domain) === null || _series_domain3 === void 0 ? void 0 : _series_domain3.y) ? series.domain.y[1] : 1
|
|
1492
|
+
};
|
|
1493
|
+
domainX.push(domainXInfo);
|
|
1494
|
+
domainY.push(domainYInfo);
|
|
1452
1495
|
}
|
|
1453
1496
|
});
|
|
1454
|
-
(
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1497
|
+
if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
|
|
1498
|
+
var _layout_annotations;
|
|
1499
|
+
(_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
|
|
1500
|
+
const xMatches = domainX.flatMap((interval, idx)=>(annotation === null || annotation === void 0 ? void 0 : annotation.x) >= interval.start && (annotation === null || annotation === void 0 ? void 0 : annotation.x) <= interval.end ? [
|
|
1501
|
+
idx
|
|
1502
|
+
] : []);
|
|
1503
|
+
const yMatch = domainY.findIndex((interval, yIndex)=>xMatches.includes(yIndex) && (annotation === null || annotation === void 0 ? void 0 : annotation.y) >= interval.start && (annotation === null || annotation === void 0 ? void 0 : annotation.y) <= interval.end);
|
|
1504
|
+
if (yMatch !== -1) {
|
|
1505
|
+
if (annotations[yMatch] === undefined) {
|
|
1506
|
+
annotations[yMatch] = {};
|
|
1507
|
+
}
|
|
1508
|
+
if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
|
|
1509
|
+
annotations[yMatch].yAnnotation = annotation.text;
|
|
1510
|
+
} else {
|
|
1511
|
+
annotations[yMatch].xAnnotation = annotation.text;
|
|
1512
|
+
}
|
|
1467
1513
|
}
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
if (
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
if (domainX.length > 0) {
|
|
1471
1517
|
const uniqueXIntervals = new Map();
|
|
1472
|
-
|
|
1473
|
-
const key = `${interval
|
|
1518
|
+
domainX.forEach((interval)=>{
|
|
1519
|
+
const key = `${interval.start}-${interval.end}`;
|
|
1474
1520
|
if (!uniqueXIntervals.has(key)) {
|
|
1475
1521
|
uniqueXIntervals.set(key, interval);
|
|
1476
1522
|
}
|
|
1477
1523
|
});
|
|
1478
|
-
const
|
|
1479
|
-
templateColumns =
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
return;
|
|
1485
|
-
}
|
|
1486
|
-
const cellName = `x${index === 0 ? '' : index + 1}`;
|
|
1524
|
+
const sortedXStart = Array.from(uniqueXIntervals.values()).map((interval)=>interval.start).sort();
|
|
1525
|
+
templateColumns = `repeat(${sortedXStart.length}, 1fr)`;
|
|
1526
|
+
domainX.forEach((interval, index)=>{
|
|
1527
|
+
const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
|
|
1528
|
+
const columnIndex = sortedXStart.findIndex((start)=>start === interval.start);
|
|
1529
|
+
const columnNumber = columnIndex + 1; // Column numbers are 1-based
|
|
1487
1530
|
const annotationProps = annotations[index];
|
|
1488
1531
|
const xAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.xAnnotation;
|
|
1489
|
-
if (interval[0] < lastIntervalEnd) {
|
|
1490
|
-
columnNumber = 1;
|
|
1491
|
-
}
|
|
1492
|
-
lastIntervalEnd = interval[1];
|
|
1493
1532
|
const row = {
|
|
1494
1533
|
row: -1,
|
|
1495
1534
|
column: columnNumber,
|
|
1496
|
-
xAnnotation
|
|
1535
|
+
xAnnotation,
|
|
1536
|
+
xDomain: interval,
|
|
1537
|
+
yDomain: {
|
|
1538
|
+
start: 0,
|
|
1539
|
+
end: 1
|
|
1540
|
+
}
|
|
1497
1541
|
};
|
|
1498
1542
|
gridLayout[cellName] = row;
|
|
1499
|
-
columnNumber += 1;
|
|
1500
1543
|
});
|
|
1501
1544
|
}
|
|
1502
|
-
|
|
1503
|
-
var _cell_column;
|
|
1504
|
-
return (_cell_column = cell.column) !== null && _cell_column !== void 0 ? _cell_column : 0;
|
|
1505
|
-
}));
|
|
1506
|
-
const columnFill = {};
|
|
1507
|
-
for(let i = 1; i <= numColumns; i++){
|
|
1508
|
-
columnFill[i] = {
|
|
1509
|
-
row: 1,
|
|
1510
|
-
fillDomain: 0
|
|
1511
|
-
};
|
|
1512
|
-
}
|
|
1513
|
-
if (gridY.length > 0) {
|
|
1545
|
+
if (domainY.length > 0) {
|
|
1514
1546
|
const uniqueYIntervals = new Map();
|
|
1515
|
-
|
|
1516
|
-
const key = `${interval
|
|
1547
|
+
domainY.forEach((interval)=>{
|
|
1548
|
+
const key = `${interval.start}-${interval.end}`;
|
|
1517
1549
|
if (!uniqueYIntervals.has(key)) {
|
|
1518
1550
|
uniqueYIntervals.set(key, interval);
|
|
1519
1551
|
}
|
|
1520
1552
|
});
|
|
1521
|
-
const
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
const
|
|
1553
|
+
const sortedYStart = Array.from(uniqueYIntervals.values()).map((interval)=>interval.start).sort();
|
|
1554
|
+
const numberOfRows = sortedYStart.length;
|
|
1555
|
+
templateRows = `repeat(${numberOfRows}, 1fr)`;
|
|
1556
|
+
domainY.forEach((interval, index)=>{
|
|
1557
|
+
const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
|
|
1558
|
+
const rowIndex = sortedYStart.findIndex((start)=>start === interval.start);
|
|
1559
|
+
const rowNumber = numberOfRows - rowIndex; // Rows are 1-based and we need to reverse the order for CSS grid
|
|
1528
1560
|
const annotationProps = annotations[index];
|
|
1529
1561
|
const yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
|
|
1530
1562
|
const cell = gridLayout[cellName];
|
|
1531
1563
|
if (cell !== undefined) {
|
|
1532
|
-
cell.row =
|
|
1564
|
+
cell.row = rowNumber;
|
|
1533
1565
|
cell.yAnnotation = yAnnotation;
|
|
1566
|
+
cell.yDomain = interval;
|
|
1534
1567
|
}
|
|
1535
|
-
columnFill[cell.column].fillDomain = interval[1];
|
|
1536
|
-
columnFill[cell.column].row += 1;
|
|
1537
1568
|
});
|
|
1538
1569
|
}
|
|
1539
|
-
// reverse the order of rows in grid layout from bottom-top to top-bottom as required by CSS grid
|
|
1540
|
-
const reversedGridLayout = {};
|
|
1541
|
-
// find the maximum row number
|
|
1542
|
-
const maxRowNumber = Math.max(...Object.values(gridLayout).map((cell)=>{
|
|
1543
|
-
var _cell_row;
|
|
1544
|
-
return (_cell_row = cell.row) !== null && _cell_row !== void 0 ? _cell_row : 0;
|
|
1545
|
-
}));
|
|
1546
|
-
// iterate over the gridLayout and reverse the row numbers
|
|
1547
|
-
Object.keys(gridLayout).forEach((key)=>{
|
|
1548
|
-
const cell = gridLayout[key];
|
|
1549
|
-
if (cell.row !== undefined) {
|
|
1550
|
-
// reverse the row number
|
|
1551
|
-
cell.row = maxRowNumber - cell.row + 1;
|
|
1552
|
-
}
|
|
1553
|
-
reversedGridLayout[key] = cell;
|
|
1554
|
-
});
|
|
1555
1570
|
return {
|
|
1556
1571
|
templateRows,
|
|
1557
1572
|
templateColumns,
|
|
1558
|
-
layout:
|
|
1573
|
+
layout: gridLayout
|
|
1559
1574
|
};
|
|
1560
1575
|
};
|
|
1561
1576
|
/**
|