Skip to content

Support for Observable Plot's utc scale. #120

Open
@Leftium

Description

@Leftium

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'),
		},
	});

Image

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)

Image


The app is live here:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy