Excuse me if this is JS 101, but: how cab you create a chart object (chart = {}), but it contains a series of functions and variables. Is chart = {} supposed to be a function itself?
My issue is my compiler keeps expecting the contents of chart = {} to be separated by commas, not by semi colons.
Thanks!
This is written in Observable JavaScript which has slightly different syntax:
https://observablehq.com/@observablehq/observables-not-javascript
You can convert to vanilla JavaScript by turning this into a function, e.g., function chart() { … } instead of chart = { … }.
Great chart. Thanks. The xscale type is scaleUTC. How do I adapt if I have x axis data as year (1990, 1991....). When I change the scale to 'scaleBand', doesn't pick the values for the line.
Would it be possible for you to share the javascript type you are using for the Date field?
I assume that the close attribute is a Number.
I'm pulling data from a JSON blob, so i'm working with a string for the date. I'm using Date.parse to generate the Date field here. It is working, but I would love to know the JS type you are using.