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

Advertising

3 - Example

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

s = `id,value
1,First
2,Second`;
 
var dataArray = d3.csvParse(s, function(d) {
        return {
            id: d.id, 
            value: d.value,
            i2d: d.id*2 // 2 * id transformation
        };
});
console.table(dataArray);

viz/d3/dsv.txt · Last modified: 2019/02/16 17:40 by gerardnico