Google Charts - Material Bar Chart

You are Here:

How to Draw a Material Bar Chart?

Please wait google chart is loading...

In this example, we will draw a material bar chart. Please hover the bars in the above chart to view particular details.


HTML Online Editor
<!DOCTYPE html> <html lang="en-US"> <head> <script src=""></script> </head> <body> <div id="point"> </div> <script> google.charts.load('current', {'packages':['bar']}); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Month', 'Baked', 'Sold', 'Unsold'], ['Jan', 750, 700, 50], ['Feb', 800, 700, 100], ['Mar', 600, 400, 200], ['Apr', 1000, 850, 150] ]); var options = { chart: { title: 'Black Forest Cake', subtitle: 'Cakes Baked, Sold and Unsold: Jan 19 - Apr 19', }, bars: 'horizontal', // Required for Material Bar Charts. hAxis: { format: 'decimal' }, height: 400, colors: ['#1b9e77', '#d95f02', '#7570b3'] }; var chart = new google.charts.Bar(document.getElementById('point')); chart.draw(data, google.charts.Bar.convertOptions(options)); var btns = document.getElementById('btn-group'); btns.onclick = function (e) { if ( === 'BUTTON') { options.hAxis.format = === 'none' ? '' :; chart.draw(data, google.charts.Bar.convertOptions(options)); } } } </script> </body> </html>


Hi Developers, we almost covered 98% of Google Charts Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in Google Charts.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author