🏠 back to Observable

Display Month for x axis

I have this simple Plot with some SP500 data

How do I put the months only on the x-axis like examples from Plot : Scale

Plot.plot( {x: {type: "time", domain: [startDate, endDate]}, grid: true})

From the above notebook, all the dates are all too close to each other…

I figure out I need a domain for the startDate ( array 1st entry ) and endDate ( array last entry )
but how to I mapped the sp500.date to the x-axis in a nice month format ??

Thanks

Plot expects javascript date objects, if you use your parser function to process your data the plot works as expected:

2 Likes