D3 - DSV

> Data Visualization (vis|viz|graphic|image) > D3 (Data-Driven Documents)

1 - About

d3-dsv is a library to parse a DSV string (not file) into an array of rows where the property are the headers. To parse a CSV file, see D3 - CSV.

Each value from the CSV is stored as a string, even the numbers


3 - Example

A template string containing the CSV data is passed to the d3.csvParse function.

s = `id,value
var dataArray = d3.csvParse(s, function(d) {
        return {
            id: d.id, 
            value: d.value,
            i2d: d.id*2 // 2 * id transformation