UNPKG

simple-chartjs

Version:

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

101 lines (96 loc) 2.9 kB
<div style='text-align: center;'> <a target='_blank' href='https://www.npmjs.com/package/simple-chartjs'> <img src='https://i.imgur.com/m0ktE8a.png' /> </a> </div> <div style='text-align: center;'> Un module simple d'utilisation, rapide et puissant ! </div> ## Exemples <details> <summary>Exemple de graphique linéaire</summary> <br /> ```js 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(); })(); ``` <details style='margin-left: 3rem;'> <summary>Voir le résultat</summary> <br /> <img src='https://i.imgur.com/y7xO1XF.png' /> </details> </details> <details style='margin-top: 3rem;'> <summary>Exemple de graphique donnut</summary> <br /> ```js 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(); })(); ``` <details style='margin-left: 3rem;'> <summary>Voir le résultat</summary> <br /> <img src='https://i.imgur.com/ydHvPbz.png' /> </details> </details>