You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
397 B
18 lines
397 B
4 years ago
|
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();
|