<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script> function createChart(data) { const ctx = document.getElementById('myChart'); new Chart(ctx, { type: 'bar', data: { labels: data.labels, datasets: [{ label: data.label, data: data.data1, backgroundColor: '#003f5c ', borderWidth: 2 }, { label: '# of Views', data: data.data2, backgroundColor: '#ff6e54 ', borderWidth: 3 } ] }, options: { scales: { y: { beginAtZero: true } } } }); } </script>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter