Last active
June 6, 2019 21:19
-
-
Save vbarbarosh/5d2295306885251e3b8f7e53fac83b0f to your computer and use it in GitHub Desktop.
chartjs – Rendering charts with chart.js https://codescreens.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Rendering charts with chart.js --> | |
| <div style="position:absolute; top:0; left:0; width:100%; height:100%;"> | |
| <canvas id="canvas" style="width:100%; height:100%;"></canvas> | |
| </div> | |
| <script src="https://unpkg.com/[email protected]/dist/Chart.min.js"></script> | |
| <script> | |
| new Chart(document.getElementById('canvas').getContext('2d'), { | |
| type: 'line', // line|bar | |
| data: { | |
| labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'], | |
| datasets: [{ | |
| label: 'Red', | |
| borderColor: '#f88', | |
| backgroundColor: '#f88', | |
| data: [2, 10, 5, 2, 20, 30, 45], | |
| fill: false, | |
| },{ | |
| label: 'Blue', | |
| borderColor: '#88f', | |
| backgroundColor: '#88f', | |
| data: [5, 8, 5, 3, 12, 30, 45], | |
| fill: false, | |
| }] | |
| }, | |
| options: { | |
| maintainAspectRatio: false, | |
| } | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment