@fluentui/react-charts 0.0.0-nightly-20251016-0409.1 → 0.0.0-nightly-20251017-2337.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/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +88 -50
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/Legends/Legends.js +1 -1
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +88 -50
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.js +1 -1
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-charts
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 17 Oct 2025 23:52:08 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [0.0.0-nightly-
|
|
7
|
+
## [0.0.0-nightly-20251017-2337.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v0.0.0-nightly-20251017-2337.1)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.3.2..@fluentui/react-charts_v0.0.0-nightly-
|
|
9
|
+
Fri, 17 Oct 2025 23:52:08 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.3.2..@fluentui/react-charts_v0.0.0-nightly-20251017-2337.1)
|
|
11
11
|
|
|
12
12
|
### Changes
|
|
13
13
|
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
|
15
|
-
- Bump @fluentui/react-button to v0.0.0-nightly-
|
|
16
|
-
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-
|
|
17
|
-
- Bump @fluentui/react-overflow to v0.0.0-nightly-
|
|
18
|
-
- Bump @fluentui/react-popover to v0.0.0-nightly-
|
|
19
|
-
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-
|
|
20
|
-
- Bump @fluentui/react-tabster to v0.0.0-nightly-
|
|
21
|
-
- Bump @fluentui/react-theme to v0.0.0-nightly-
|
|
22
|
-
- Bump @fluentui/react-tooltip to v0.0.0-nightly-
|
|
23
|
-
- Bump @fluentui/react-utilities to v0.0.0-nightly-
|
|
24
|
-
- Bump @fluentui/react-conformance to v0.0.0-nightly-
|
|
25
|
-
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
|
15
|
+
- Bump @fluentui/react-button to v0.0.0-nightly-20251017-2337.1 ([commit](https://github.com/microsoft/fluentui/commit/af8451522711c0f14434675cb846501aa5f5671e) by beachball)
|
|
16
|
+
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20251017-2337.1 ([commit](https://github.com/microsoft/fluentui/commit/af8451522711c0f14434675cb846501aa5f5671e) by beachball)
|
|
17
|
+
- Bump @fluentui/react-overflow to v0.0.0-nightly-20251017-2337.1 ([commit](https://github.com/microsoft/fluentui/commit/af8451522711c0f14434675cb846501aa5f5671e) by beachball)
|
|
18
|
+
- Bump @fluentui/react-popover to v0.0.0-nightly-20251017-2337.1 ([commit](https://github.com/microsoft/fluentui/commit/af8451522711c0f14434675cb846501aa5f5671e) by beachball)
|
|
19
|
+
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20251017-2337.1 ([commit](https://github.com/microsoft/fluentui/commit/af8451522711c0f14434675cb846501aa5f5671e) by beachball)
|
|
20
|
+
- Bump @fluentui/react-tabster to v0.0.0-nightly-20251017-2337.1 ([commit](https://github.com/microsoft/fluentui/commit/af8451522711c0f14434675cb846501aa5f5671e) by beachball)
|
|
21
|
+
- Bump @fluentui/react-theme to v0.0.0-nightly-20251017-2337.1 ([commit](https://github.com/microsoft/fluentui/commit/af8451522711c0f14434675cb846501aa5f5671e) by beachball)
|
|
22
|
+
- Bump @fluentui/react-tooltip to v0.0.0-nightly-20251017-2337.1 ([commit](https://github.com/microsoft/fluentui/commit/af8451522711c0f14434675cb846501aa5f5671e) by beachball)
|
|
23
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20251017-2337.1 ([commit](https://github.com/microsoft/fluentui/commit/af8451522711c0f14434675cb846501aa5f5671e) by beachball)
|
|
24
|
+
- Bump @fluentui/react-conformance to v0.0.0-nightly-20251017-2337.1 ([commit](https://github.com/microsoft/fluentui/commit/af8451522711c0f14434675cb846501aa5f5671e) by beachball)
|
|
25
|
+
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20251017-2337.1 ([commit](https://github.com/microsoft/fluentui/commit/af8451522711c0f14434675cb846501aa5f5671e) by beachball)
|
|
26
26
|
|
|
27
27
|
## [9.3.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.3.2)
|
|
28
28
|
|
|
@@ -412,24 +412,20 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
|
|
|
412
412
|
var _input_data_, _input_layout, _input_layout1, _input_layout2, _vsbcData_;
|
|
413
413
|
const mapXToDataPoints = {};
|
|
414
414
|
let yMaxValue = 0;
|
|
415
|
+
let yMinValue = 0;
|
|
415
416
|
const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
|
|
416
417
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
417
418
|
let colorScale = undefined;
|
|
418
419
|
const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
419
|
-
|
|
420
|
+
const resolveXAxisValue = getAxisValueResolver(input.data, input.layout, 'x');
|
|
420
421
|
input.data.forEach((series, index1)=>{
|
|
421
422
|
var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_line;
|
|
422
423
|
colorScale = createColorScale(input.layout, series, colorScale);
|
|
423
|
-
const isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis
|
|
424
424
|
// extract bar colors for each series only once
|
|
425
425
|
const extractedBarColors = 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);
|
|
426
426
|
// extract line colors for each series only once
|
|
427
427
|
const extractedLineColors = 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);
|
|
428
|
-
const
|
|
429
|
-
const isXDate = isDateArray(xValues);
|
|
430
|
-
const isXString = isStringArray(xValues);
|
|
431
|
-
const isXNumber = isNumberArray(xValues);
|
|
432
|
-
const validXYRanges = getValidXYRanges(series);
|
|
428
|
+
const validXYRanges = getValidXYRanges(series, resolveXAxisValue);
|
|
433
429
|
validXYRanges.forEach(([rangeStart, rangeEnd], rangeIdx)=>{
|
|
434
430
|
const rangeXValues = series.x.slice(rangeStart, rangeEnd);
|
|
435
431
|
const rangeYValues = series.y.slice(rangeStart, rangeEnd);
|
|
@@ -437,7 +433,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
|
|
|
437
433
|
var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
|
|
438
434
|
if (!mapXToDataPoints[x]) {
|
|
439
435
|
mapXToDataPoints[x] = {
|
|
440
|
-
xAxisPoint:
|
|
436
|
+
xAxisPoint: resolveXAxisValue(x),
|
|
441
437
|
chartData: [],
|
|
442
438
|
lineData: []
|
|
443
439
|
};
|
|
@@ -706,8 +702,9 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
|
|
|
706
702
|
const xValues = [];
|
|
707
703
|
const yValues = [];
|
|
708
704
|
series.x.forEach((xVal, index)=>{
|
|
709
|
-
|
|
710
|
-
|
|
705
|
+
var _getNumberAtIndexOrDefault;
|
|
706
|
+
const yVal = (_getNumberAtIndexOrDefault = getNumberAtIndexOrDefault(series.y, index)) !== null && _getNumberAtIndexOrDefault !== void 0 ? _getNumberAtIndexOrDefault : 0;
|
|
707
|
+
if (isInvalidValue(xVal)) {
|
|
711
708
|
return;
|
|
712
709
|
}
|
|
713
710
|
xValues.push(xVal);
|
|
@@ -794,18 +791,14 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
794
791
|
let mode = 'tonexty';
|
|
795
792
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
796
793
|
const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
797
|
-
|
|
794
|
+
const resolveXAxisValue = getAxisValueResolver(input.data, input.layout, 'x');
|
|
795
|
+
const shouldWrapLabels = getAxisType(input.data, input.layout, 'x') === 'category';
|
|
798
796
|
const chartData = input.data.map((series, index)=>{
|
|
799
797
|
var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_mode1;
|
|
800
798
|
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;
|
|
801
799
|
// extract colors for each series only once
|
|
802
800
|
const extractedColors = 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);
|
|
803
801
|
const xValues = series.x;
|
|
804
|
-
const isXString = isStringArray(xValues);
|
|
805
|
-
const isXDate = isDateArray(xValues);
|
|
806
|
-
const isXNumber = isNumberArray(xValues);
|
|
807
|
-
const isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis
|
|
808
|
-
shouldWrapLabels = shouldWrapLabels || isXString && !isXDate;
|
|
809
802
|
const legend = legends[index];
|
|
810
803
|
// resolve color for each legend's lines from the extracted colors
|
|
811
804
|
const seriesColor = resolveColor(extractedColors, index, legend, colorMap, (_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, isDarkTheme);
|
|
@@ -814,7 +807,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
814
807
|
// if mode contains 'text', we prioritize showing the text over curving the line
|
|
815
808
|
const lineOptions = !((_series_mode1 = series.mode) === null || _series_mode1 === void 0 ? void 0 : _series_mode1.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
|
|
816
809
|
const legendShape = getLegendShape(series);
|
|
817
|
-
const validXYRanges = getValidXYRanges(series);
|
|
810
|
+
const validXYRanges = getValidXYRanges(series, resolveXAxisValue);
|
|
818
811
|
return validXYRanges.map(([rangeStart, rangeEnd], rangeIdx)=>{
|
|
819
812
|
var _series_marker, _series_marker1, _series_marker2, _input_layout, _input_layout_polar_angularaxis, _input_layout_polar, _input_layout1, _input_layout_polar_angularaxis1, _input_layout_polar1, _input_layout2;
|
|
820
813
|
const rangeXValues = xValues.slice(rangeStart, rangeEnd);
|
|
@@ -829,7 +822,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
829
822
|
data: rangeXValues.map((x, i)=>{
|
|
830
823
|
var _series_marker, _series_marker1;
|
|
831
824
|
return {
|
|
832
|
-
x:
|
|
825
|
+
x: resolveXAxisValue(x),
|
|
833
826
|
y: rangeYValues[i],
|
|
834
827
|
...Array.isArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? {
|
|
835
828
|
markerSize: markerSizes[i]
|
|
@@ -950,8 +943,8 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPl
|
|
|
950
943
|
const extractedColors = 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);
|
|
951
944
|
const legend = legends[index];
|
|
952
945
|
return series.y.map((yValue, i)=>{
|
|
953
|
-
var
|
|
954
|
-
if (isInvalidValue(
|
|
946
|
+
var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_x;
|
|
947
|
+
if (isInvalidValue(yValue)) {
|
|
955
948
|
return null;
|
|
956
949
|
}
|
|
957
950
|
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
@@ -959,7 +952,7 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPl
|
|
|
959
952
|
const opacity = getOpacity(series, i);
|
|
960
953
|
var _rgb_copy_formatHex8;
|
|
961
954
|
return {
|
|
962
|
-
x: series.x[i],
|
|
955
|
+
x: isInvalidValue((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]) ? 0 : series.x[i],
|
|
963
956
|
y: yValue,
|
|
964
957
|
legend,
|
|
965
958
|
color: (_rgb_copy_formatHex8 = rgb(color).copy({
|
|
@@ -1001,13 +994,13 @@ export const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMa
|
|
|
1001
994
|
var _input_layout, _input_layout1;
|
|
1002
995
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
1003
996
|
let colorScale = undefined;
|
|
997
|
+
const isXDate = getAxisType(input.data, input.layout, 'x') === 'date';
|
|
1004
998
|
const chartData = input.data.map((series, index)=>{
|
|
1005
|
-
var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker
|
|
999
|
+
var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker;
|
|
1006
1000
|
colorScale = createColorScale(input.layout, series, colorScale);
|
|
1007
1001
|
// extract colors for each series only once
|
|
1008
1002
|
const extractedColors = 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);
|
|
1009
1003
|
const legend = legends[index];
|
|
1010
|
-
const isXDate = ((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_xaxis = _input_layout1.xaxis) === null || _input_layout_xaxis === void 0 ? void 0 : _input_layout_xaxis.type) === 'date' || isDateArray(series.x);
|
|
1011
1004
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1012
1005
|
const convertXValueToNumber = (value)=>{
|
|
1013
1006
|
return isInvalidValue(value) ? 0 : isXDate ? +parseLocalDate(value) : +value;
|
|
@@ -1067,8 +1060,9 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
|
|
|
1067
1060
|
const zValues = [];
|
|
1068
1061
|
(_firstData_x = firstData.x) === null || _firstData_x === void 0 ? void 0 : _firstData_x.forEach((xVal, index)=>{
|
|
1069
1062
|
var _firstData_y;
|
|
1070
|
-
|
|
1071
|
-
|
|
1063
|
+
var _getNumberAtIndexOrDefault;
|
|
1064
|
+
const zVal = (_getNumberAtIndexOrDefault = getNumberAtIndexOrDefault(firstData.z, index)) !== null && _getNumberAtIndexOrDefault !== void 0 ? _getNumberAtIndexOrDefault : 0;
|
|
1065
|
+
if (isInvalidValue(xVal) || isInvalidValue((_firstData_y = firstData.y) === null || _firstData_y === void 0 ? void 0 : _firstData_y[index])) {
|
|
1072
1066
|
return;
|
|
1073
1067
|
}
|
|
1074
1068
|
xValues.push(xVal);
|
|
@@ -1989,7 +1983,7 @@ export const getNumberAtIndexOrDefault = (data, index)=>{
|
|
|
1989
1983
|
}
|
|
1990
1984
|
return 1;
|
|
1991
1985
|
};
|
|
1992
|
-
export const getValidXYRanges = (series)=>{
|
|
1986
|
+
export const getValidXYRanges = (series, resolveX, resolveY)=>{
|
|
1993
1987
|
if (!isArrayOrTypedArray(series.x) || !isArrayOrTypedArray(series.y)) {
|
|
1994
1988
|
return [];
|
|
1995
1989
|
}
|
|
@@ -1997,7 +1991,7 @@ export const getValidXYRanges = (series)=>{
|
|
|
1997
1991
|
let start = 0;
|
|
1998
1992
|
let end = 0;
|
|
1999
1993
|
for(; end < series.x.length; end++){
|
|
2000
|
-
if (isInvalidValue(series.x[end]) || isInvalidValue(series.y[end])) {
|
|
1994
|
+
if (isInvalidValue(series.x[end]) || typeof resolveX === 'function' && isInvalidValue(resolveX(series.x[end])) || isInvalidValue(series.y[end]) || typeof resolveY === 'function' && isInvalidValue(resolveY(series.y[end]))) {
|
|
2001
1995
|
if (end - start > 0) {
|
|
2002
1996
|
ranges.push([
|
|
2003
1997
|
start,
|
|
@@ -2285,7 +2279,7 @@ const getAxisScaleTypeProps = (data, layout)=>{
|
|
|
2285
2279
|
if (!ax) {
|
|
2286
2280
|
return;
|
|
2287
2281
|
}
|
|
2288
|
-
const axType = getAxisType(data,
|
|
2282
|
+
const axType = getAxisType(data, ax);
|
|
2289
2283
|
if ((!ax.tickmode || ax.tickmode === 'array') && isArrayOrTypedArray(ax.tickvals)) {
|
|
2290
2284
|
const tickValues = axType === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
|
|
2291
2285
|
if (axId === 'x') {
|
|
@@ -2301,12 +2295,12 @@ const getAxisScaleTypeProps = (data, layout)=>{
|
|
|
2301
2295
|
if (axId === 'x') {
|
|
2302
2296
|
props.xAxis = {
|
|
2303
2297
|
tickStep: dtick,
|
|
2304
|
-
tick0
|
|
2298
|
+
tick0
|
|
2305
2299
|
};
|
|
2306
2300
|
} else if (axId === 'y') {
|
|
2307
2301
|
props.yAxis = {
|
|
2308
2302
|
tickStep: dtick,
|
|
2309
|
-
tick0
|
|
2303
|
+
tick0
|
|
2310
2304
|
};
|
|
2311
2305
|
}
|
|
2312
2306
|
return;
|
|
@@ -2383,44 +2377,88 @@ const getAxisObjects = (data, layout)=>{
|
|
|
2383
2377
|
xAxisId = axisIds.x;
|
|
2384
2378
|
yAxisIds.add(axisIds.y);
|
|
2385
2379
|
});
|
|
2380
|
+
const makeAxisObject = (axLetter, axId)=>({
|
|
2381
|
+
...layout === null || layout === void 0 ? void 0 : layout[getAxisKey(axLetter, axId)],
|
|
2382
|
+
_id: `${axLetter}${axId > 1 ? axId : ''}`
|
|
2383
|
+
});
|
|
2386
2384
|
const axisObjects = {};
|
|
2387
2385
|
if (typeof xAxisId === 'number') {
|
|
2388
|
-
axisObjects.x =
|
|
2386
|
+
axisObjects.x = makeAxisObject('x', xAxisId);
|
|
2389
2387
|
}
|
|
2390
2388
|
const sortedYAxisIds = Array.from(yAxisIds).sort();
|
|
2391
2389
|
if (sortedYAxisIds.length > 0) {
|
|
2392
|
-
axisObjects.y =
|
|
2390
|
+
axisObjects.y = makeAxisObject('y', sortedYAxisIds[0]);
|
|
2393
2391
|
}
|
|
2394
2392
|
if (sortedYAxisIds.length > 1) {
|
|
2395
|
-
axisObjects.y2 =
|
|
2393
|
+
axisObjects.y2 = makeAxisObject('y', sortedYAxisIds[1]);
|
|
2396
2394
|
}
|
|
2397
2395
|
return axisObjects;
|
|
2398
2396
|
};
|
|
2399
|
-
|
|
2397
|
+
function getAxisType(data, arg2, arg3) {
|
|
2398
|
+
let ax;
|
|
2399
|
+
if (arg2 && typeof arg2 === 'object' && '_id' in arg2) {
|
|
2400
|
+
ax = arg2;
|
|
2401
|
+
} else if (typeof arg3 === 'string') {
|
|
2402
|
+
const layout = arg2;
|
|
2403
|
+
ax = getAxisObjects(data, layout)[arg3];
|
|
2404
|
+
}
|
|
2405
|
+
if (!ax) {
|
|
2406
|
+
return 'category';
|
|
2407
|
+
}
|
|
2408
|
+
var _ax_type;
|
|
2409
|
+
if ([
|
|
2410
|
+
'linear',
|
|
2411
|
+
'log',
|
|
2412
|
+
'date',
|
|
2413
|
+
'category'
|
|
2414
|
+
].includes((_ax_type = ax.type) !== null && _ax_type !== void 0 ? _ax_type : '')) {
|
|
2415
|
+
return ax.type;
|
|
2416
|
+
}
|
|
2417
|
+
const axLetter = ax._id[0];
|
|
2400
2418
|
const values = [];
|
|
2401
2419
|
data.forEach((series)=>{
|
|
2402
|
-
|
|
2403
|
-
(
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
// Therefore, simply checking the type of the values may not be sufficient. At the moment,
|
|
2411
|
-
// we don’t always perform this casting ourselves and instead use the values as provided.
|
|
2412
|
-
if (isNumberArray(values)) {
|
|
2413
|
-
if ((ax === null || ax === void 0 ? void 0 : ax.type) === 'log') {
|
|
2414
|
-
return 'log';
|
|
2420
|
+
const axId = series[`${axLetter}axis`];
|
|
2421
|
+
if (axId === ax._id || !axId && ax._id === axLetter) {
|
|
2422
|
+
var _series_axLetter;
|
|
2423
|
+
(_series_axLetter = series[axLetter]) === null || _series_axLetter === void 0 ? void 0 : _series_axLetter.forEach((val)=>{
|
|
2424
|
+
if (!isInvalidValue(val)) {
|
|
2425
|
+
values.push(val);
|
|
2426
|
+
}
|
|
2427
|
+
});
|
|
2415
2428
|
}
|
|
2429
|
+
});
|
|
2430
|
+
if (isNumberArray(values) && !isYearArray(values)) {
|
|
2416
2431
|
return 'linear';
|
|
2417
2432
|
}
|
|
2418
2433
|
if (isDateArray(values)) {
|
|
2419
2434
|
return 'date';
|
|
2420
2435
|
}
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2436
|
+
return 'category';
|
|
2437
|
+
}
|
|
2438
|
+
const getAxisValueResolver = (data, layout, axisId)=>{
|
|
2439
|
+
const axType = getAxisType(data, layout, axisId);
|
|
2440
|
+
return (value)=>{
|
|
2441
|
+
if (isInvalidValue(value)) {
|
|
2442
|
+
return null;
|
|
2443
|
+
}
|
|
2444
|
+
switch(axType){
|
|
2445
|
+
case 'linear':
|
|
2446
|
+
case 'log':
|
|
2447
|
+
return isNumber(value) ? +value : null;
|
|
2448
|
+
case 'date':
|
|
2449
|
+
if (isNumber(value)) {
|
|
2450
|
+
return new Date(+value);
|
|
2451
|
+
}
|
|
2452
|
+
if (typeof value === 'string') {
|
|
2453
|
+
return new Date(value);
|
|
2454
|
+
}
|
|
2455
|
+
return null;
|
|
2456
|
+
case 'category':
|
|
2457
|
+
return `${value}`;
|
|
2458
|
+
default:
|
|
2459
|
+
return null;
|
|
2460
|
+
}
|
|
2461
|
+
};
|
|
2424
2462
|
};
|
|
2425
2463
|
/**
|
|
2426
2464
|
* This is experimental. Use it only with valid datetime strings to verify if they conform to the ISO 8601 format.
|