Open
Description
Is your feature request related to a problem? Please describe.
I need support for scale type utc
. It is very common to store/process dates in UTC time (Unix epochs).
Describe the solution you'd like
Support for utc
scale like Observable Plot.
Describe alternatives you've considered
- Observable Plot
- Transform Unix timestamps (UTC) to conform to local time scale?
Additional context
- I thought I would try porting my Observable Plot plots to SveltePlot, but lack of UTC support may be a dealbreaker...
An error occurs when I try to port this code:
const plotOptions = $derived({
width: clientWidth,
height,
marginRight: MARGIN_RIGHT,
marginLeft: MARGIN_LEFT,
marginTop: 0,
marginBottom: 0,
y: { axis: null, domain: [yDomainTop, yDomainBottom], range: [0, height] },
x: {
type: 'utc',
axis: xAxis ? true : null,
domain: [msStart, msEnd],
range: [MARGIN_LEFT, clientWidth - MARGIN_RIGHT],
tickFormat: (ms: number) => nsWeatherData.tzFormat(ms, 'ha'),
},
});
No errors using time
type scale, but the resulting days are misaligned:
- 12am June 16 should start at the very left.
- The cursor is currently over Jun 16 1am, but SveltePlot axis shows 11am June 15.
- (Showing KST data from CST timezone)
The app is live here: