mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
parent
1d7f155c92
commit
636be0ed22
@ -123,13 +123,13 @@ export const graphTimeFormat = (ticks: number | null, min: number | null, max: n
|
|||||||
if (secPerTick <= 45) {
|
if (secPerTick <= 45) {
|
||||||
return systemDateFormats.interval.second;
|
return systemDateFormats.interval.second;
|
||||||
}
|
}
|
||||||
if (secPerTick <= 7200 || range <= oneDay) {
|
if (range <= oneDay) {
|
||||||
return systemDateFormats.interval.minute;
|
return systemDateFormats.interval.minute;
|
||||||
}
|
}
|
||||||
if (secPerTick <= 80000) {
|
if (secPerTick <= 80000) {
|
||||||
return systemDateFormats.interval.hour;
|
return systemDateFormats.interval.hour;
|
||||||
}
|
}
|
||||||
if (secPerTick <= 2419200 || range <= oneYear) {
|
if (range <= oneYear) {
|
||||||
return systemDateFormats.interval.day;
|
return systemDateFormats.interval.day;
|
||||||
}
|
}
|
||||||
if (secPerTick <= 31536000) {
|
if (secPerTick <= 31536000) {
|
||||||
|
@ -163,11 +163,11 @@ function formatTime(self: uPlot, splits: number[], axisIdx: number, foundSpace:
|
|||||||
format = systemDateFormats.interval.second.replace('ss', 'ss.SS');
|
format = systemDateFormats.interval.second.replace('ss', 'ss.SS');
|
||||||
} else if (foundIncr <= timeUnitSize.minute) {
|
} else if (foundIncr <= timeUnitSize.minute) {
|
||||||
format = systemDateFormats.interval.second;
|
format = systemDateFormats.interval.second;
|
||||||
} else if (foundIncr <= timeUnitSize.hour || range <= timeUnitSize.day) {
|
} else if (range <= timeUnitSize.day) {
|
||||||
format = systemDateFormats.interval.minute;
|
format = systemDateFormats.interval.minute;
|
||||||
} else if (foundIncr <= timeUnitSize.day) {
|
} else if (foundIncr <= timeUnitSize.day) {
|
||||||
format = systemDateFormats.interval.hour;
|
format = systemDateFormats.interval.hour;
|
||||||
} else if (foundIncr <= timeUnitSize.month || range < timeUnitSize.year) {
|
} else if (range < timeUnitSize.year) {
|
||||||
format = systemDateFormats.interval.day;
|
format = systemDateFormats.interval.day;
|
||||||
} else if (incrementRoundedToDay === yearRoundedToDay) {
|
} else if (incrementRoundedToDay === yearRoundedToDay) {
|
||||||
format = systemDateFormats.interval.year;
|
format = systemDateFormats.interval.year;
|
||||||
|
Loading…
Reference in New Issue
Block a user