I am brand new to D3 and begin working on a new project. My question is this. I need to load two local CSV files and visualize them to two separate line charts(not multi-line charts),which contain independent x axis and y axis. The final purpose is to compare these two charts with a vertical line penetrating both of them and both charts can be zooming or panning synchronously.
I created two SVGs for both of two separate charts and used two consecutive calls to d3.csv()
to load two csv files such as
d3.csv("file1.csv", function(error, data) {
//functions control the first chart
});
d3.csv("file2.csv", function(error, dataㄉ) {
//functions control the second chart
});
However, finally I found that contents inside the first d3.csv()
cannot be used in the second d3.csv()
.
Shouldn't I use different svg
, or I need to apply new way to load two csv files but not using two independent d3.csv()
?