TimeSeries: Fixes issue with time x-axis and hour ticks that stretches across more than one day (#32389)

* TimeSeries: Fixes issue with time x-axis and hour ticks that stretches across more than one day

* Fixed logic
This commit is contained in:
Torkel Ödegaard 2021-03-29 14:36:01 +02:00 committed by GitHub
parent 1d7f155c92
commit 636be0ed22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -123,13 +123,13 @@ export const graphTimeFormat = (ticks: number | null, min: number | null, max: n
if (secPerTick <= 45) {
return systemDateFormats.interval.second;
}
if (secPerTick <= 7200 || range <= oneDay) {
if (range <= oneDay) {
return systemDateFormats.interval.minute;
}
if (secPerTick <= 80000) {
return systemDateFormats.interval.hour;
}
if (secPerTick <= 2419200 || range <= oneYear) {
if (range <= oneYear) {
return systemDateFormats.interval.day;
}
if (secPerTick <= 31536000) {

View File

@ -163,11 +163,11 @@ function formatTime(self: uPlot, splits: number[], axisIdx: number, foundSpace:
format = systemDateFormats.interval.second.replace('ss', 'ss.SS');
} else if (foundIncr <= timeUnitSize.minute) {
format = systemDateFormats.interval.second;
} else if (foundIncr <= timeUnitSize.hour || range <= timeUnitSize.day) {
} else if (range <= timeUnitSize.day) {
format = systemDateFormats.interval.minute;
} else if (foundIncr <= timeUnitSize.day) {
format = systemDateFormats.interval.hour;
} else if (foundIncr <= timeUnitSize.month || range < timeUnitSize.year) {
} else if (range < timeUnitSize.year) {
format = systemDateFormats.interval.day;
} else if (incrementRoundedToDay === yearRoundedToDay) {
format = systemDateFormats.interval.year;