d3.tsv()

d3.tsv(url[[, row], callback])

Creates a request for the TSV file at the specified url with the default mime type text/tab-separated-values. An optional row conversion function may be specified to map and filter row objects to a more-specific representation; see dsv.parse for details. For example:

function row(d) {
  return {
    year: new Date(+d.Year, 0, 1), // convert "Year" column to Date
    make: d.Make,
    model: d.Model,
    length: +d.Length // convert "Length" column to number
  };
}

The row conversion function can be changed by calling request.row on the returned instance. For example, this:

d3.tsv(url, row, callback);

Is equivalent to this:

d3.tsv(url)
    .row(row)
    .get(callback);

This convenience constructor is approximately equivalent to:

d3.request(url)
    .mimeType("text/tab-separated-values")
    .response(function(xhr) { return d3.tsvParse(xhr.responseText, row); })
    .get(callback);
doc_D3_Js
2016-11-24 10:27:34
Comments
Leave a Comment

Please login to continue.