D3 has no built-in way to ignore comment lines. The easiest option is to pre-process the file before parsing with D3:
d3.text(url, 'text/csv', function(csv) { // remove comment rows with regex - not fully tested, but should work csv = csv.replace(/^[#@][^\r\n]+[\r\n]+/mg, ''); var data = d3.csv.parse(csv); // ... now the rest of your code ... });
source share