Dates for X Axis #196
-
I'm newer to Layercake and I am creating a simple line chart. I'd like to use a numeric value for the Y axis for a point, and a date (either a date type or a string that represents a date) for the X axis. However, based on my testing the points only work if the Y axis is a numeric value, or a string that converts to a number. It doesn't seem to work if I use something like "2024-5-8" for example. This can be replicated by simply updating the layercake-template repo, and updating the CSV to use a date in the format specified above, as opposed to using a four digit year, for the myX column. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
What values you use for your x and y axis are not a part of LayerCake and it has no opinions or restrictions. This is a more complex example but you can see that they axis is a date in the time of day plot example. This isn't LayerCake specific but I can give you some general pointers about how best to work with dates. You have a few options if you have dates for you axis. You may also want to look at some D3 charts that use dates and also look at d3-time-format.
|
Beta Was this translation helpful? Give feedback.
What values you use for your x and y axis are not a part of LayerCake and it has no opinions or restrictions. This is a more complex example but you can see that they axis is a date in the time of day plot example.
This isn't LayerCake specific but I can give you some general pointers about how best to work with dates.
You have a few options if you have dates for you axis. You may also want to look at some D3 charts that use dates and also look at d3-time-format.