I'm trying to use d3js graph. In the example, it gets the data like this :
d3.tsv("data.tsv", function(d) {
d.frequency = +d.frequency;
return d;
}, function(error, data) {
if (error) throw error;
x.domain(data.map(function(d) { return d.letter; }));
y.domain([0, d3.max(data, function(d) { return d.frequency; })]);
And the data.tsv file is something like this :
letter frequency
A .08167
B .01492
C .02782
D .04253
E .12702
F .02288
G .02015
Suppose I have a List of tuples like this :
public class myData {
public string x {get; set;}
public int y {get; set;}
}
myData data1 = new myData("A", 1);
myData data2 = new myData("B", 3);
List<myData> list1 = new List<myData>()
{
data1, data2
};
How can I pass this list1 to d3js? Thanks in advance.