@fluentui/react-charting 5.24.35 → 5.24.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +55 -1
- package/CHANGELOG.md +24 -2
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +107 -53
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +107 -53
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +107 -53
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/package.json +5 -5
|
@@ -71,7 +71,7 @@ export declare const projectPolarToCartesian: (input: PlotlySchema) => PlotlySch
|
|
|
71
71
|
export declare function findArrayAttributes(trace: any): void;
|
|
72
72
|
export declare const getAllupLegendsProps: (input: PlotlySchema, colorMap: React.MutableRefObject<Map<string, string>>, colorwayType: ColorwayType, traceInfo: TraceInfo[], isDarkTheme?: boolean) => ILegendsProps;
|
|
73
73
|
export declare const getNumberAtIndexOrDefault: (data: PlotData["z"] | undefined, index: number) => number | undefined;
|
|
74
|
-
export declare const getValidXYRanges: (series: Partial<PlotData
|
|
74
|
+
export declare const getValidXYRanges: (series: Partial<PlotData>, resolveX?: (v: Datum) => Datum, resolveY?: (v: Datum) => Datum) => [number, number][];
|
|
75
75
|
export declare const isNonPlotType: (chartType: string) => boolean;
|
|
76
76
|
export declare const getGridProperties: (schema: PlotlySchema | undefined, isMultiPlot: boolean, validTracesInfo: TraceInfo[]) => GridProperties;
|
|
77
77
|
export {};
|
|
@@ -426,19 +426,15 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
|
|
|
426
426
|
var _j = getLegendProps(input.data, input.layout, isMultiPlot), legends = _j.legends, hideLegend = _j.hideLegend;
|
|
427
427
|
var colorScale = undefined;
|
|
428
428
|
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
429
|
+
var resolveXAxisValue = getAxisValueResolver(input.data, input.layout, 'x');
|
|
429
430
|
input.data.forEach(function (series, index1) {
|
|
430
431
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
431
432
|
colorScale = (0, PlotlyColorAdapter_1.createColorScale)(input.layout, series, colorScale);
|
|
432
|
-
var isXYearCategory = (0, chart_utilities_1.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
|
|
433
433
|
// extract bar colors for each series only once
|
|
434
434
|
var extractedBarColors = (0, PlotlyColorAdapter_1.extractColor)((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
|
|
435
435
|
// extract line colors for each series only once
|
|
436
436
|
var extractedLineColors = (0, PlotlyColorAdapter_1.extractColor)((_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, colorwayType, (_h = series.line) === null || _h === void 0 ? void 0 : _h.color, colorMap, isDarkTheme);
|
|
437
|
-
var
|
|
438
|
-
var isXDate = (0, chart_utilities_1.isDateArray)(xValues);
|
|
439
|
-
var isXString = (0, chart_utilities_1.isStringArray)(xValues);
|
|
440
|
-
var isXNumber = (0, chart_utilities_1.isNumberArray)(xValues);
|
|
441
|
-
var validXYRanges = (0, exports.getValidXYRanges)(series);
|
|
437
|
+
var validXYRanges = (0, exports.getValidXYRanges)(series, resolveXAxisValue);
|
|
442
438
|
validXYRanges.forEach(function (_a, rangeIdx) {
|
|
443
439
|
var rangeStart = _a[0], rangeEnd = _a[1];
|
|
444
440
|
var rangeXValues = series.x.slice(rangeStart, rangeEnd);
|
|
@@ -447,7 +443,7 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
|
|
|
447
443
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
448
444
|
if (!mapXToDataPoints[x]) {
|
|
449
445
|
mapXToDataPoints[x] = {
|
|
450
|
-
xAxisPoint: (
|
|
446
|
+
xAxisPoint: resolveXAxisValue(x),
|
|
451
447
|
chartData: [],
|
|
452
448
|
lineData: [],
|
|
453
449
|
};
|
|
@@ -658,8 +654,9 @@ var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colo
|
|
|
658
654
|
var xValues = [];
|
|
659
655
|
var yValues = [];
|
|
660
656
|
series.x.forEach(function (xVal, index) {
|
|
661
|
-
var
|
|
662
|
-
|
|
657
|
+
var _a;
|
|
658
|
+
var yVal = (_a = (0, exports.getNumberAtIndexOrDefault)(series.y, index)) !== null && _a !== void 0 ? _a : 0;
|
|
659
|
+
if ((0, chart_utilities_1.isInvalidValue)(xVal)) {
|
|
663
660
|
return;
|
|
664
661
|
}
|
|
665
662
|
xValues.push(xVal);
|
|
@@ -713,8 +710,27 @@ var transformPlotlyJsonToScatterChartProps = function (input, isMultiPlot, color
|
|
|
713
710
|
return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
|
|
714
711
|
};
|
|
715
712
|
exports.transformPlotlyJsonToScatterChartProps = transformPlotlyJsonToScatterChartProps;
|
|
713
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
714
|
+
var mapColorFillBars = function (layout) {
|
|
715
|
+
if (!Array.isArray(layout === null || layout === void 0 ? void 0 : layout.shapes)) {
|
|
716
|
+
return [];
|
|
717
|
+
}
|
|
718
|
+
return layout.shapes
|
|
719
|
+
.filter(function (shape) { return shape.type === 'rect'; })
|
|
720
|
+
.map(function (shape) {
|
|
721
|
+
//colorFillbars doesn't support string dates or categories
|
|
722
|
+
if (typeof shape.x0 === 'string' || typeof shape.x1 === 'string') {
|
|
723
|
+
return null;
|
|
724
|
+
}
|
|
725
|
+
return {
|
|
726
|
+
color: shape.fillcolor,
|
|
727
|
+
data: [{ startX: shape.x0, endX: shape.x1 }],
|
|
728
|
+
applyPattern: false,
|
|
729
|
+
};
|
|
730
|
+
});
|
|
731
|
+
};
|
|
716
732
|
var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme) {
|
|
717
|
-
var _a, _b, _c, _d, _e, _f;
|
|
733
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
718
734
|
var isScatterMarkers = [
|
|
719
735
|
'text',
|
|
720
736
|
'markers',
|
|
@@ -729,9 +745,10 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
729
745
|
var isScatterChart = chartType === 'scatter';
|
|
730
746
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
|
|
731
747
|
var mode = 'tonexty';
|
|
732
|
-
var
|
|
748
|
+
var _h = getLegendProps(input.data, input.layout, isMultiPlot), legends = _h.legends, hideLegend = _h.hideLegend;
|
|
733
749
|
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
734
|
-
var
|
|
750
|
+
var resolveXAxisValue = getAxisValueResolver(input.data, input.layout, 'x');
|
|
751
|
+
var shouldWrapLabels = getAxisType(input.data, input.layout, 'x') === 'category';
|
|
735
752
|
var chartData = input.data
|
|
736
753
|
.map(function (series, index) {
|
|
737
754
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
@@ -743,11 +760,6 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
743
760
|
// extract colors for each series only once
|
|
744
761
|
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, colorwayType, colors, colorMap, isDarkTheme);
|
|
745
762
|
var xValues = series.x;
|
|
746
|
-
var isXString = (0, chart_utilities_1.isStringArray)(xValues);
|
|
747
|
-
var isXDate = (0, chart_utilities_1.isDateArray)(xValues);
|
|
748
|
-
var isXNumber = (0, chart_utilities_1.isNumberArray)(xValues);
|
|
749
|
-
var isXYearCategory = (0, chart_utilities_1.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
|
|
750
|
-
shouldWrapLabels = shouldWrapLabels || (isXString && !isXDate);
|
|
751
763
|
var legend = legends[index];
|
|
752
764
|
// resolve color for each legend's lines from the extracted colors
|
|
753
765
|
var seriesColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, (_k = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.layout) === null || _k === void 0 ? void 0 : _k.colorway, isDarkTheme);
|
|
@@ -756,7 +768,7 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
756
768
|
// if mode contains 'text', we prioritize showing the text over curving the line
|
|
757
769
|
var lineOptions = !((_l = series.mode) === null || _l === void 0 ? void 0 : _l.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
|
|
758
770
|
var legendShape = getLegendShape(series);
|
|
759
|
-
var validXYRanges = (0, exports.getValidXYRanges)(series);
|
|
771
|
+
var validXYRanges = (0, exports.getValidXYRanges)(series, resolveXAxisValue);
|
|
760
772
|
return validXYRanges.map(function (_a, rangeIdx) {
|
|
761
773
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
762
774
|
var rangeStart = _a[0], rangeEnd = _a[1];
|
|
@@ -776,7 +788,7 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
776
788
|
legendShape: legendShape,
|
|
777
789
|
data: rangeXValues.map(function (x, i) {
|
|
778
790
|
var _a, _b;
|
|
779
|
-
return (tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ x: (
|
|
791
|
+
return (tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ x: resolveXAxisValue(x), y: rangeYValues[i] }, (Array.isArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.size)
|
|
780
792
|
? { markerSize: markerSizes[i] }
|
|
781
793
|
: typeof ((_b = series.marker) === null || _b === void 0 ? void 0 : _b.size) === 'number'
|
|
782
794
|
? { markerSize: series.marker.size }
|
|
@@ -833,8 +845,10 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
833
845
|
return tslib_1.__assign({ data: chartProps, mode: mode }, commonProps);
|
|
834
846
|
}
|
|
835
847
|
else {
|
|
836
|
-
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: isScatterChart ? scatterChartProps : chartProps, roundedTicks: true, enableReflow: false }, commonProps), yMinMax), (isScatterChart
|
|
837
|
-
? tslib_1.__assign({ showYAxisLablesTooltip: true }, getAxisCategoryOrderProps(input.data, input.layout)) : {}))
|
|
848
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: isScatterChart ? scatterChartProps : chartProps, roundedTicks: true, enableReflow: false }, commonProps), yMinMax), (isScatterChart
|
|
849
|
+
? tslib_1.__assign({ showYAxisLablesTooltip: true }, getAxisCategoryOrderProps(input.data, input.layout)) : {})), (!isScatterChart && ((_g = mapColorFillBars(input.layout)) === null || _g === void 0 ? void 0 : _g.length)
|
|
850
|
+
? { colorFillBars: mapColorFillBars(input.layout) }
|
|
851
|
+
: {}));
|
|
838
852
|
}
|
|
839
853
|
};
|
|
840
854
|
var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -851,18 +865,18 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPl
|
|
|
851
865
|
return series.y
|
|
852
866
|
.map(function (yValue, i) {
|
|
853
867
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
854
|
-
if ((0, chart_utilities_1.isInvalidValue)(
|
|
868
|
+
if ((0, chart_utilities_1.isInvalidValue)(yValue)) {
|
|
855
869
|
return null;
|
|
856
870
|
}
|
|
857
871
|
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
858
872
|
var color = colorScale
|
|
859
|
-
? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((
|
|
860
|
-
? (
|
|
873
|
+
? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
|
|
874
|
+
? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[i % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
|
|
861
875
|
: 0)
|
|
862
|
-
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, (
|
|
876
|
+
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, (_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, isDarkTheme);
|
|
863
877
|
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
|
|
864
878
|
return {
|
|
865
|
-
x: series.x[i],
|
|
879
|
+
x: (0, chart_utilities_1.isInvalidValue)((_h = series.x) === null || _h === void 0 ? void 0 : _h[i]) ? 0 : series.x[i],
|
|
866
880
|
y: yValue,
|
|
867
881
|
legend: legend,
|
|
868
882
|
color: (_j = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color,
|
|
@@ -888,14 +902,14 @@ var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot, colorMa
|
|
|
888
902
|
var _a, _b, _c;
|
|
889
903
|
var _d = getLegendProps(input.data, input.layout, isMultiPlot), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
890
904
|
var colorScale = undefined;
|
|
905
|
+
var isXDate = getAxisType(input.data, input.layout, 'x') === 'date';
|
|
891
906
|
var chartData = input.data
|
|
892
907
|
.map(function (series, index) {
|
|
893
|
-
var _a, _b, _c, _d
|
|
908
|
+
var _a, _b, _c, _d;
|
|
894
909
|
colorScale = (0, PlotlyColorAdapter_1.createColorScale)(input.layout, series, colorScale);
|
|
895
910
|
// extract colors for each series only once
|
|
896
911
|
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
|
|
897
912
|
var legend = legends[index];
|
|
898
|
-
var isXDate = ((_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.xaxis) === null || _f === void 0 ? void 0 : _f.type) === 'date' || (0, chart_utilities_1.isDateArray)(series.x);
|
|
899
913
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
900
914
|
var convertXValueToNumber = function (value) {
|
|
901
915
|
return (0, chart_utilities_1.isInvalidValue)(value) ? 0 : isXDate ? +parseLocalDate(value) : +value;
|
|
@@ -942,9 +956,9 @@ var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap,
|
|
|
942
956
|
var yValues_1 = [];
|
|
943
957
|
var zValues_1 = [];
|
|
944
958
|
(_a = firstData.x) === null || _a === void 0 ? void 0 : _a.forEach(function (xVal, index) {
|
|
945
|
-
var _a;
|
|
946
|
-
var zVal = (0, exports.getNumberAtIndexOrDefault)(firstData.z, index);
|
|
947
|
-
if ((0, chart_utilities_1.isInvalidValue)(xVal) || (0, chart_utilities_1.isInvalidValue)((
|
|
959
|
+
var _a, _b;
|
|
960
|
+
var zVal = (_a = (0, exports.getNumberAtIndexOrDefault)(firstData.z, index)) !== null && _a !== void 0 ? _a : 0;
|
|
961
|
+
if ((0, chart_utilities_1.isInvalidValue)(xVal) || (0, chart_utilities_1.isInvalidValue)((_b = firstData.y) === null || _b === void 0 ? void 0 : _b[index])) {
|
|
948
962
|
return;
|
|
949
963
|
}
|
|
950
964
|
xValues_1.push(xVal);
|
|
@@ -1784,7 +1798,7 @@ var getNumberAtIndexOrDefault = function (data, index) {
|
|
|
1784
1798
|
return 1;
|
|
1785
1799
|
};
|
|
1786
1800
|
exports.getNumberAtIndexOrDefault = getNumberAtIndexOrDefault;
|
|
1787
|
-
var getValidXYRanges = function (series) {
|
|
1801
|
+
var getValidXYRanges = function (series, resolveX, resolveY) {
|
|
1788
1802
|
if (!(0, chart_utilities_1.isArrayOrTypedArray)(series.x) || !(0, chart_utilities_1.isArrayOrTypedArray)(series.y)) {
|
|
1789
1803
|
return [];
|
|
1790
1804
|
}
|
|
@@ -1792,7 +1806,10 @@ var getValidXYRanges = function (series) {
|
|
|
1792
1806
|
var start = 0;
|
|
1793
1807
|
var end = 0;
|
|
1794
1808
|
for (; end < series.x.length; end++) {
|
|
1795
|
-
if ((0, chart_utilities_1.isInvalidValue)(series.x[end]) ||
|
|
1809
|
+
if ((0, chart_utilities_1.isInvalidValue)(series.x[end]) ||
|
|
1810
|
+
(typeof resolveX === 'function' && (0, chart_utilities_1.isInvalidValue)(resolveX(series.x[end]))) ||
|
|
1811
|
+
(0, chart_utilities_1.isInvalidValue)(series.y[end]) ||
|
|
1812
|
+
(typeof resolveY === 'function' && (0, chart_utilities_1.isInvalidValue)(resolveY(series.y[end])))) {
|
|
1796
1813
|
if (end - start > 0) {
|
|
1797
1814
|
ranges.push([start, end]);
|
|
1798
1815
|
}
|
|
@@ -2105,7 +2122,7 @@ var getAxisTickProps = function (data, layout) {
|
|
|
2105
2122
|
if (!ax) {
|
|
2106
2123
|
return;
|
|
2107
2124
|
}
|
|
2108
|
-
var axType = getAxisType(data,
|
|
2125
|
+
var axType = getAxisType(data, ax);
|
|
2109
2126
|
if ((!ax.tickmode || ax.tickmode === 'array') && (0, chart_utilities_1.isArrayOrTypedArray)(ax.tickvals)) {
|
|
2110
2127
|
var tickValues = axType === 'date' ? ax.tickvals.map(function (v) { return new Date(v); }) : ax.tickvals;
|
|
2111
2128
|
if (axId === 'x') {
|
|
@@ -2212,43 +2229,80 @@ var getAxisObjects = function (data, layout) {
|
|
|
2212
2229
|
xAxisId = axisIds.x;
|
|
2213
2230
|
yAxisIds.add(axisIds.y);
|
|
2214
2231
|
});
|
|
2232
|
+
var makeAxisObject = function (axLetter, axId) { return (tslib_1.__assign(tslib_1.__assign({}, layout === null || layout === void 0 ? void 0 : layout[(0, chart_utilities_1.getAxisKey)(axLetter, axId)]), { _id: "".concat(axLetter).concat(axId > 1 ? axId : '') })); };
|
|
2215
2233
|
var axisObjects = {};
|
|
2216
2234
|
if (typeof xAxisId === 'number') {
|
|
2217
|
-
axisObjects.x =
|
|
2235
|
+
axisObjects.x = makeAxisObject('x', xAxisId);
|
|
2218
2236
|
}
|
|
2219
2237
|
var sortedYAxisIds = Array.from(yAxisIds).sort();
|
|
2220
2238
|
if (sortedYAxisIds.length > 0) {
|
|
2221
|
-
axisObjects.y =
|
|
2239
|
+
axisObjects.y = makeAxisObject('y', sortedYAxisIds[0]);
|
|
2222
2240
|
}
|
|
2223
2241
|
if (sortedYAxisIds.length > 1) {
|
|
2224
|
-
axisObjects.y2 =
|
|
2242
|
+
axisObjects.y2 = makeAxisObject('y', sortedYAxisIds[1]);
|
|
2225
2243
|
}
|
|
2226
2244
|
return axisObjects;
|
|
2227
2245
|
};
|
|
2228
|
-
|
|
2246
|
+
function getAxisType(data, arg2, arg3) {
|
|
2247
|
+
var _a;
|
|
2248
|
+
var ax;
|
|
2249
|
+
if (arg2 && typeof arg2 === 'object' && '_id' in arg2) {
|
|
2250
|
+
ax = arg2;
|
|
2251
|
+
}
|
|
2252
|
+
else if (typeof arg3 === 'string') {
|
|
2253
|
+
var layout = arg2;
|
|
2254
|
+
ax = getAxisObjects(data, layout)[arg3];
|
|
2255
|
+
}
|
|
2256
|
+
if (!ax) {
|
|
2257
|
+
return 'category';
|
|
2258
|
+
}
|
|
2259
|
+
if (['linear', 'log', 'date', 'category'].includes((_a = ax.type) !== null && _a !== void 0 ? _a : '')) {
|
|
2260
|
+
return ax.type;
|
|
2261
|
+
}
|
|
2262
|
+
var axLetter = ax._id[0];
|
|
2229
2263
|
var values = [];
|
|
2230
2264
|
data.forEach(function (series) {
|
|
2231
2265
|
var _a;
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
// Therefore, simply checking the type of the values may not be sufficient. At the moment,
|
|
2240
|
-
// we don’t always perform this casting ourselves and instead use the values as provided.
|
|
2241
|
-
if ((0, chart_utilities_1.isNumberArray)(values)) {
|
|
2242
|
-
if ((ax === null || ax === void 0 ? void 0 : ax.type) === 'log') {
|
|
2243
|
-
return 'log';
|
|
2266
|
+
var axId = series["".concat(axLetter, "axis")];
|
|
2267
|
+
if (axId === ax._id || (!axId && ax._id === axLetter)) {
|
|
2268
|
+
(_a = series[axLetter]) === null || _a === void 0 ? void 0 : _a.forEach(function (val) {
|
|
2269
|
+
if (!(0, chart_utilities_1.isInvalidValue)(val)) {
|
|
2270
|
+
values.push(val);
|
|
2271
|
+
}
|
|
2272
|
+
});
|
|
2244
2273
|
}
|
|
2274
|
+
});
|
|
2275
|
+
if ((0, chart_utilities_1.isNumberArray)(values) && !(0, chart_utilities_1.isYearArray)(values)) {
|
|
2245
2276
|
return 'linear';
|
|
2246
2277
|
}
|
|
2247
2278
|
if ((0, chart_utilities_1.isDateArray)(values)) {
|
|
2248
2279
|
return 'date';
|
|
2249
2280
|
}
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2281
|
+
return 'category';
|
|
2282
|
+
}
|
|
2283
|
+
var getAxisValueResolver = function (data, layout, axisId) {
|
|
2284
|
+
var axType = getAxisType(data, layout, axisId);
|
|
2285
|
+
return function (value) {
|
|
2286
|
+
if ((0, chart_utilities_1.isInvalidValue)(value)) {
|
|
2287
|
+
return null;
|
|
2288
|
+
}
|
|
2289
|
+
switch (axType) {
|
|
2290
|
+
case 'linear':
|
|
2291
|
+
case 'log':
|
|
2292
|
+
return (0, chart_utilities_1.isNumber)(value) ? +value : null;
|
|
2293
|
+
case 'date':
|
|
2294
|
+
if ((0, chart_utilities_1.isNumber)(value)) {
|
|
2295
|
+
return new Date(+value);
|
|
2296
|
+
}
|
|
2297
|
+
if (typeof value === 'string') {
|
|
2298
|
+
return new Date(value);
|
|
2299
|
+
}
|
|
2300
|
+
return null;
|
|
2301
|
+
case 'category':
|
|
2302
|
+
return "".concat(value);
|
|
2303
|
+
default:
|
|
2304
|
+
return null;
|
|
2305
|
+
}
|
|
2306
|
+
};
|
|
2253
2307
|
};
|
|
2254
2308
|
//# sourceMappingURL=PlotlySchemaAdapter.js.map
|