Skip to content

Sorting dates written as strings #1328

Answered by Fil
Tex-Tang asked this question in Q&A
Discussion options

You must be logged in to vote

Two suggestions: the first is to read the dates first as JavaScript dates, for example with d3.utcParse, and use an interval to recreate the bars as rect marks. The second is to keep them as strings (and ordinal values, represented by bars), but transform them so that they are ordered naturally by time.
See the two possibilities at https://observablehq.com/@recifs/reading-dates

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Fil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1327 on March 12, 2023 14:39.