feat: only display even hours for day duration ticks
Co-authored-by: aider (gemini/gemini-3.1-pro-preview) <aider@aider.chat>
This commit is contained in:
+6
-2
@@ -79,7 +79,9 @@ function useSensor(measurement, name, end, duration) {
|
||||
data.forEach(d => {
|
||||
const lbl = memoConvertTZ(isDST, d.time, duration.format);
|
||||
if (lbl !== lastLabel) {
|
||||
if (duration.len !== 'Month' || dayCount % 2 === 0) {
|
||||
const isMonthSkip = duration.len === 'Month' && dayCount % 2 !== 0;
|
||||
const isDaySkip = duration.len === 'Day' && parseInt(lbl, 10) % 2 !== 0;
|
||||
if (!isMonthSkip && !isDaySkip) {
|
||||
ticks.push(d.time);
|
||||
}
|
||||
lastLabel = lbl;
|
||||
@@ -728,7 +730,9 @@ function MultiLineChart({title, measurement, dataKey, sensors, colors, end, dura
|
||||
data.forEach(d => {
|
||||
const lbl = memoConvertTZ(isDST, d.time, duration.format);
|
||||
if (lbl !== lastLabel) {
|
||||
if (duration.len !== 'Month' || dayCount % 2 === 0) {
|
||||
const isMonthSkip = duration.len === 'Month' && dayCount % 2 !== 0;
|
||||
const isDaySkip = duration.len === 'Day' && parseInt(lbl, 10) % 2 !== 0;
|
||||
if (!isMonthSkip && !isDaySkip) {
|
||||
ticks.push(d.time);
|
||||
}
|
||||
lastLabel = lbl;
|
||||
|
||||
Reference in New Issue
Block a user