UNPKG

simple-chartjs

Version:

Un module ChartJS simple d'utilisation, rapide et puissant !

31 lines 1 kB
const { Chart, Graph } = require('../src/index'); (async () => { const chart = new Chart({ sizes: { width: 400, height: 400 }, identity: { title: { text: "Titre du graphique", color: 'black', font: { size: 16 } }, subtitle: { text: "Sous-titre du graphique", color: 'gray' } }, options: { backgroundColor: 'white', labelsColor: 'black' }, data: { labels: ['Premier', 'Deuxième', 'Troisième'], graphs: [ new Graph({ label: 'Titre de la courbe', type: 'line', borderColor: 'rgb(54, 162, 235)', values: [300, 50, 100], backgroundColor: 'rgb(54, 162, 235)' }) ] } }); const image = await chart.renderToBuffer(); })();