@geotab/zenith 3.12.1 → 3.12.2-beta.0
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/README.md
CHANGED
|
@@ -49,6 +49,11 @@ const getFormatFromDateRange = (minDate, maxDate, ticks) => {
|
|
|
49
49
|
};
|
|
50
50
|
const getDefaultOptions = (yAxis, xAxis, isTimedData, ticks, isDark, translate, isRtl = false) => {
|
|
51
51
|
const time = getFormatFromDateRange(xAxis.minDate, xAxis.maxDate, ticks);
|
|
52
|
+
// Empty data yields inverted sentinel bounds (min > max); pinning those would make chart.js
|
|
53
|
+
// span ~8.6e15 ms and crash. Only pin a valid range, else let it auto-scale.
|
|
54
|
+
const xMin = Date.parse(xAxis.minDate);
|
|
55
|
+
const xMax = Date.parse(xAxis.maxDate);
|
|
56
|
+
const hasValidTimeRange = isTimedData && Number.isFinite(xMin) && Number.isFinite(xMax) && xMin <= xMax;
|
|
52
57
|
const textColor = isDark ? "#C0CCD8" : "#4E677E";
|
|
53
58
|
const primaryYPosition = isRtl ? "right" : "left";
|
|
54
59
|
const secondaryYPosition = isRtl ? "left" : "right";
|
|
@@ -70,8 +75,8 @@ const getDefaultOptions = (yAxis, xAxis, isTimedData, ticks, isDark, translate,
|
|
|
70
75
|
}
|
|
71
76
|
}
|
|
72
77
|
: undefined,
|
|
73
|
-
min:
|
|
74
|
-
max:
|
|
78
|
+
min: hasValidTimeRange ? xMin : undefined,
|
|
79
|
+
max: hasValidTimeRange ? xMax : undefined,
|
|
75
80
|
ticks: isTimedData
|
|
76
81
|
? {
|
|
77
82
|
autoSkip: false,
|
|
@@ -46,6 +46,11 @@ const getFormatFromDateRange = (minDate, maxDate, ticks) => {
|
|
|
46
46
|
};
|
|
47
47
|
export const getDefaultOptions = (yAxis, xAxis, isTimedData, ticks, isDark, translate, isRtl = false) => {
|
|
48
48
|
const time = getFormatFromDateRange(xAxis.minDate, xAxis.maxDate, ticks);
|
|
49
|
+
// Empty data yields inverted sentinel bounds (min > max); pinning those would make chart.js
|
|
50
|
+
// span ~8.6e15 ms and crash. Only pin a valid range, else let it auto-scale.
|
|
51
|
+
const xMin = Date.parse(xAxis.minDate);
|
|
52
|
+
const xMax = Date.parse(xAxis.maxDate);
|
|
53
|
+
const hasValidTimeRange = isTimedData && Number.isFinite(xMin) && Number.isFinite(xMax) && xMin <= xMax;
|
|
49
54
|
const textColor = isDark ? "#C0CCD8" : "#4E677E";
|
|
50
55
|
const primaryYPosition = isRtl ? "right" : "left";
|
|
51
56
|
const secondaryYPosition = isRtl ? "left" : "right";
|
|
@@ -67,8 +72,8 @@ export const getDefaultOptions = (yAxis, xAxis, isTimedData, ticks, isDark, tran
|
|
|
67
72
|
}
|
|
68
73
|
}
|
|
69
74
|
: undefined,
|
|
70
|
-
min:
|
|
71
|
-
max:
|
|
75
|
+
min: hasValidTimeRange ? xMin : undefined,
|
|
76
|
+
max: hasValidTimeRange ? xMax : undefined,
|
|
72
77
|
ticks: isTimedData
|
|
73
78
|
? {
|
|
74
79
|
autoSkip: false,
|