@fluentui/react-charting 5.24.36 → 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 +28 -1
- package/CHANGELOG.md +13 -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 +2 -2
|
@@ -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 {};
|
|
@@ -417,19 +417,15 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
|
|
|
417
417
|
var _j = getLegendProps(input.data, input.layout, isMultiPlot), legends = _j.legends, hideLegend = _j.hideLegend;
|
|
418
418
|
var colorScale = undefined;
|
|
419
419
|
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
420
|
+
var resolveXAxisValue = getAxisValueResolver(input.data, input.layout, 'x');
|
|
420
421
|
input.data.forEach(function (series, index1) {
|
|
421
422
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
422
423
|
colorScale = createColorScale(input.layout, series, colorScale);
|
|
423
|
-
var isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis
|
|
424
424
|
// extract bar colors for each series only once
|
|
425
425
|
var extractedBarColors = 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);
|
|
426
426
|
// extract line colors for each series only once
|
|
427
427
|
var extractedLineColors = 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);
|
|
428
|
-
var
|
|
429
|
-
var isXDate = isDateArray(xValues);
|
|
430
|
-
var isXString = isStringArray(xValues);
|
|
431
|
-
var isXNumber = isNumberArray(xValues);
|
|
432
|
-
var validXYRanges = getValidXYRanges(series);
|
|
428
|
+
var validXYRanges = getValidXYRanges(series, resolveXAxisValue);
|
|
433
429
|
validXYRanges.forEach(function (_a, rangeIdx) {
|
|
434
430
|
var rangeStart = _a[0], rangeEnd = _a[1];
|
|
435
431
|
var rangeXValues = series.x.slice(rangeStart, rangeEnd);
|
|
@@ -438,7 +434,7 @@ export var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorM
|
|
|
438
434
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
439
435
|
if (!mapXToDataPoints[x]) {
|
|
440
436
|
mapXToDataPoints[x] = {
|
|
441
|
-
xAxisPoint:
|
|
437
|
+
xAxisPoint: resolveXAxisValue(x),
|
|
442
438
|
chartData: [],
|
|
443
439
|
lineData: [],
|
|
444
440
|
};
|
|
@@ -647,8 +643,9 @@ export var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMa
|
|
|
647
643
|
var xValues = [];
|
|
648
644
|
var yValues = [];
|
|
649
645
|
series.x.forEach(function (xVal, index) {
|
|
650
|
-
var
|
|
651
|
-
|
|
646
|
+
var _a;
|
|
647
|
+
var yVal = (_a = getNumberAtIndexOrDefault(series.y, index)) !== null && _a !== void 0 ? _a : 0;
|
|
648
|
+
if (isInvalidValue(xVal)) {
|
|
652
649
|
return;
|
|
653
650
|
}
|
|
654
651
|
xValues.push(xVal);
|
|
@@ -698,8 +695,27 @@ export var transformPlotlyJsonToLineChartProps = function (input, isMultiPlot, c
|
|
|
698
695
|
export var transformPlotlyJsonToScatterChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
699
696
|
return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
|
|
700
697
|
};
|
|
698
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
699
|
+
var mapColorFillBars = function (layout) {
|
|
700
|
+
if (!Array.isArray(layout === null || layout === void 0 ? void 0 : layout.shapes)) {
|
|
701
|
+
return [];
|
|
702
|
+
}
|
|
703
|
+
return layout.shapes
|
|
704
|
+
.filter(function (shape) { return shape.type === 'rect'; })
|
|
705
|
+
.map(function (shape) {
|
|
706
|
+
//colorFillbars doesn't support string dates or categories
|
|
707
|
+
if (typeof shape.x0 === 'string' || typeof shape.x1 === 'string') {
|
|
708
|
+
return null;
|
|
709
|
+
}
|
|
710
|
+
return {
|
|
711
|
+
color: shape.fillcolor,
|
|
712
|
+
data: [{ startX: shape.x0, endX: shape.x1 }],
|
|
713
|
+
applyPattern: false,
|
|
714
|
+
};
|
|
715
|
+
});
|
|
716
|
+
};
|
|
701
717
|
var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme) {
|
|
702
|
-
var _a, _b, _c, _d, _e, _f;
|
|
718
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
703
719
|
var isScatterMarkers = [
|
|
704
720
|
'text',
|
|
705
721
|
'markers',
|
|
@@ -714,9 +730,10 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
714
730
|
var isScatterChart = chartType === 'scatter';
|
|
715
731
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
|
|
716
732
|
var mode = 'tonexty';
|
|
717
|
-
var
|
|
733
|
+
var _h = getLegendProps(input.data, input.layout, isMultiPlot), legends = _h.legends, hideLegend = _h.hideLegend;
|
|
718
734
|
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
719
|
-
var
|
|
735
|
+
var resolveXAxisValue = getAxisValueResolver(input.data, input.layout, 'x');
|
|
736
|
+
var shouldWrapLabels = getAxisType(input.data, input.layout, 'x') === 'category';
|
|
720
737
|
var chartData = input.data
|
|
721
738
|
.map(function (series, index) {
|
|
722
739
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
@@ -728,11 +745,6 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
728
745
|
// extract colors for each series only once
|
|
729
746
|
var extractedColors = 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);
|
|
730
747
|
var xValues = series.x;
|
|
731
|
-
var isXString = isStringArray(xValues);
|
|
732
|
-
var isXDate = isDateArray(xValues);
|
|
733
|
-
var isXNumber = isNumberArray(xValues);
|
|
734
|
-
var isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis
|
|
735
|
-
shouldWrapLabels = shouldWrapLabels || (isXString && !isXDate);
|
|
736
748
|
var legend = legends[index];
|
|
737
749
|
// resolve color for each legend's lines from the extracted colors
|
|
738
750
|
var seriesColor = 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);
|
|
@@ -741,7 +753,7 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
741
753
|
// if mode contains 'text', we prioritize showing the text over curving the line
|
|
742
754
|
var lineOptions = !((_l = series.mode) === null || _l === void 0 ? void 0 : _l.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
|
|
743
755
|
var legendShape = getLegendShape(series);
|
|
744
|
-
var validXYRanges = getValidXYRanges(series);
|
|
756
|
+
var validXYRanges = getValidXYRanges(series, resolveXAxisValue);
|
|
745
757
|
return validXYRanges.map(function (_a, rangeIdx) {
|
|
746
758
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
747
759
|
var rangeStart = _a[0], rangeEnd = _a[1];
|
|
@@ -761,7 +773,7 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
761
773
|
legendShape: legendShape,
|
|
762
774
|
data: rangeXValues.map(function (x, i) {
|
|
763
775
|
var _a, _b;
|
|
764
|
-
return (__assign(__assign(__assign(__assign({ x:
|
|
776
|
+
return (__assign(__assign(__assign(__assign({ x: resolveXAxisValue(x), y: rangeYValues[i] }, (Array.isArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.size)
|
|
765
777
|
? { markerSize: markerSizes[i] }
|
|
766
778
|
: typeof ((_b = series.marker) === null || _b === void 0 ? void 0 : _b.size) === 'number'
|
|
767
779
|
? { markerSize: series.marker.size }
|
|
@@ -818,8 +830,10 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
818
830
|
return __assign({ data: chartProps, mode: mode }, commonProps);
|
|
819
831
|
}
|
|
820
832
|
else {
|
|
821
|
-
return __assign(__assign(__assign({ data: isScatterChart ? scatterChartProps : chartProps, roundedTicks: true, enableReflow: false }, commonProps), yMinMax), (isScatterChart
|
|
822
|
-
? __assign({ showYAxisLablesTooltip: true }, getAxisCategoryOrderProps(input.data, input.layout)) : {}))
|
|
833
|
+
return __assign(__assign(__assign(__assign({ data: isScatterChart ? scatterChartProps : chartProps, roundedTicks: true, enableReflow: false }, commonProps), yMinMax), (isScatterChart
|
|
834
|
+
? __assign({ showYAxisLablesTooltip: true }, getAxisCategoryOrderProps(input.data, input.layout)) : {})), (!isScatterChart && ((_g = mapColorFillBars(input.layout)) === null || _g === void 0 ? void 0 : _g.length)
|
|
835
|
+
? { colorFillBars: mapColorFillBars(input.layout) }
|
|
836
|
+
: {}));
|
|
823
837
|
}
|
|
824
838
|
};
|
|
825
839
|
export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -836,18 +850,18 @@ export var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, is
|
|
|
836
850
|
return series.y
|
|
837
851
|
.map(function (yValue, i) {
|
|
838
852
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
839
|
-
if (isInvalidValue(
|
|
853
|
+
if (isInvalidValue(yValue)) {
|
|
840
854
|
return null;
|
|
841
855
|
}
|
|
842
856
|
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
843
857
|
var color = colorScale
|
|
844
|
-
? colorScale(isArrayOrTypedArray((
|
|
845
|
-
? (
|
|
858
|
+
? colorScale(isArrayOrTypedArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
|
|
859
|
+
? (_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]
|
|
846
860
|
: 0)
|
|
847
|
-
: resolveColor(extractedColors, i, legend, colorMap, (
|
|
861
|
+
: 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);
|
|
848
862
|
var opacity = getOpacity(series, i);
|
|
849
863
|
return {
|
|
850
|
-
x: series.x[i],
|
|
864
|
+
x: isInvalidValue((_h = series.x) === null || _h === void 0 ? void 0 : _h[i]) ? 0 : series.x[i],
|
|
851
865
|
y: yValue,
|
|
852
866
|
legend: legend,
|
|
853
867
|
color: (_j = rgb(color).copy({ opacity: opacity }).formatHex8()) !== null && _j !== void 0 ? _j : color,
|
|
@@ -872,14 +886,14 @@ export var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot,
|
|
|
872
886
|
var _a, _b, _c;
|
|
873
887
|
var _d = getLegendProps(input.data, input.layout, isMultiPlot), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
874
888
|
var colorScale = undefined;
|
|
889
|
+
var isXDate = getAxisType(input.data, input.layout, 'x') === 'date';
|
|
875
890
|
var chartData = input.data
|
|
876
891
|
.map(function (series, index) {
|
|
877
|
-
var _a, _b, _c, _d
|
|
892
|
+
var _a, _b, _c, _d;
|
|
878
893
|
colorScale = createColorScale(input.layout, series, colorScale);
|
|
879
894
|
// extract colors for each series only once
|
|
880
895
|
var extractedColors = 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);
|
|
881
896
|
var legend = legends[index];
|
|
882
|
-
var isXDate = ((_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.xaxis) === null || _f === void 0 ? void 0 : _f.type) === 'date' || isDateArray(series.x);
|
|
883
897
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
884
898
|
var convertXValueToNumber = function (value) {
|
|
885
899
|
return isInvalidValue(value) ? 0 : isXDate ? +parseLocalDate(value) : +value;
|
|
@@ -925,9 +939,9 @@ export var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, col
|
|
|
925
939
|
var yValues_1 = [];
|
|
926
940
|
var zValues_1 = [];
|
|
927
941
|
(_a = firstData.x) === null || _a === void 0 ? void 0 : _a.forEach(function (xVal, index) {
|
|
928
|
-
var _a;
|
|
929
|
-
var zVal = getNumberAtIndexOrDefault(firstData.z, index);
|
|
930
|
-
if (isInvalidValue(xVal) || isInvalidValue((
|
|
942
|
+
var _a, _b;
|
|
943
|
+
var zVal = (_a = getNumberAtIndexOrDefault(firstData.z, index)) !== null && _a !== void 0 ? _a : 0;
|
|
944
|
+
if (isInvalidValue(xVal) || isInvalidValue((_b = firstData.y) === null || _b === void 0 ? void 0 : _b[index])) {
|
|
931
945
|
return;
|
|
932
946
|
}
|
|
933
947
|
xValues_1.push(xVal);
|
|
@@ -1759,7 +1773,7 @@ export var getNumberAtIndexOrDefault = function (data, index) {
|
|
|
1759
1773
|
}
|
|
1760
1774
|
return 1;
|
|
1761
1775
|
};
|
|
1762
|
-
export var getValidXYRanges = function (series) {
|
|
1776
|
+
export var getValidXYRanges = function (series, resolveX, resolveY) {
|
|
1763
1777
|
if (!isArrayOrTypedArray(series.x) || !isArrayOrTypedArray(series.y)) {
|
|
1764
1778
|
return [];
|
|
1765
1779
|
}
|
|
@@ -1767,7 +1781,10 @@ export var getValidXYRanges = function (series) {
|
|
|
1767
1781
|
var start = 0;
|
|
1768
1782
|
var end = 0;
|
|
1769
1783
|
for (; end < series.x.length; end++) {
|
|
1770
|
-
if (isInvalidValue(series.x[end]) ||
|
|
1784
|
+
if (isInvalidValue(series.x[end]) ||
|
|
1785
|
+
(typeof resolveX === 'function' && isInvalidValue(resolveX(series.x[end]))) ||
|
|
1786
|
+
isInvalidValue(series.y[end]) ||
|
|
1787
|
+
(typeof resolveY === 'function' && isInvalidValue(resolveY(series.y[end])))) {
|
|
1771
1788
|
if (end - start > 0) {
|
|
1772
1789
|
ranges.push([start, end]);
|
|
1773
1790
|
}
|
|
@@ -2077,7 +2094,7 @@ var getAxisTickProps = function (data, layout) {
|
|
|
2077
2094
|
if (!ax) {
|
|
2078
2095
|
return;
|
|
2079
2096
|
}
|
|
2080
|
-
var axType = getAxisType(data,
|
|
2097
|
+
var axType = getAxisType(data, ax);
|
|
2081
2098
|
if ((!ax.tickmode || ax.tickmode === 'array') && isArrayOrTypedArray(ax.tickvals)) {
|
|
2082
2099
|
var tickValues = axType === 'date' ? ax.tickvals.map(function (v) { return new Date(v); }) : ax.tickvals;
|
|
2083
2100
|
if (axId === 'x') {
|
|
@@ -2184,43 +2201,80 @@ var getAxisObjects = function (data, layout) {
|
|
|
2184
2201
|
xAxisId = axisIds.x;
|
|
2185
2202
|
yAxisIds.add(axisIds.y);
|
|
2186
2203
|
});
|
|
2204
|
+
var makeAxisObject = function (axLetter, axId) { return (__assign(__assign({}, layout === null || layout === void 0 ? void 0 : layout[getAxisKey(axLetter, axId)]), { _id: "".concat(axLetter).concat(axId > 1 ? axId : '') })); };
|
|
2187
2205
|
var axisObjects = {};
|
|
2188
2206
|
if (typeof xAxisId === 'number') {
|
|
2189
|
-
axisObjects.x =
|
|
2207
|
+
axisObjects.x = makeAxisObject('x', xAxisId);
|
|
2190
2208
|
}
|
|
2191
2209
|
var sortedYAxisIds = Array.from(yAxisIds).sort();
|
|
2192
2210
|
if (sortedYAxisIds.length > 0) {
|
|
2193
|
-
axisObjects.y =
|
|
2211
|
+
axisObjects.y = makeAxisObject('y', sortedYAxisIds[0]);
|
|
2194
2212
|
}
|
|
2195
2213
|
if (sortedYAxisIds.length > 1) {
|
|
2196
|
-
axisObjects.y2 =
|
|
2214
|
+
axisObjects.y2 = makeAxisObject('y', sortedYAxisIds[1]);
|
|
2197
2215
|
}
|
|
2198
2216
|
return axisObjects;
|
|
2199
2217
|
};
|
|
2200
|
-
|
|
2218
|
+
function getAxisType(data, arg2, arg3) {
|
|
2219
|
+
var _a;
|
|
2220
|
+
var ax;
|
|
2221
|
+
if (arg2 && typeof arg2 === 'object' && '_id' in arg2) {
|
|
2222
|
+
ax = arg2;
|
|
2223
|
+
}
|
|
2224
|
+
else if (typeof arg3 === 'string') {
|
|
2225
|
+
var layout = arg2;
|
|
2226
|
+
ax = getAxisObjects(data, layout)[arg3];
|
|
2227
|
+
}
|
|
2228
|
+
if (!ax) {
|
|
2229
|
+
return 'category';
|
|
2230
|
+
}
|
|
2231
|
+
if (['linear', 'log', 'date', 'category'].includes((_a = ax.type) !== null && _a !== void 0 ? _a : '')) {
|
|
2232
|
+
return ax.type;
|
|
2233
|
+
}
|
|
2234
|
+
var axLetter = ax._id[0];
|
|
2201
2235
|
var values = [];
|
|
2202
2236
|
data.forEach(function (series) {
|
|
2203
2237
|
var _a;
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
// Therefore, simply checking the type of the values may not be sufficient. At the moment,
|
|
2212
|
-
// we don’t always perform this casting ourselves and instead use the values as provided.
|
|
2213
|
-
if (isNumberArray(values)) {
|
|
2214
|
-
if ((ax === null || ax === void 0 ? void 0 : ax.type) === 'log') {
|
|
2215
|
-
return 'log';
|
|
2238
|
+
var axId = series["".concat(axLetter, "axis")];
|
|
2239
|
+
if (axId === ax._id || (!axId && ax._id === axLetter)) {
|
|
2240
|
+
(_a = series[axLetter]) === null || _a === void 0 ? void 0 : _a.forEach(function (val) {
|
|
2241
|
+
if (!isInvalidValue(val)) {
|
|
2242
|
+
values.push(val);
|
|
2243
|
+
}
|
|
2244
|
+
});
|
|
2216
2245
|
}
|
|
2246
|
+
});
|
|
2247
|
+
if (isNumberArray(values) && !isYearArray(values)) {
|
|
2217
2248
|
return 'linear';
|
|
2218
2249
|
}
|
|
2219
2250
|
if (isDateArray(values)) {
|
|
2220
2251
|
return 'date';
|
|
2221
2252
|
}
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2253
|
+
return 'category';
|
|
2254
|
+
}
|
|
2255
|
+
var getAxisValueResolver = function (data, layout, axisId) {
|
|
2256
|
+
var axType = getAxisType(data, layout, axisId);
|
|
2257
|
+
return function (value) {
|
|
2258
|
+
if (isInvalidValue(value)) {
|
|
2259
|
+
return null;
|
|
2260
|
+
}
|
|
2261
|
+
switch (axType) {
|
|
2262
|
+
case 'linear':
|
|
2263
|
+
case 'log':
|
|
2264
|
+
return isNumber(value) ? +value : null;
|
|
2265
|
+
case 'date':
|
|
2266
|
+
if (isNumber(value)) {
|
|
2267
|
+
return new Date(+value);
|
|
2268
|
+
}
|
|
2269
|
+
if (typeof value === 'string') {
|
|
2270
|
+
return new Date(value);
|
|
2271
|
+
}
|
|
2272
|
+
return null;
|
|
2273
|
+
case 'category':
|
|
2274
|
+
return "".concat(value);
|
|
2275
|
+
default:
|
|
2276
|
+
return null;
|
|
2277
|
+
}
|
|
2278
|
+
};
|
|
2225
2279
|
};
|
|
2226
2280
|
//# sourceMappingURL=PlotlySchemaAdapter.js.map
|