Question

I am using D3 to visualize some data. The chart works find when reading TSV file. However, I would like to use the x and y axis to represent data from two separate arrays. This is what I've got:

var Arr1 = "some data"

var Arr2 = "some data"

 x.domain(data.map(function(d) { return Arr1; }));

 y.domain([0, d3.max(data, function(d) { return Arr2; })]);

I know that is not the appropriate way to replace it. Anyone able to advise?

Was it helpful?

Solution

You would need to pass the new arrays to the appropriate functions:

x.domain(d3.extent(Arr1));
y.domain([0, d3.max(Arr2)]);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top