observablehq / plot

A concise API for exploratory data visualization implementing a layered grammar of graphics
https://observablehq.com/plot/
ISC License
4.3k stars 175 forks source link

The tip mark should respect the associated scale’s (local) time zone, if present #2050

Open tx0c opened 6 months ago

tx0c commented 6 months ago

when using x: { type: "time", ... } the a axis ticks are using correct local timezone, but the tip: "x" is still showing with utc timezones,

image

Plot.plot({
  color: { legend:true },
  x: { type: "time", domain: [new Date(Date.UTC(2024,3,8,-8)), new Date] },
  marks: [
    Plot.rectY(
      dataArticlesList,
      Plot.binX({y:"count", fill:"count"}, {x:"created_at", interval: d3.timeHour, tip: "x"})),
    Plot.ruleY([0]),
  ],
  width,
})
mbostock commented 6 months ago

You currently need to use the format option to change how the tip mark formats channel values. But yes, perhaps the tip mark could check whether the channel’s associated scale is in local time.