chiasm-dsv-dataset
A Chiasm component that loads delimiter separated value (DSV) data tables. This is a thin wrapper around the dsv-dataset module, which is a metadata specification and parsing library for data sets. Take a look at the unit test for example usage. When a "path" property is specified, the component appends ".csv" and ".json" to it and uses an XMLHttpRequest to fetch those two paths. The ".csv" fils should contain a data table, and the ".json" file should contain metadata about the table including column types.
Example use:
The following script will set up the component in a Chiasm application:
var chiasm = ;chiasmpluginsdsvDataset = ChiasmDsvDataset;chiasm;
Here are a few sample lines from http://bl.ocks.org/curran/raw/b6e1d23c16dc76371a92/iris.csv
:
sepal_length,sepal_width,petal_length,petal_width,class
5.3,3.7,1.5,0.2,setosa
5.7,2.8,4.1,1.3,versicolor
5.8,2.7,5.1,1.9,virginica
Here is the content of http://bl.ocks.org/curran/raw/b6e1d23c16dc76371a92/iris.json
:
The following code will print out the parsed table:
chiasm;
The following JSON will be printed:
Notice how numeric columns have been parsed to numbers.
To see how this component can be used to fetch data for visualizations, check out this Magic Bar Chart example.