Run ❯
Get your
own
website
Result Size:
625 x 565
❯
Run Code
Ctrl+Alt+R
Save Code
Ctrl+Alt+A
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
<!DOCTYPE html> <html> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script> <body> <canvas id="myChart" style="width:100%;max-width:600px"></canvas> <script> var xValues = ["Italy", "France", "Spain", "USA", "Argentina"]; var yValues = [55, 49, 44, 24, 15]; var barColors = [ "rgba(255,0,0,1.0)", "rgba(255,0,0,0.8)", "rgba(255,0,0,0.6)", "rgba(255,0,0,0.4)", "rgba(255,0,0,0.2)" ]; new Chart("myChart", { type: "bar", data: { labels: xValues, datasets: [{ backgroundColor: barColors, data: yValues }] }, options: { legend: {display: false}, scales: { yAxes: [{ ticks: { beginAtZero: true } }], } } }); </script> </body> </html>