UNPKG

simple-chartjs

Version:

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

34 lines 1.09 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' }, type: 'doughnut' }, options: { backgroundColor: 'white', labelsColor: 'black', displayValues: true }, data: { labels: ['Rouge', 'Bleu', 'Jaune'], graphs: [ new Graph({ borderColor: 'white', values: [300, 50, 100], backgroundColor: [ 'rgb(255, 99, 132)', 'rgb(54, 162, 235)', 'rgb(255, 205, 86)' ] }) ] } }); const image = await chart.renderToBuffer(); })();