fix: display every other day sequentially for month ticks
Co-authored-by: aider (gemini/gemini-3.1-pro-preview) <aider@aider.chat>
This commit is contained in:
+6
-2
@@ -79,13 +79,15 @@ function useSensor(measurement, name, end, duration) {
|
||||
if (Array.isArray(data)) {
|
||||
ticks = [];
|
||||
let lastLabel = null;
|
||||
let dayCount = 0;
|
||||
data.forEach(d => {
|
||||
const lbl = memoConvertTZ(isDST, d.time, duration.format);
|
||||
if (lbl !== lastLabel) {
|
||||
if (duration.len !== 'Month' || parseInt(lbl, 10) % 2 !== 0) {
|
||||
if (duration.len !== 'Month' || dayCount % 2 === 0) {
|
||||
ticks.push(d.time);
|
||||
}
|
||||
lastLabel = lbl;
|
||||
dayCount++;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -730,13 +732,15 @@ function MultiLineChart({title, measurement, dataKey, sensors, colors, end, dura
|
||||
if (Array.isArray(data)) {
|
||||
ticks = [];
|
||||
let lastLabel = null;
|
||||
let dayCount = 0;
|
||||
data.forEach(d => {
|
||||
const lbl = memoConvertTZ(isDST, d.time, duration.format);
|
||||
if (lbl !== lastLabel) {
|
||||
if (duration.len !== 'Month' || parseInt(lbl, 10) % 2 !== 0) {
|
||||
if (duration.len !== 'Month' || dayCount % 2 === 0) {
|
||||
ticks.push(d.time);
|
||||
}
|
||||
lastLabel = lbl;
|
||||
dayCount++;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user