Charts JavaScript Tutorials. Part 2. Loading External data.
There is one more path which should be fixed:
Data of this chart is generated html file, so it’s not good for us – we want to load external data.
Lets create a simple text file, called data.txt and add some data to it – first column contains dates and the second one has some numbers. Note, our data is irregular – it has gaps at weekends:
2011-02-23,133034
2011-02-24,122290
2011-02-25,383603
2011-02-28,125285
2011-03-01,118042
2011-03-02,102500
2011-03-03,434047
2011-03-04,422374
2011-03-07,396473
2011-03-08,453142First column has date and two other columns – some numbers. Save this file to the same folder as lineWithDateBasedData.html file and then go back to the editor with lineWithDateBasedData.html file opened. Delete generateChartData method and also the line where it is called.
Loading data
Add a method which loads external data to the script:
And here is a?working example?of all what we’ve done here.