fix #287 by using simple division

This commit is contained in:
Cindy Chang
2024-06-12 12:27:51 +08:00
parent 235504a3fb
commit 339657879a
3 changed files with 72 additions and 2 deletions

View File

@@ -146,6 +146,8 @@ import { setLineChartData } from '@/module/setChartData.js';
import { simpleTimeLabel, followTimeLabel, dateLabel,
setTimeStringFormatBaseOnTimeDifference,
mapTimestampToAxisTicksByFormat,
getStepSizeOfYTicks,
getYTicksByIndex,
} from '@/module/timeLabel.js';
const knownScaleLineChartOptions = {
@@ -394,8 +396,9 @@ export default {
};
primeVueSetOption.scales.x.min = minX;
primeVueSetOption.scales.x.max = maxX;
const {resultStepSize: YTickStepSize, unitToUse} = getStepSizeOfYTicks(maxY); // Stepsize only needs to be calculated once
primeVueSetOption.scales.y.ticks.callback = function (value, index, ticks) {
return getFollowTimeLabel(value, maxY, 1)
return getYTicksByIndex(YTickStepSize, index, unitToUse);
};
break;
case 'count':