diff --git a/src/module/setChartData.js b/src/module/setChartData.js index d803c95..99256ea 100644 --- a/src/module/setChartData.js +++ b/src/module/setChartData.js @@ -58,6 +58,7 @@ export function setLineChartData(baseData, xMax, xMin, isPercent, yMax, yMin) { * @returns {number} The extrapolated and clamped Y minimum value. */ function calculateYMin(baseData, isPercent, yMin, yMax) { + if (baseData.length < 2) return yMin; let a = 0; let c = 1; let d = baseData[0].y; @@ -77,6 +78,7 @@ function calculateYMin(baseData, isPercent, yMin, yMax) { * @returns {number} The extrapolated and clamped Y maximum value. */ function calculateYMax(baseData, isPercent, yMin, yMax) { + if (baseData.length < 10) return yMax; let ma = 9; let mb = baseData[8].y; let mc = 10; @@ -119,12 +121,12 @@ function clampValue(value, isPercent, min, max) { * @param {Array<{x: string, y: number}>} baseData - The data points from * the backend with ISO timestamp x values. * @returns {Array<{x: string, y: number}>} Data with x values formatted - * as "YYYY/M/D hh:mm:ss". + * as "YYYY/M/D HH:mm:ss". */ export function setBarChartData(baseData) { let data = baseData.map((i) => { return { - x: getMoment(i.x).format("YYYY/M/D hh:mm:ss"), + x: getMoment(i.x).format("YYYY/M/D HH:mm:ss"), y: i.y, }; }); diff --git a/src/stores/allMapData.ts b/src/stores/allMapData.ts index b22ea44..01ef5f6 100644 --- a/src/stores/allMapData.ts +++ b/src/stores/allMapData.ts @@ -140,11 +140,11 @@ export const useAllMapDataStore = defineStore("allMapDataStore", { case "float": copy.min = copy.min !== null - ? Number(new Decimal(copy.min).toFixed(2, 1)) + ? Number(new Decimal(copy.min).toFixed(2, 3)) : null; copy.max = copy.max !== null - ? Number(new Decimal(copy.max).toFixed(2, 0)) + ? Number(new Decimal(copy.max).toFixed(2, 2)) : null; break; default: