Home forums Using CanvasJS Line Graph Bugs Reply To: Line Graph Bugs


Vishwas R

d3.csv is an asynchronous method, where the code inside the callback function will run when the data is loaded whereas code outside the callback function will run immediately after the request is made, when the data is not yet available. Because of this the chart was rendered with no data but title and legend. When you resize, chart will be re-rendered, data would be updated from csv by then.

d3.csv execution:

d3.csv("path/to/file.csv", function(rows) {

For more info refer stackoverflow.

Here is your working code. (Note:CSV and function related to checkbox-Abby has been updated and working fine, kindly follow same for other checkboxes aswell. proj4.js file has been saved and linked from codepen).