data-focused js functions, direct relevance to D3js Sankey/Hierarchical Data Structures JS FUNCTIONS: Trie Data Structures, Stacks, Queue, Priority Queue
Files:
jquery-ES6 method compare and browser polyfills
#trieDataStructure.js Trie - this.add, this.isWord, this.print
data-focused js functions, direct relevance to D3js Sankey/Hierarchical Data Structures JS FUNCTIONS: Trie Data Structures, Stacks, Queue, Priority Queue
Files:
jquery-ES6 method compare and browser polyfills
#trieDataStructure.js Trie - this.add, this.isWord, this.print
d3.csvParse("foo,bar\n1,2"); // [{foo: "1", bar: "2"}, columns: ["foo", "bar"]]
d3.tsvParse("foo\tbar\n1\t2"); // [{foo: "1", bar: "2"}, columns: ["foo", "bar"]]
Or to format:
d3.csvFormat([{foo: "1", bar: "2"}]); // "foo,bar\n1,2"
d3.tsvFormat([{foo: "1", bar: "2"}]); // "foo\tbar\n1\t2"
To use a different delimiter, such as “|” for pipe-separated values, use d3.dsvFormat:
var psv = d3.dsvFormat("|");
console.log(psv.parse("foo|bar\n1|2")); // [{foo: "1", bar: "2"}, columns: ["foo", "bar"]]
For easy loading of DSV files in a browser, see d3-request’s d3.csv and d3.tsv methods.
If you use NPM, npm install d3-dsv
. Otherwise, download the latest release. You can also load directly from d3js.org, either as a standalone library or as part of D3 4.0. AMD, CommonJS, and vanilla environments are supported. In vanilla, a d3
global is exported:
<script src="https://d3js.org/d3-dsv.v1.min.js"></script>
<script>
var data = d3.csvParse(string);
</script>