Google Charts - Basic Gantt Chart

You are Here:

How to Draw a Basic Gantt Chart?

Please wait google chart is loading...

In this example, we will draw a basic gantt 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':['gantt']}); google.charts.setOnLoadCallback(drawChart); function daysToMilliseconds(days) { return days * 24 * 60 * 60 * 1000; } function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('string', 'Task ID'); data.addColumn('string', 'Task Name'); data.addColumn('date', 'Start Date'); data.addColumn('date', 'End Date'); data.addColumn('number', 'Duration'); data.addColumn('number', 'Percent Complete'); data.addColumn('string', 'Dependencies'); data.addRows([ ['Study', 'Math', new Date(2015, 0, 1), new Date(2015, 0, 5), null, 75, null], ['Chapter1', 'Ven diagram', null, new Date(2015, 0, 9), daysToMilliseconds(3), 25, 'Study,chapter4'], ['chapter2', 'Geometery', null, new Date(2015, 0, 7), daysToMilliseconds(1), 20, 'Study'], ['chapter3', 'Algebra', null, new Date(2015, 0, 10), daysToMilliseconds(1), 0, 'chapter2,Chapter1'], ['chapter4', 'Trigonometry', null, new Date(2015, 0, 6), daysToMilliseconds(1), 100, 'Study'] ]); var options = { height: 400 }; var chart = new google.visualization.Gantt(document.getElementById('point')); chart.draw(data, 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