Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!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 = ["red", "green","blue","orange","brown"]; new Chart("myChart", { type: "horizontalBar", data: { labels: xValues, datasets: [{ backgroundColor: barColors, data: yValues }] }, options: { legend: {display: false}, title: { display: true, text: "World Wine Production 2018" }, scales: { xAxes: [{ticks: {min: 10, max:60}}] } } }); </script> </body> </html>