Module

x/vega_lite/bin/vl2svg

A concise grammar of interactive graphics, built on Vega.
Latest
File
#!/usr/bin/env node
// Render a Vega-Lite specification to SVGconst {writeFile} = require('fs');const render = require('./render');
const svgHeader = '<?xml version="1.0" encoding="utf-8"?>\n' + '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ' + '"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n';render('svg', function (body, arg) { const svg = (arg.h ? svgHeader : '') + body; const file = arg._[1] || null; if (file) { // write to file writeFile(file, svg, err => { if (err) throw err; }); } else { // write to stdout process.stdout.write(svg); }});