Skip to content

Commit de73f83

Browse files
committed
Adjust granularity for UTC time
1 parent 582f28c commit de73f83

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

apps/class-solid/src/components/Analysis.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,15 @@ export function TimeSeriesPlot({ analysis }: { analysis: TimeseriesAnalysis }) {
140140
e.output ? e.output[analysis.yVariable as OutputVariableKey] : [],
141141
);
142142

143-
const granularity = () => (analysis.xVariable === "t" ? 600 : undefined);
144-
const xLim = () => getNiceAxisLimits(allX(), 0, granularity());
145-
const yLim = () => getNiceAxisLimits(allY());
143+
const granularities: Record<string, number | undefined> = {
144+
t: 600, // 10 minutes in seconds
145+
utcTime: 60_000, // 1 minute in milliseconds
146+
default: undefined,
147+
};
148+
149+
const roundTo = (v: string) => granularities[v] ?? granularities.default;
150+
const xLim = () => getNiceAxisLimits(allX(), 0, roundTo(analysis.xVariable));
151+
const yLim = () => getNiceAxisLimits(allY(), 0, roundTo(analysis.yVariable));
146152

147153
const chartData = () =>
148154
flatExperiments().map((e) => {

0 commit comments

Comments
 (0)