سؤال

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?

هل كانت مفيدة؟

المحلول

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

x.domain(d3.extent(Arr1));
y.domain([0, d3.max(Arr2)]);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top