@fluentui/react-charts 0.0.0-nightly-20250826-0412.1 → 0.0.0-nightly-20250826-2140.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 -48
- package/dist/index.d.ts +1 -15
- package/lib/components/AreaChart/AreaChart.js +1 -4
- package/lib/components/AreaChart/AreaChart.js.map +1 -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 +15 -3
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +24 -24
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +14 -17
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +33 -6
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +16 -32
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +199 -294
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +1 -6
- 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 +4 -21
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +4 -8
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +4 -23
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +17 -4
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +21 -4
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +114 -175
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +6 -26
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +81 -111
- 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 +10 -23
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js +21 -4
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +25 -12
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +12 -2
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +30 -49
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +7 -27
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +14 -8
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +4 -27
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +6 -8
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +19 -5
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +44 -61
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +6 -7
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +19 -4
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/index.js +0 -1
- package/lib/utilities/index.js.map +1 -1
- package/lib/utilities/utilities.js +29 -0
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +1 -4
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +14 -2
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +24 -24
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +13 -15
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +32 -4
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +15 -31
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +198 -302
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +1 -6
- 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 +4 -32
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +4 -8
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +3 -22
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +19 -2
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +20 -3
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +113 -174
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +5 -25
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +81 -111
- 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 +9 -30
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +20 -2
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +33 -23
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +12 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +30 -49
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +5 -37
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +13 -7
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +3 -26
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +3 -5
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +17 -3
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +43 -60
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +3 -5
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +18 -3
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/index.js +0 -1
- package/lib-commonjs/utilities/index.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +32 -0
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +12 -12
- package/lib/utilities/Common.styles.js +0 -47
- package/lib/utilities/Common.styles.js.map +0 -1
- package/lib/utilities/Common.styles.raw.js +0 -47
- package/lib/utilities/Common.styles.raw.js.map +0 -1
- package/lib-commonjs/utilities/Common.styles.js +0 -71
- package/lib-commonjs/utilities/Common.styles.js.map +0 -1
- package/lib-commonjs/utilities/Common.styles.raw.js +0 -71
- package/lib-commonjs/utilities/Common.styles.raw.js.map +0 -1
|
@@ -9,12 +9,6 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
NON_PLOT_KEY_PREFIX: function() {
|
|
13
|
-
return NON_PLOT_KEY_PREFIX;
|
|
14
|
-
},
|
|
15
|
-
SINGLE_REPEAT: function() {
|
|
16
|
-
return SINGLE_REPEAT;
|
|
17
|
-
},
|
|
18
12
|
_getGaugeAxisColor: function() {
|
|
19
13
|
return _getGaugeAxisColor;
|
|
20
14
|
},
|
|
@@ -36,9 +30,6 @@ _export(exports, {
|
|
|
36
30
|
getValidXYRanges: function() {
|
|
37
31
|
return getValidXYRanges;
|
|
38
32
|
},
|
|
39
|
-
isNonPlotType: function() {
|
|
40
|
-
return isNonPlotType;
|
|
41
|
-
},
|
|
42
33
|
projectPolarToCartesian: function() {
|
|
43
34
|
return projectPolarToCartesian;
|
|
44
35
|
},
|
|
@@ -93,8 +84,6 @@ const _chartutilities = require("@fluentui/chart-utilities");
|
|
|
93
84
|
const _d3shape = require("d3-shape");
|
|
94
85
|
const _PlotlyColorAdapter = require("./PlotlyColorAdapter");
|
|
95
86
|
const _d3color = require("d3-color");
|
|
96
|
-
const NON_PLOT_KEY_PREFIX = 'nonplot_';
|
|
97
|
-
const SINGLE_REPEAT = 'repeat(1, 1fr)';
|
|
98
87
|
const dashOptions = {
|
|
99
88
|
dot: {
|
|
100
89
|
strokeDasharray: '1, 5',
|
|
@@ -143,47 +132,6 @@ function getTitles(layout) {
|
|
|
143
132
|
};
|
|
144
133
|
return titles;
|
|
145
134
|
}
|
|
146
|
-
const getXAxisTickFormat = (series, layout)=>{
|
|
147
|
-
const xAxis = getXAxisProperties(series, layout);
|
|
148
|
-
if (xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat) {
|
|
149
|
-
return {
|
|
150
|
-
tickFormat: xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
return {};
|
|
154
|
-
};
|
|
155
|
-
const getYAxisTickFormat = (series, layout)=>{
|
|
156
|
-
const yAxis = getYAxisProperties(series, layout);
|
|
157
|
-
if (yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat) {
|
|
158
|
-
return {
|
|
159
|
-
yAxisTickFormat: (0, _d3format.format)(yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat)
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
return {};
|
|
163
|
-
};
|
|
164
|
-
const getYMinMaxValues = (series, layout)=>{
|
|
165
|
-
var _getYAxisProperties;
|
|
166
|
-
const range = (_getYAxisProperties = getYAxisProperties(series, layout)) === null || _getYAxisProperties === void 0 ? void 0 : _getYAxisProperties.range;
|
|
167
|
-
if (range && range.length === 2) {
|
|
168
|
-
return {
|
|
169
|
-
yMinValue: range[0],
|
|
170
|
-
yMaxValue: range[1]
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
return {};
|
|
174
|
-
};
|
|
175
|
-
const getYAxisProperties = (series, layout)=>{
|
|
176
|
-
return layout === null || layout === void 0 ? void 0 : layout.yaxis;
|
|
177
|
-
};
|
|
178
|
-
const getXAxisProperties = (series, layout)=>{
|
|
179
|
-
return layout === null || layout === void 0 ? void 0 : layout.xaxis;
|
|
180
|
-
};
|
|
181
|
-
const getFormattedCalloutYData = (yVal, yAxisFormat)=>{
|
|
182
|
-
if (typeof (yAxisFormat === null || yAxisFormat === void 0 ? void 0 : yAxisFormat.yAxisTickFormat) === 'function' && typeof yVal === 'number') {
|
|
183
|
-
return yAxisFormat.yAxisTickFormat(yVal);
|
|
184
|
-
}
|
|
185
|
-
return (0, _chartutilities.formatToLocaleString)(yVal);
|
|
186
|
-
};
|
|
187
135
|
const correctYearMonth = (xValues)=>{
|
|
188
136
|
const presentYear = new Date().getFullYear();
|
|
189
137
|
if (xValues.length > 0 && Array.isArray(xValues[0])) {
|
|
@@ -327,7 +275,7 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
|
|
|
327
275
|
chartTitle,
|
|
328
276
|
chartData: Object.values(mapLegendToDataPoint)
|
|
329
277
|
},
|
|
330
|
-
hideLegend:
|
|
278
|
+
hideLegend: ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false ? true : false,
|
|
331
279
|
width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
|
|
332
280
|
height,
|
|
333
281
|
innerRadius,
|
|
@@ -346,7 +294,6 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
346
294
|
const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
|
|
347
295
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
348
296
|
let colorScale = undefined;
|
|
349
|
-
const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
350
297
|
let yMinValue = 0;
|
|
351
298
|
input.data.forEach((series, index1)=>{
|
|
352
299
|
var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3, _input_layout_template_layout1, _input_layout_template1, _input_layout2, _series_line;
|
|
@@ -380,7 +327,6 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
380
327
|
const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedBarColors, index2, legend, colorMap, isDarkTheme);
|
|
381
328
|
const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
|
|
382
329
|
const yVal = rangeYValues[index2];
|
|
383
|
-
const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
|
|
384
330
|
if (series.type === 'bar') {
|
|
385
331
|
var _rgb_copy_formatHex8;
|
|
386
332
|
mapXToDataPoints[x].chartData.push({
|
|
@@ -388,8 +334,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
388
334
|
data: yVal,
|
|
389
335
|
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
|
|
390
336
|
opacity
|
|
391
|
-
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
|
|
392
|
-
yAxisCalloutData
|
|
337
|
+
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
|
|
393
338
|
});
|
|
394
339
|
if (typeof yVal === 'number') {
|
|
395
340
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
@@ -411,8 +356,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
411
356
|
...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
|
|
412
357
|
mode: series.mode
|
|
413
358
|
},
|
|
414
|
-
useSecondaryYScale: usesSecondaryYScale(series, input.layout)
|
|
415
|
-
yAxisCalloutData
|
|
359
|
+
useSecondaryYScale: usesSecondaryYScale(series, input.layout)
|
|
416
360
|
});
|
|
417
361
|
if (!usesSecondaryYScale(series, input.layout) && typeof yVal === 'number') {
|
|
418
362
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
@@ -423,6 +367,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
423
367
|
});
|
|
424
368
|
});
|
|
425
369
|
});
|
|
370
|
+
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
426
371
|
const vsbcData = Object.values(mapXToDataPoints);
|
|
427
372
|
var _input_layout_height;
|
|
428
373
|
return {
|
|
@@ -432,6 +377,9 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
432
377
|
barWidth: 'auto',
|
|
433
378
|
yMaxValue,
|
|
434
379
|
yMinValue,
|
|
380
|
+
chartTitle,
|
|
381
|
+
xAxisTitle,
|
|
382
|
+
yAxisTitle,
|
|
435
383
|
mode: 'plotly',
|
|
436
384
|
...secondaryYAxisValues,
|
|
437
385
|
wrapXAxisLables: typeof ((_vsbcData_ = vsbcData[0]) === null || _vsbcData_ === void 0 ? void 0 : _vsbcData_.xAxisPoint) === 'string',
|
|
@@ -441,11 +389,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
441
389
|
roundCorners: true,
|
|
442
390
|
showYAxisLables: true,
|
|
443
391
|
noOfCharsToTruncate: 20,
|
|
444
|
-
showYAxisLablesTooltip: true
|
|
445
|
-
...getTitles(input.layout),
|
|
446
|
-
...getXAxisTickFormat(input.data[0], input.layout),
|
|
447
|
-
...yAxisTickFormat,
|
|
448
|
-
...getAxisCategoryOrderProps(input.data, input.layout)
|
|
392
|
+
showYAxisLablesTooltip: true
|
|
449
393
|
};
|
|
450
394
|
};
|
|
451
395
|
const createColorScale = (layout, series)=>{
|
|
@@ -468,7 +412,6 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
468
412
|
const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
|
|
469
413
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
470
414
|
let colorScale = undefined;
|
|
471
|
-
const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
472
415
|
input.data.forEach((series, index1)=>{
|
|
473
416
|
var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3, _series_x;
|
|
474
417
|
if (((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : (_input_layout_coloraxis_colorscale = _input_layout_coloraxis.colorscale) === null || _input_layout_coloraxis_colorscale === void 0 ? void 0 : _input_layout_coloraxis_colorscale.length) && (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) && ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length > 0 && typeof ((_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[0]) === 'number') {
|
|
@@ -491,24 +434,23 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
491
434
|
var _series_marker, _series_marker1, _series_marker_color, _series_marker2;
|
|
492
435
|
const legend = legends[index1];
|
|
493
436
|
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
494
|
-
const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors,
|
|
437
|
+
const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index1, legend, colorMap, isDarkTheme);
|
|
495
438
|
const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
|
|
496
|
-
const yVal = series.y[index2];
|
|
497
439
|
var _rgb_copy_formatHex8;
|
|
498
440
|
mapXToDataPoints[x].series.push({
|
|
499
441
|
key: legend,
|
|
500
|
-
data:
|
|
442
|
+
data: series.y[index2],
|
|
501
443
|
xAxisCalloutData: x,
|
|
502
444
|
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
|
|
503
445
|
opacity
|
|
504
446
|
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
|
|
505
447
|
legend,
|
|
506
|
-
useSecondaryYScale: usesSecondaryYScale(series, input.layout)
|
|
507
|
-
yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat)
|
|
448
|
+
useSecondaryYScale: usesSecondaryYScale(series, input.layout)
|
|
508
449
|
});
|
|
509
450
|
}
|
|
510
451
|
});
|
|
511
452
|
});
|
|
453
|
+
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
512
454
|
const gvbcData = Object.values(mapXToDataPoints);
|
|
513
455
|
var _input_layout_height;
|
|
514
456
|
return {
|
|
@@ -516,17 +458,15 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
516
458
|
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
517
459
|
height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
|
|
518
460
|
barWidth: 'auto',
|
|
461
|
+
chartTitle,
|
|
462
|
+
xAxisTitle,
|
|
463
|
+
yAxisTitle,
|
|
519
464
|
mode: 'plotly',
|
|
520
465
|
...secondaryYAxisValues,
|
|
521
466
|
hideTickOverlap: true,
|
|
522
467
|
wrapXAxisLables: typeof ((_gvbcData_ = gvbcData[0]) === null || _gvbcData_ === void 0 ? void 0 : _gvbcData_.name) === 'string',
|
|
523
468
|
hideLegend,
|
|
524
|
-
roundCorners: true
|
|
525
|
-
...getTitles(input.layout),
|
|
526
|
-
...getYMinMaxValues(input.data[0], input.layout),
|
|
527
|
-
...getXAxisTickFormat(input.data[0], input.layout),
|
|
528
|
-
...yAxisTickFormat,
|
|
529
|
-
...getAxisCategoryOrderProps(input.data, input.layout)
|
|
469
|
+
roundCorners: true
|
|
530
470
|
};
|
|
531
471
|
};
|
|
532
472
|
const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
@@ -592,20 +532,21 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
|
|
|
592
532
|
});
|
|
593
533
|
});
|
|
594
534
|
});
|
|
535
|
+
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
595
536
|
var _input_layout_height;
|
|
596
537
|
return {
|
|
597
538
|
data: vbcData,
|
|
598
539
|
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
599
540
|
height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
|
|
541
|
+
chartTitle,
|
|
542
|
+
xAxisTitle,
|
|
543
|
+
yAxisTitle,
|
|
600
544
|
mode: 'histogram',
|
|
601
545
|
hideTickOverlap: true,
|
|
602
546
|
wrapXAxisLables: typeof ((_vbcData_ = vbcData[0]) === null || _vbcData_ === void 0 ? void 0 : _vbcData_.x) === 'string',
|
|
603
547
|
maxBarWidth: 50,
|
|
604
548
|
hideLegend,
|
|
605
|
-
roundCorners: true
|
|
606
|
-
...getTitles(input.layout),
|
|
607
|
-
...getYMinMaxValues(input.data[0], input.layout),
|
|
608
|
-
...getAxisCategoryOrderProps(input.data, input.layout)
|
|
549
|
+
roundCorners: true
|
|
609
550
|
};
|
|
610
551
|
};
|
|
611
552
|
const transformPlotlyJsonToAreaChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
@@ -618,9 +559,8 @@ const transformPlotlyJsonToScatterChartProps = (input, isMultiPlot, colorMap, co
|
|
|
618
559
|
return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
|
|
619
560
|
};
|
|
620
561
|
const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme)=>{
|
|
621
|
-
var _input_data_
|
|
562
|
+
var _input_data_;
|
|
622
563
|
const isScatterMarkers = [
|
|
623
|
-
'markers',
|
|
624
564
|
'text+markers',
|
|
625
565
|
'markers+text',
|
|
626
566
|
'lines+markers',
|
|
@@ -632,7 +572,6 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
632
572
|
const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
|
|
633
573
|
let mode = 'tonexty';
|
|
634
574
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
635
|
-
const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
636
575
|
const chartData = input.data.map((series, index)=>{
|
|
637
576
|
var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _series_mode1;
|
|
638
577
|
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;
|
|
@@ -648,7 +587,6 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
648
587
|
const seriesColor = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
649
588
|
const seriesOpacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
|
|
650
589
|
mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
|
|
651
|
-
// if mode contains 'text', we prioritize showing the text over curving the line
|
|
652
590
|
const lineOptions = !((_series_mode1 = series.mode) === null || _series_mode1 === void 0 ? void 0 : _series_mode1.includes('text')) ? getLineOptions(series.line) : undefined;
|
|
653
591
|
const legendShape = getLegendShape(series);
|
|
654
592
|
const validXYRanges = getValidXYRanges(series);
|
|
@@ -674,8 +612,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
674
612
|
} : {},
|
|
675
613
|
...textValues ? {
|
|
676
614
|
text: textValues[i]
|
|
677
|
-
} : {}
|
|
678
|
-
yAxisCalloutData: getFormattedCalloutYData(rangeYValues[i], yAxisTickFormat)
|
|
615
|
+
} : {}
|
|
679
616
|
};
|
|
680
617
|
}),
|
|
681
618
|
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(seriesColor).copy({
|
|
@@ -689,45 +626,52 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
689
626
|
};
|
|
690
627
|
});
|
|
691
628
|
}).flat();
|
|
692
|
-
const
|
|
693
|
-
|
|
694
|
-
const yMinMaxValues = (0, _utilities.findNumericMinMaxOfY)(chartData);
|
|
695
|
-
yMinMax.yMinValue = yMinMaxValues.startValue;
|
|
696
|
-
yMinMax.yMaxValue = yMinMaxValues.endValue;
|
|
697
|
-
}
|
|
629
|
+
const yMinMaxValues = (0, _utilities.findNumericMinMaxOfY)(chartData);
|
|
630
|
+
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
698
631
|
const numDataPoints = chartData.reduce((total, lineChartPoints)=>total + lineChartPoints.data.length, 0);
|
|
699
632
|
const chartProps = {
|
|
633
|
+
chartTitle,
|
|
700
634
|
lineChartData: chartData
|
|
701
635
|
};
|
|
702
636
|
const scatterChartProps = {
|
|
637
|
+
chartTitle,
|
|
703
638
|
scatterChartData: chartData
|
|
704
639
|
};
|
|
705
|
-
var _input_layout_height;
|
|
706
|
-
const commonProps = {
|
|
707
|
-
supportNegativeData: true,
|
|
708
|
-
...secondaryYAxisValues,
|
|
709
|
-
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
710
|
-
height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
|
|
711
|
-
hideTickOverlap: true,
|
|
712
|
-
hideLegend,
|
|
713
|
-
useUTC: false,
|
|
714
|
-
optimizeLargeData: numDataPoints > 1000,
|
|
715
|
-
...getTitles(input.layout),
|
|
716
|
-
...getXAxisTickFormat(input.data[0], input.layout),
|
|
717
|
-
...yAxisTickFormat
|
|
718
|
-
};
|
|
719
640
|
if (isAreaChart) {
|
|
641
|
+
var _input_layout, _input_layout1;
|
|
642
|
+
var _input_layout_height;
|
|
720
643
|
return {
|
|
721
644
|
data: chartProps,
|
|
645
|
+
supportNegativeData: true,
|
|
646
|
+
xAxisTitle,
|
|
647
|
+
yAxisTitle,
|
|
648
|
+
...secondaryYAxisValues,
|
|
722
649
|
mode,
|
|
723
|
-
|
|
650
|
+
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
651
|
+
height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
|
|
652
|
+
hideTickOverlap: true,
|
|
653
|
+
useUTC: false,
|
|
654
|
+
hideLegend,
|
|
655
|
+
optimizeLargeData: numDataPoints > 1000
|
|
724
656
|
};
|
|
725
657
|
} else {
|
|
658
|
+
var _input_layout2, _input_layout3;
|
|
659
|
+
var _input_layout_height1;
|
|
726
660
|
return {
|
|
727
661
|
data: isScatterChart ? scatterChartProps : chartProps,
|
|
662
|
+
supportNegativeData: true,
|
|
663
|
+
xAxisTitle,
|
|
664
|
+
yAxisTitle,
|
|
665
|
+
...secondaryYAxisValues,
|
|
728
666
|
roundedTicks: true,
|
|
729
|
-
|
|
730
|
-
|
|
667
|
+
yMinValue: yMinMaxValues.startValue,
|
|
668
|
+
yMaxValue: yMinMaxValues.endValue,
|
|
669
|
+
width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
|
|
670
|
+
height: (_input_layout_height1 = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.height) !== null && _input_layout_height1 !== void 0 ? _input_layout_height1 : 350,
|
|
671
|
+
hideTickOverlap: true,
|
|
672
|
+
useUTC: false,
|
|
673
|
+
hideLegend,
|
|
674
|
+
optimizeLargeData: numDataPoints > 1000
|
|
731
675
|
};
|
|
732
676
|
}
|
|
733
677
|
};
|
|
@@ -761,7 +705,8 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
|
|
|
761
705
|
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
|
|
762
706
|
};
|
|
763
707
|
}).filter((point)=>point !== null);
|
|
764
|
-
}).flat()
|
|
708
|
+
}).reverse().flat() //reversing the order to invert the Y bars order as required by plotly.
|
|
709
|
+
.reverse();
|
|
765
710
|
var _input_layout_height;
|
|
766
711
|
const chartHeight = (_input_layout_height = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 450;
|
|
767
712
|
var _input_layout_margin_l;
|
|
@@ -773,8 +718,12 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
|
|
|
773
718
|
const scalingFactor = 0.01;
|
|
774
719
|
const gapFactor = 1 / (1 + scalingFactor * numberOfRows);
|
|
775
720
|
const barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
|
|
721
|
+
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
776
722
|
return {
|
|
777
723
|
data: chartData,
|
|
724
|
+
chartTitle,
|
|
725
|
+
xAxisTitle,
|
|
726
|
+
yAxisTitle,
|
|
778
727
|
secondaryYAxistitle: typeof ((_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_yaxis2 = _input_layout3.yaxis2) === null || _input_layout_yaxis2 === void 0 ? void 0 : _input_layout_yaxis2.title) === 'string' ? (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_yaxis21 = _input_layout4.yaxis2) === null || _input_layout_yaxis21 === void 0 ? void 0 : _input_layout_yaxis21.title : ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_yaxis22 = _input_layout5.yaxis2) === null || _input_layout_yaxis22 === void 0 ? void 0 : (_input_layout_yaxis2_title = _input_layout_yaxis22.title) === null || _input_layout_yaxis2_title === void 0 ? void 0 : _input_layout_yaxis2_title.text) || '',
|
|
779
728
|
barHeight,
|
|
780
729
|
showYAxisLables: true,
|
|
@@ -784,9 +733,7 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
|
|
|
784
733
|
noOfCharsToTruncate: 20,
|
|
785
734
|
showYAxisLablesTooltip: true,
|
|
786
735
|
hideLegend,
|
|
787
|
-
roundCorners: true
|
|
788
|
-
...getTitles(input.layout),
|
|
789
|
-
...getAxisCategoryOrderProps(input.data, input.layout)
|
|
736
|
+
roundCorners: true
|
|
790
737
|
};
|
|
791
738
|
};
|
|
792
739
|
const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
@@ -899,6 +846,7 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
|
|
|
899
846
|
}
|
|
900
847
|
const domainValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[0] * (zMax - zMin) + zMin) : defaultDomain;
|
|
901
848
|
const rangeValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[1]) : defaultRange;
|
|
849
|
+
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
902
850
|
var _input_layout_height;
|
|
903
851
|
return {
|
|
904
852
|
data: [
|
|
@@ -908,17 +856,16 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
|
|
|
908
856
|
rangeValuesForColorScale,
|
|
909
857
|
hideLegend: true,
|
|
910
858
|
showYAxisLables: true,
|
|
859
|
+
chartTitle,
|
|
860
|
+
xAxisTitle,
|
|
861
|
+
yAxisTitle,
|
|
911
862
|
sortOrder: 'none',
|
|
912
863
|
width: (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.width,
|
|
913
864
|
height: (_input_layout_height = (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
|
|
914
865
|
hideTickOverlap: true,
|
|
915
866
|
noOfCharsToTruncate: 20,
|
|
916
867
|
showYAxisLablesTooltip: true,
|
|
917
|
-
wrapXAxisLables: true
|
|
918
|
-
...getTitles(input.layout),
|
|
919
|
-
...getAxisCategoryOrderProps([
|
|
920
|
-
firstData
|
|
921
|
-
], input.layout)
|
|
868
|
+
wrapXAxisLables: true
|
|
922
869
|
};
|
|
923
870
|
};
|
|
924
871
|
const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
@@ -1386,44 +1333,25 @@ const getLegendShape = (series)=>{
|
|
|
1386
1333
|
}
|
|
1387
1334
|
return 'default';
|
|
1388
1335
|
};
|
|
1389
|
-
const getAllupLegendsProps = (input, colorMap, colorwayType,
|
|
1336
|
+
const getAllupLegendsProps = (input, colorMap, colorwayType, isDarkTheme)=>{
|
|
1390
1337
|
const allupLegends = [];
|
|
1391
1338
|
// reduce on showlegend boolean propperty. reduce should return true if at least one series has showlegend true
|
|
1392
1339
|
const toShowLegend = input.data.reduce((acc, series)=>{
|
|
1393
|
-
return acc || series.showlegend === true
|
|
1340
|
+
return acc || series.showlegend === true;
|
|
1394
1341
|
}, false);
|
|
1395
1342
|
if (toShowLegend) {
|
|
1396
1343
|
input.data.forEach((series, index)=>{
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
allupLegends.push({
|
|
1408
|
-
title: legend,
|
|
1409
|
-
color
|
|
1410
|
-
});
|
|
1411
|
-
}
|
|
1344
|
+
var _series_line, _series_marker, _input_layout_template_layout, _input_layout_template, _input_layout;
|
|
1345
|
+
const name = series.legendgroup;
|
|
1346
|
+
const color = ((_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);
|
|
1347
|
+
const legendShape = getLegendShape(series);
|
|
1348
|
+
const resolvedColor = (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, color, colorMap, isDarkTheme);
|
|
1349
|
+
if (name !== undefined && allupLegends.some((group)=>group.title === name) === false) {
|
|
1350
|
+
allupLegends.push({
|
|
1351
|
+
title: name,
|
|
1352
|
+
color: resolvedColor,
|
|
1353
|
+
shape: legendShape
|
|
1412
1354
|
});
|
|
1413
|
-
} else if (isNonPlotType(traceInfo[index].type) === false) {
|
|
1414
|
-
var _plotSeries_line, _plotSeries_marker, _input_layout_template_layout1, _input_layout_template1, _input_layout3;
|
|
1415
|
-
const plotSeries = series;
|
|
1416
|
-
const name = plotSeries.legendgroup;
|
|
1417
|
-
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);
|
|
1418
|
-
const legendShape = getLegendShape(plotSeries);
|
|
1419
|
-
const resolvedColor = (0, _PlotlyColorAdapter.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);
|
|
1420
|
-
if (name !== undefined && name !== '' && allupLegends.some((group)=>group.title === name) === false) {
|
|
1421
|
-
allupLegends.push({
|
|
1422
|
-
title: name,
|
|
1423
|
-
color: resolvedColor,
|
|
1424
|
-
shape: legendShape
|
|
1425
|
-
});
|
|
1426
|
-
}
|
|
1427
1355
|
}
|
|
1428
1356
|
});
|
|
1429
1357
|
}
|
|
@@ -1489,21 +1417,28 @@ const getIndexFromKey = (key, pattern)=>{
|
|
|
1489
1417
|
const normalizedKey = key.replace(pattern, '') === '' ? '1' : key.replace(pattern, '');
|
|
1490
1418
|
return parseInt(normalizedKey, 10) - 1;
|
|
1491
1419
|
};
|
|
1492
|
-
const
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
'pie'
|
|
1497
|
-
].includes(chartType);
|
|
1498
|
-
};
|
|
1499
|
-
const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
1500
|
-
const domainX = [];
|
|
1501
|
-
const domainY = [];
|
|
1502
|
-
let cartesianDomains = 0;
|
|
1420
|
+
const getGridProperties = (layout, isMultiPlot)=>{
|
|
1421
|
+
var _layout_annotations;
|
|
1422
|
+
const gridX = [];
|
|
1423
|
+
const gridY = [];
|
|
1503
1424
|
const annotations = {};
|
|
1504
1425
|
let templateRows = '1fr';
|
|
1505
1426
|
let templateColumns = '1fr';
|
|
1506
1427
|
const gridLayout = {};
|
|
1428
|
+
if (layout === undefined || layout === null || Object.keys(layout).length === 0) {
|
|
1429
|
+
return {
|
|
1430
|
+
templateRows,
|
|
1431
|
+
templateColumns,
|
|
1432
|
+
layout: gridLayout
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
if (!layout.xaxis || !layout.yaxis) {
|
|
1436
|
+
return {
|
|
1437
|
+
templateRows,
|
|
1438
|
+
templateColumns,
|
|
1439
|
+
layout: gridLayout
|
|
1440
|
+
};
|
|
1441
|
+
}
|
|
1507
1442
|
if (!isMultiPlot) {
|
|
1508
1443
|
return {
|
|
1509
1444
|
templateRows,
|
|
@@ -1511,182 +1446,143 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
1511
1446
|
layout: gridLayout
|
|
1512
1447
|
};
|
|
1513
1448
|
}
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
var
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
if (index === 1 && anchorIndex === 0 || ((_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.side) === 'right') {
|
|
1541
|
-
// Special case for secondary y axis where yaxis2 can anchor to x1
|
|
1542
|
-
return {
|
|
1543
|
-
templateRows,
|
|
1544
|
-
templateColumns
|
|
1545
|
-
};
|
|
1546
|
-
}
|
|
1547
|
-
throw new Error(`Invalid layout: yaxis ${index + 1} anchor should be x${anchorIndex + 1}`);
|
|
1449
|
+
Object.keys(layout).forEach((key)=>{
|
|
1450
|
+
if (key.startsWith('xaxis')) {
|
|
1451
|
+
var _layout_key, _layout_key1;
|
|
1452
|
+
const index = getIndexFromKey(key, 'xaxis');
|
|
1453
|
+
var _layout_key_anchor;
|
|
1454
|
+
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';
|
|
1455
|
+
const anchorIndex = getIndexFromKey(anchor, 'y');
|
|
1456
|
+
if (index !== anchorIndex) {
|
|
1457
|
+
throw new Error(`Invalid layout: xaxis ${index + 1} anchor should be y${anchorIndex + 1}`);
|
|
1458
|
+
}
|
|
1459
|
+
var _layout_key_domain;
|
|
1460
|
+
gridX[index] = (_layout_key_domain = (_layout_key1 = layout[key]) === null || _layout_key1 === void 0 ? void 0 : _layout_key1.domain) !== null && _layout_key_domain !== void 0 ? _layout_key_domain : [];
|
|
1461
|
+
} else if (key.startsWith('yaxis')) {
|
|
1462
|
+
var _layout_key2, _layout_key3;
|
|
1463
|
+
const index = getIndexFromKey(key, 'yaxis');
|
|
1464
|
+
var _layout_key_anchor1;
|
|
1465
|
+
const anchor = (_layout_key_anchor1 = (_layout_key2 = layout[key]) === null || _layout_key2 === void 0 ? void 0 : _layout_key2.anchor) !== null && _layout_key_anchor1 !== void 0 ? _layout_key_anchor1 : 'x';
|
|
1466
|
+
const anchorIndex = getIndexFromKey(anchor, 'x');
|
|
1467
|
+
if (index !== anchorIndex) {
|
|
1468
|
+
var _layout_yaxis2;
|
|
1469
|
+
if (index === 1 && anchorIndex === 0 || ((_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.side) === 'right') {
|
|
1470
|
+
// Special case for secondary y axis where yaxis2 can anchor to x1
|
|
1471
|
+
return {
|
|
1472
|
+
templateRows,
|
|
1473
|
+
templateColumns
|
|
1474
|
+
};
|
|
1548
1475
|
}
|
|
1549
|
-
|
|
1550
|
-
const domainYInfo = {
|
|
1551
|
-
start: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[0] : 0,
|
|
1552
|
-
end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1
|
|
1553
|
-
};
|
|
1554
|
-
domainY.push(domainYInfo);
|
|
1476
|
+
throw new Error(`Invalid layout: yaxis ${index + 1} anchor should be x${anchorIndex + 1}`);
|
|
1555
1477
|
}
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
cartesianDomains = domainX.length; // Assuming that the number of x and y axes is the same
|
|
1559
|
-
validTracesInfo.forEach((trace, index)=>{
|
|
1560
|
-
if (isNonPlotType(trace.type)) {
|
|
1561
|
-
var _schema_data, _series_domain, _series_domain1, _series_domain2, _series_domain3;
|
|
1562
|
-
const series = schema === null || schema === void 0 ? void 0 : (_schema_data = schema.data) === null || _schema_data === void 0 ? void 0 : _schema_data[index];
|
|
1563
|
-
const domainXInfo = {
|
|
1564
|
-
start: ((_series_domain = series.domain) === null || _series_domain === void 0 ? void 0 : _series_domain.x) ? series.domain.x[0] : 0,
|
|
1565
|
-
end: ((_series_domain1 = series.domain) === null || _series_domain1 === void 0 ? void 0 : _series_domain1.x) ? series.domain.x[1] : 1
|
|
1566
|
-
};
|
|
1567
|
-
const domainYInfo = {
|
|
1568
|
-
start: ((_series_domain2 = series.domain) === null || _series_domain2 === void 0 ? void 0 : _series_domain2.y) ? series.domain.y[0] : 0,
|
|
1569
|
-
end: ((_series_domain3 = series.domain) === null || _series_domain3 === void 0 ? void 0 : _series_domain3.y) ? series.domain.y[1] : 1
|
|
1570
|
-
};
|
|
1571
|
-
domainX.push(domainXInfo);
|
|
1572
|
-
domainY.push(domainYInfo);
|
|
1478
|
+
var _layout_key_domain1;
|
|
1479
|
+
gridY[index] = (_layout_key_domain1 = (_layout_key3 = layout[key]) === null || _layout_key3 === void 0 ? void 0 : _layout_key3.domain) !== null && _layout_key_domain1 !== void 0 ? _layout_key_domain1 : [];
|
|
1573
1480
|
}
|
|
1574
1481
|
});
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
if (annotations[yMatch] === undefined) {
|
|
1584
|
-
annotations[yMatch] = {};
|
|
1585
|
-
}
|
|
1586
|
-
if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
|
|
1587
|
-
annotations[yMatch].yAnnotation = annotation.text;
|
|
1588
|
-
} else {
|
|
1589
|
-
annotations[yMatch].xAnnotation = annotation.text;
|
|
1590
|
-
}
|
|
1482
|
+
(_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
|
|
1483
|
+
const xMatches = gridX.flatMap((interval, idx)=>(annotation === null || annotation === void 0 ? void 0 : annotation.x) >= interval[0] && (annotation === null || annotation === void 0 ? void 0 : annotation.x) <= interval[1] ? [
|
|
1484
|
+
idx
|
|
1485
|
+
] : []);
|
|
1486
|
+
const yMatch = gridY.findIndex((interval, yIndex)=>xMatches.includes(yIndex) && (annotation === null || annotation === void 0 ? void 0 : annotation.y) >= interval[0] && (annotation === null || annotation === void 0 ? void 0 : annotation.y) <= interval[1]);
|
|
1487
|
+
if (yMatch !== -1) {
|
|
1488
|
+
if (annotations[yMatch] === undefined) {
|
|
1489
|
+
annotations[yMatch] = {};
|
|
1591
1490
|
}
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1491
|
+
if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
|
|
1492
|
+
annotations[yMatch].yAnnotation = annotation.text;
|
|
1493
|
+
} else {
|
|
1494
|
+
annotations[yMatch].xAnnotation = annotation.text;
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1498
|
+
if (gridX.length > 0) {
|
|
1595
1499
|
const uniqueXIntervals = new Map();
|
|
1596
|
-
|
|
1597
|
-
const key = `${interval
|
|
1500
|
+
gridX.forEach((interval)=>{
|
|
1501
|
+
const key = `${interval[0]}-${interval[1]}`;
|
|
1598
1502
|
if (!uniqueXIntervals.has(key)) {
|
|
1599
1503
|
uniqueXIntervals.set(key, interval);
|
|
1600
1504
|
}
|
|
1601
1505
|
});
|
|
1602
|
-
const
|
|
1603
|
-
templateColumns =
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1506
|
+
const minXInterval = Math.min(...Array.from(uniqueXIntervals.values()).map((interval)=>interval[1] - interval[0]));
|
|
1507
|
+
templateColumns = Array.from(uniqueXIntervals.values()).map((interval)=>`${(interval[1] - interval[0]) / minXInterval}fr`).join(' ');
|
|
1508
|
+
let columnNumber = 1;
|
|
1509
|
+
let lastIntervalEnd = 0;
|
|
1510
|
+
gridX.forEach((interval, index)=>{
|
|
1511
|
+
if (interval.length === 0) {
|
|
1512
|
+
return;
|
|
1513
|
+
}
|
|
1514
|
+
const cellName = `x${index === 0 ? '' : index + 1}`;
|
|
1608
1515
|
const annotationProps = annotations[index];
|
|
1609
1516
|
const xAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.xAnnotation;
|
|
1517
|
+
if (interval[0] < lastIntervalEnd) {
|
|
1518
|
+
columnNumber = 1;
|
|
1519
|
+
}
|
|
1520
|
+
lastIntervalEnd = interval[1];
|
|
1610
1521
|
const row = {
|
|
1611
1522
|
row: -1,
|
|
1612
1523
|
column: columnNumber,
|
|
1613
|
-
xAnnotation
|
|
1614
|
-
xDomain: interval,
|
|
1615
|
-
yDomain: {
|
|
1616
|
-
start: 0,
|
|
1617
|
-
end: 1
|
|
1618
|
-
}
|
|
1524
|
+
xAnnotation
|
|
1619
1525
|
};
|
|
1620
1526
|
gridLayout[cellName] = row;
|
|
1527
|
+
columnNumber += 1;
|
|
1621
1528
|
});
|
|
1622
1529
|
}
|
|
1623
|
-
|
|
1530
|
+
const numColumns = Math.max(...Object.values(gridLayout).map((cell)=>{
|
|
1531
|
+
var _cell_column;
|
|
1532
|
+
return (_cell_column = cell.column) !== null && _cell_column !== void 0 ? _cell_column : 0;
|
|
1533
|
+
}));
|
|
1534
|
+
const columnFill = {};
|
|
1535
|
+
for(let i = 1; i <= numColumns; i++){
|
|
1536
|
+
columnFill[i] = {
|
|
1537
|
+
row: 1,
|
|
1538
|
+
fillDomain: 0
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
if (gridY.length > 0) {
|
|
1624
1542
|
const uniqueYIntervals = new Map();
|
|
1625
|
-
|
|
1626
|
-
const key = `${interval
|
|
1543
|
+
gridY.forEach((interval)=>{
|
|
1544
|
+
const key = `${interval[0]}-${interval[1]}`;
|
|
1627
1545
|
if (!uniqueYIntervals.has(key)) {
|
|
1628
1546
|
uniqueYIntervals.set(key, interval);
|
|
1629
1547
|
}
|
|
1630
1548
|
});
|
|
1631
|
-
const
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
const
|
|
1549
|
+
const minYInterval = Math.min(...Array.from(uniqueYIntervals.values()).map((interval)=>interval[1] - interval[0]));
|
|
1550
|
+
templateRows = Array.from(uniqueYIntervals.values()).map((interval)=>`${(interval[1] - interval[0]) / minYInterval}fr`).join(' ');
|
|
1551
|
+
gridY.forEach((interval, index)=>{
|
|
1552
|
+
if (interval.length === 0) {
|
|
1553
|
+
return;
|
|
1554
|
+
}
|
|
1555
|
+
const cellName = `x${index === 0 ? '' : index + 1}`;
|
|
1638
1556
|
const annotationProps = annotations[index];
|
|
1639
1557
|
const yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
|
|
1640
1558
|
const cell = gridLayout[cellName];
|
|
1641
1559
|
if (cell !== undefined) {
|
|
1642
|
-
cell.row =
|
|
1560
|
+
cell.row = columnFill[cell.column].row;
|
|
1643
1561
|
cell.yAnnotation = yAnnotation;
|
|
1644
|
-
cell.yDomain = interval;
|
|
1645
1562
|
}
|
|
1563
|
+
columnFill[cell.column].fillDomain = interval[1];
|
|
1564
|
+
columnFill[cell.column].row += 1;
|
|
1646
1565
|
});
|
|
1647
1566
|
}
|
|
1567
|
+
// reverse the order of rows in grid layout from bottom-top to top-bottom as required by CSS grid
|
|
1568
|
+
const reversedGridLayout = {};
|
|
1569
|
+
// find the maximum row number
|
|
1570
|
+
const maxRowNumber = Math.max(...Object.values(gridLayout).map((cell)=>{
|
|
1571
|
+
var _cell_row;
|
|
1572
|
+
return (_cell_row = cell.row) !== null && _cell_row !== void 0 ? _cell_row : 0;
|
|
1573
|
+
}));
|
|
1574
|
+
// iterate over the gridLayout and reverse the row numbers
|
|
1575
|
+
Object.keys(gridLayout).forEach((key)=>{
|
|
1576
|
+
const cell = gridLayout[key];
|
|
1577
|
+
if (cell.row !== undefined) {
|
|
1578
|
+
// reverse the row number
|
|
1579
|
+
cell.row = maxRowNumber - cell.row + 1;
|
|
1580
|
+
}
|
|
1581
|
+
reversedGridLayout[key] = cell;
|
|
1582
|
+
});
|
|
1648
1583
|
return {
|
|
1649
1584
|
templateRows,
|
|
1650
1585
|
templateColumns,
|
|
1651
|
-
layout:
|
|
1586
|
+
layout: reversedGridLayout
|
|
1652
1587
|
};
|
|
1653
1588
|
};
|
|
1654
|
-
/**
|
|
1655
|
-
* @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/category_order_defaults.js#L50}
|
|
1656
|
-
*/ const getAxisCategoryOrderProps = (data, layout)=>{
|
|
1657
|
-
const result = {};
|
|
1658
|
-
const axesById = {
|
|
1659
|
-
x: layout === null || layout === void 0 ? void 0 : layout.xaxis,
|
|
1660
|
-
y: layout === null || layout === void 0 ? void 0 : layout.yaxis
|
|
1661
|
-
};
|
|
1662
|
-
Object.keys(axesById).forEach((axId)=>{
|
|
1663
|
-
const ax = axesById[axId];
|
|
1664
|
-
const axLetter = axId[0];
|
|
1665
|
-
const propName = `${axLetter}AxisCategoryOrder`;
|
|
1666
|
-
const values = [];
|
|
1667
|
-
data.forEach((series)=>{
|
|
1668
|
-
var _series_axLetter;
|
|
1669
|
-
(_series_axLetter = series[axLetter]) === null || _series_axLetter === void 0 ? void 0 : _series_axLetter.forEach((val)=>{
|
|
1670
|
-
if (!(0, _chartutilities.isInvalidValue)(val)) {
|
|
1671
|
-
values.push(val);
|
|
1672
|
-
}
|
|
1673
|
-
});
|
|
1674
|
-
});
|
|
1675
|
-
const isAxisTypeCategory = (ax === null || ax === void 0 ? void 0 : ax.type) === 'category' || (0, _chartutilities.isStringArray)(values) && !(0, _chartutilities.isNumberArray)(values) && !(0, _chartutilities.isDateArray)(values);
|
|
1676
|
-
if (!isAxisTypeCategory) {
|
|
1677
|
-
return;
|
|
1678
|
-
}
|
|
1679
|
-
const isValidArray = (0, _chartutilities.isArrayOrTypedArray)(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
|
|
1680
|
-
if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
|
|
1681
|
-
result[propName] = ax.categoryarray;
|
|
1682
|
-
return;
|
|
1683
|
-
}
|
|
1684
|
-
if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
|
|
1685
|
-
const categoriesInTraceOrder = Array.from(new Set(values));
|
|
1686
|
-
result[propName] = categoriesInTraceOrder;
|
|
1687
|
-
return;
|
|
1688
|
-
}
|
|
1689
|
-
result[propName] = ax.categoryorder;
|
|
1690
|
-
});
|
|
1691
|
-
return result;
|
|
1692
|
-
};
|