I’m trying to plot a line chart with dates on the x-axis. Here is the code.
Plot.plot({
color: {
range: ["#193278", "#781932", "#197832", "#a96323"]
},
x: {
type: "time"
},
y: {
type: "linear",
grid: true,
domain: [0, 2100]
},
marks: [
Plot.line(df, {
x: "date",
y: "running_case_count",
tip: true,
stroke: "topic",
title: d => `Category: ${d.topic}\nDate: ${d.date}\nCases: ${d.running_case_count}`
})
]
})
)}
The dates are in YMD format; however, for whatever reason, Observable Plot wants to account for timezone differences starting on Nov. 4th and lists the dates with hours, which completely breaks the readability of the tooltip. I have a near identical chart to this one, with nearly the same exact code and the same exact datatypes, but it does not do this for whatever reason.
Plot.plot({
color: {
range: ["#193278", "#781932", "#197832", "#a96323"]
},
x: {
type: "time"
},
y: {
type: "linear",
grid: true,
domain: [0, 2100]
},
marks: [
Plot.line(df, {
x: "date",
y: "running_credit_total",
tip: true,
stroke: "topic",
title: d => `Category: ${d.topic}\nDate: ${d.date}\nCredits: ${d.running_credit_label}`
})
]
})
)}
This labels the dates in YMD format, unlike the other that attempts to convert to written months. Is there a way to disable timezones from appearing on dates, and is there a reason why it shows on one and not the other given the formats are identical (YYYY-MM-DD)