How to use the d3-dsv.tsvParse function in d3-dsv

To help you get started, we’ve selected a few d3-dsv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / d3-dsv / d3-dsv-tests.ts View on Github external
// ------------------------------------------------------------------------------------------

// tsvParse(...) ============================================================================

// without row mapper -----------------------------------------------------------------------

parseArray = d3Dsv.tsvParse(tsvTestStringWithHeader);

columns = parseArray.columns;

str = parseArray[0]['Year'];
// date = parseArray[0]['Year']; // fails, return value is string

// with row mapper ---------------------------------------------------------------------------

parseMappedArray = d3Dsv.tsvParse(tsvTestStringWithHeader, (rawRow, index, columns) => {
    let rr: d3Dsv.DSVRowString = rawRow;
    let i: number = index;
    let c: string[] = columns;
    let pr: ParsedTestObject;

    pr = {
        year: new Date(+rr['Year'], 0, 1),
        make: rr['Make'],
        model: rr['Model'],
        length: +rr['Length']
    };

    return pr;

});
github tensorflow / lucid / lucid / scratch / js / src / load.js View on Github external
  return text(url).then(text => Promise.resolve(tsvParse(text)));
}
github rrag / react-stockcharts-examples2 / examples / CandleStickChartWithMA / src / utils.js View on Github external
		.then(data => tsvParse(data, parseData(parseDate)))
	return promiseMSFT;
github distillpub / post--activation-atlas / src / library / load.js View on Github external
  return text(url).then(text => Promise.resolve(tsvParse(text)));
}
github rrag / react-stockcharts-examples2 / examples / CandleStickChartForDiscontinuousIntraDay / src / utils.js View on Github external
		.then(data => tsvParse(data, parseData(d => new Date(+d))));
	return promiseIntraDayDiscontinuous;
github antvis / data-set / bin / doc-format.js View on Github external
.action(filename => {
    const content = fs.readFileSync(resolve(filename), 'utf8');
    const converted = JSON.stringify(d3Dsv.tsvParse(content), null, 2);
    process.stdout.write(converted);
  });
github wooorm / iso-639-3 / build.js View on Github external
function onconcat(body) {
  var data = dsv.tsvParse(String(body)).map(mapper)

  fs.writeFile('index.json', JSON.stringify(data, 0, 2) + '\n', bail)
}
github rrag / react-stockcharts / docs / index.js View on Github external
		.then(data => tsvParse(data, d => {
			d.date = new Date(parseDate(d.date).getTime());
			d.open = +d.open;
			d.high = +d.high;
			d.low = +d.low;
			d.close = +d.close;
			d.volume = +d.volume;

			return d;
		}))
		.then(data => {
github rrag / react-stockcharts-examples2 / examples / CandleStickChartWithCompare / src / utils.js View on Github external
		.then(data => tsvParse(data, d => {
			d = parseData(parseDate)(d);
			d.SP500Close = +d.SP500Close;
			d.AAPLClose = +d.AAPLClose;
			d.GEClose = +d.GEClose;
			return d;
		}));
	return promiseCompare;
github antvis / data-set / src / connector / dsv.ts View on Github external
DataSet.registerConnector('tsv', (str: string) => {
  return tsvParse(str);
});