18 lines
397 B
JavaScript
Raw Normal View History

2021-02-14 19:52:56 -06:00
const fs = require('fs');
const QuickChart = require('../index');
const qc = new QuickChart();
qc.setConfig({
type: 'bar',
data: { labels: ['Hello world', 'Foo bar'], datasets: [{ label: 'Foo', data: [1, 2] }] },
});
qc.setWidth(500).setHeight(300).setBackgroundColor('transparent');
async function saveChart() {
// Write file to disk
await qc.toFile('/tmp/chart.png');
}
saveChart();