Hi I am new to d3.js.I have this following [WebMethod] in .aspx file:
[WebMethod]
public static List GetProductsLINQ(
Unlike d3.csv
and d3.tsv
, d3.json
does not accept an accessor function (or row function).
According to the API, these are the arguments of a d3.csv
:
d3.csv(url, row, callback);
Compare with the argument of a d3.json
:
d3.json(url[, callback])
I'm pasting your function and commenting out everything that is an accessor (row) function:
d3.json("WebForm1.aspx/GetProductsLINQ", //function (json) {
//d=json
//d.Product_Code = +d.Product_Code;
//return d;
//},
function (error, data) {
if (error) throw error;
So, it should be only:
d3.json("WebForm1.aspx/GetProductsLINQ", function (error, data) {
if (error) throw error;
And then, right after it, put your accessor (row) function inside d3.json
as a forEach
:
data.forEach(function(d){
d.Product_Code = +d.Product_Code;
});