Skip to content

Instantly share code, notes, and snippets.

@Andrew-Reid
Created July 10, 2018 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Andrew-Reid/f66c7bd795f156f1372cb436175b9b40 to your computer and use it in GitHub Desktop.
Save Andrew-Reid/f66c7bd795f156f1372cb436175b9b40 to your computer and use it in GitHub Desktop.
addHeadersDSV v5
20180601 000000;1.168200;1.168240;1.168140;1.168230;0;
20180601 000100;1.168220;1.168230;1.168190;1.168190;0;
20180601 000200;1.168180;1.168180;1.168080;1.168120;0;
20180601 000300;1.168130;1.168160;1.168130;1.168140;0;
<!DOCTYPE html>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v5.min.js"></script>
<script>
var time_parse = d3.timeParse( '%Y%m%d %H%M%S');
var time_format = d3.timeFormat('%H%M');
var dsv = d3.dsvFormat(";");
var headers = ["time;number1;number2;number3;number4;number5;\n"]
d3.text("dsv.dsv").then(function(text) {
var data = dsv.parse(headers+text);
data.forEach(function(e,i){
data[i].time = time_parse(e.date);
})
console.log(data);
console.log(data.columns);
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment