{"id":8634,"date":"2019-09-04T12:59:56","date_gmt":"2019-09-04T12:59:56","guid":{"rendered":"https:\/\/www.anychart.com\/blog\/?p=8634"},"modified":"2026-03-03T11:59:53","modified_gmt":"2026-03-03T11:59:53","slug":"create-gantt-chart-javascript","status":"publish","type":"post","link":"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/","title":{"rendered":"Create Simple Gantt Chart Using JavaScript \u2014 Tutorial"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/Gantt-chart-can-greatly-visualize-data-for-project-management.jpg\" alt=\"Create Simple Gantt Chart Using JavaScript \u2014 Tutorial\" width=\"100%\" class=\"alignnone size-full wp-image-8640\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/Gantt-chart-can-greatly-visualize-data-for-project-management.jpg 1400w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/Gantt-chart-can-greatly-visualize-data-for-project-management-300x200.jpg 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/Gantt-chart-can-greatly-visualize-data-for-project-management-768x512.jpg 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/Gantt-chart-can-greatly-visualize-data-for-project-management-1024x682.jpg 1024w\" sizes=\"(max-width: 1400px) 100vw, 1400px\" \/><\/p>\n<blockquote><p><strong><em>Use a JavaScript library to create a <a href=\"https:\/\/www.anychart.com\/chartopedia\/chart-type\/gantt-chart\/\">Gantt chart<\/a> and take your project management efforts to the next level.<\/em><\/strong><\/p><\/blockquote>\n<blockquote><p><strong><em>Need to create a <a href=\"https:\/\/www.anychart.com\/chartopedia\/chart-type\/resource-chart\/\">resource chart<\/a> instead? See the <a href=\"https:\/\/www.anychart.com\/blog\/2021\/08\/17\/js-resource-gantt-chart\/\">Resource Chart Tutorial<\/a>.<\/em><\/strong><\/p><\/blockquote>\n<p>Earlier this year, my team was looking for a project management tool that could assist us in charting the various tasks related to our app development project against some specific timelines. After doing some research, we finally settled on Gantt charts. However, some people think Gantts are complicated to create. Not true! Thanks to <a href=\"https:\/\/en.wikipedia.org\/wiki\/Comparison_of_JavaScript_charting_libraries\" target=\"_blank\" rel=\"nofollow\">numerous<\/a> JavaScript chart libraries, data visualization is now simple, flexible, and embeddable.<\/p>\n<p>In our situation, we settled on AnyChart\u2019s <a href=\"https:\/\/www.anychart.com\/\">JS Charts<\/a> library because of its ease of use, extensive documentation, flexible code playground for trying out stuff, and other powerful features.<\/p>\n<p>In this tutorial, I\u2019ll walk you through how to create a simple interactive Gantt chart using this data visualization library. Here\u2019s what we\u2019ll be making and you can get the entire code for creating such a Gantt chart at the end of the tutorial:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/create-gantt-chart-1.png\" alt=\"Gantt chart created along this JavaScript charting tutorial\" width=\"100%\" class=\"alignnone size-full wp-image-8643\" \/><\/p>\n<p><!--more Read the JS charting tutorial \u00bb--><\/p>\n<h2>Creating a JS Gantt chart in 4 steps<\/h2>\n<p>Let\u2019s get our hands dirty and use the JavaScript library to create a simple Gantt chart for scheduling and monitoring project activities.<\/p>\n<p>In this JS charting tutorial, we\u2019ll follow these four steps:<\/p>\n<ul>\n<li><strong>Step 1:<\/strong> Preparing the data<\/li>\n<li><strong>Step 2:<\/strong> Getting dependencies<\/li>\n<li><strong>Step 3:<\/strong> Declaring the chart container<\/li>\n<li><strong>Step 4:<\/strong> Rendering the Gantt chart<\/li>\n<\/ul>\n<h3>Step 1: Preparing the data<\/h3>\n<p>The first step in building a Gantt chart using JavaScript is to prepare the data that will be displayed. The AnyChart library requires data to be represented using the tree data model.<\/p>\n<p>In this model, the data is organized as a hierarchical tree-like structure in which parent-child relationships are used to connect the various data items.<\/p>\n<p>As such, the parent data item will have a <code>children<\/code> data field in which the child items are stated as an array.<\/p>\n<p>Let me show you an example of what I\u2019m talking about:<\/p>\n<pre class=\"javascript\"><code>var data = [{\n\tid: \"1\",\n\tname: \"Development Life Cycle\",\n\tactualStart: Date.UTC(2018, 01, 02),\n\tactualEnd: Date.UTC(2018, 06, 15),\n\tchildren: [{\n\t\t\tid: \"1_1\",\n\t\t\tname: \"Planning\",\n\t\t\tactualStart: Date.UTC(2018, 01, 02),\n\t\t\tactualEnd: Date.UTC(2018, 01, 22),\n\t\t\tconnectTo: \"1_2\",\n\t\t\tconnectorType: \"finish-start\",\n\t\t\tprogressValue: \"75%\"\n\t\t},\n\t\t\/\/ more data goes here\n\t]\n}];<\/code><\/pre>\n<h3>Step 2: Getting dependencies<\/h3>\n<p>AnyChart utilizes a minimalist, modular-based approach that lets you get only those dependencies that are essential for your project, which greatly shrinks the size of the deployed code, leading to enhanced performance.<\/p>\n<p>For creating the Gantt chart, we\u2019ll add the following Core and Gantt modules in the <code>&lt;head&gt;<\/code> section of our web page.<\/p>\n<pre class=\"html\"><code>&lt;head&gt;\n&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.6.0\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\n&lt;script src =\"https:\/\/cdn.anychart.com\/releases\/8.6.0\/js\/anychart-gantt.min.js\"&gt;&lt;\/script&gt;\n&lt;\/head&gt;<\/code><\/pre>\n<h3>Step 3: Declaring the chart container<\/h3>\n<p>Then, let\u2019s create a container where the Gantt chart will load to.<\/p>\n<pre class=\"html\"><code>&lt;body&gt;\n&lt;div id=\"container\"&gt;&lt;\/div&gt;\n&lt;body&gt;<\/code><\/pre>\n<p>Notice that I\u2019ve given the <code>&lt;div&gt;<\/code> element and <code>id<\/code> of <code>\u201ccontainer\u201d<\/code> to be referenced in the next step.<\/p>\n<h3>Step 4: Rendering the Gantt chart<\/h3>\n<p>Lastly, we\u2019ll follow these steps to render the Gantt chart:<\/p>\n<p>Create the data tree by passing the prepared data to the <code>anychart.data.tree()<\/code> method. For the second parameter, we\u2019ll specify it as <code>\u201cas-tree\u201d<\/code>.<\/p>\n<pre class=\"javascript\"><code>var treeData = anychart.data.tree(data, \"as-tree\");<\/code><\/pre>\n<p>Create the project Gantt chart by calling the <code>anychart.ganttProject(<\/code>) chart constructor:<\/p>\n<pre class=\"javascript\"><code>var chart = anychart.ganttProject();<\/code><\/pre>\n<p>Set the data by passing the created data tree to the chart\u2019s <code>data()<\/code> method:<\/p>\n<pre class=\"javascript\"><code>chart.data(treeData);<\/code><\/pre>\n<p>Configure the timeline\u2019s scale up to the date that the project will end:<\/p>\n<pre class=\"javascript\"><code>chart.getTimeline().scale().maximum(Date.UTC(2018, 06, 30));<\/code><\/pre>\n<p>Reference the chart container <code>id<\/code> we\u2019d set previously:<\/p>\n<pre class=\"javascript\"><code>chart.container(\"container\");<\/code><\/pre>\n<p>Initiate drawing the chart:<\/p>\n<pre class=\"javascript\"><code>chart.draw();<\/code><\/pre>\n<p>Fitt the specified activities within the width of the timeline:<\/p>\n<pre class=\"javascript\"><code>chart.fitAll();<\/code><\/pre>\n<p>Here is the entire code I used for creating the Gantt chart on the picture above:<\/p>\n<p>(You can also view the code <a href=\"https:\/\/playground.anychart.com\/acWMIRq6\" target=\"_blank\" rel=\"nofollow\">here<\/a>).<\/p>\n<pre><code>&lt;html&gt;\n&lt;head&gt;\n&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.6.0\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\n&lt;script src =\"https:\/\/cdn.anychart.com\/releases\/8.6.0\/js\/anychart-gantt.min.js\"&gt;&lt;\/script&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n&lt;div id = \"container\" &gt;&lt;\/div&gt;\n&lt;script&gt;\nanychart.onDocumentReady(function () {\n\t\/\/ create data\n\tvar data = [{\n\t\tid: \"1\",\n\t\tname: \"Development Life Cycle\",\n\t\tactualStart: Date.UTC(2018, 01, 02),\n\t\tactualEnd: Date.UTC(2018, 06, 15),\n\t\tchildren: [{\n\t\t\t\tid: \"1_1\",\n\t\t\t\tname: \"Planning\",\n\t\t\t\tactualStart: Date.UTC(2018, 01, 02),\n\t\t\t\tactualEnd: Date.UTC(2018, 01, 22),\n\t\t\t\tconnectTo: \"1_2\",\n\t\t\t\tconnectorType: \"finish-start\",\n\t\t\t\tprogressValue: \"75%\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"1_2\",\n\t\t\t\tname: \"Design and Prototyping\",\n\t\t\t\tactualStart: Date.UTC(2018, 01, 23),\n\t\t\t\tactualEnd: Date.UTC(2018, 02, 20),\n\t\t\t\tconnectTo: \"1_3\",\n\t\t\t\tconnectorType: \"start-start\",\n\t\t\t\tprogressValue: \"60%\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"1_3\",\n\t\t\t\tname: \"Evaluation Meeting\",\n\t\t\t\tactualStart: Date.UTC(2018, 02, 23),\n\t\t\t\tactualEnd: Date.UTC(2018, 02, 23),\n\t\t\t\tconnectTo: \"1_4\",\n\t\t\t\tconnectorType: \"start-start\",\n\t\t\t\tprogressValue: \"80%\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"1_4\",\n\t\t\t\tname: \"Application Development\",\n\t\t\t\tactualStart: Date.UTC(2018, 02, 26),\n\t\t\t\tactualEnd: Date.UTC(2018, 04, 26),\n\t\t\t\tconnectTo: \"1_5\",\n\t\t\t\tconnectorType: \"finish-finish\",\n\t\t\t\tprogressValue: \"90%\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"1_5\",\n\t\t\t\tname: \"Testing\",\n\t\t\t\tactualStart: Date.UTC(2018, 04, 29),\n\t\t\t\tactualEnd: Date.UTC(2018, 05, 15),\n\t\t\t\tconnectTo: \"1_6\",\n\t\t\t\tconnectorType: \"start-finish\",\n\t\t\t\tprogressValue: \"60%\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"1_6\",\n\t\t\t\tname: \"Deployment\",\n\t\t\t\tactualStart: Date.UTC(2018, 05, 20),\n\t\t\t\tactualEnd: Date.UTC(2018, 05, 27),\n\t\t\t\tconnectTo: \"1_7\",\n\t\t\t\tconnectorType: \"start-finish\",\n\t\t\t\tprogressValue: \"100%\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"1_7\",\n\t\t\t\tname: \"Maintenance\",\n\t\t\t\tactualStart: Date.UTC(2018, 05, 30),\n\t\t\t\tactualEnd: Date.UTC(2018, 06, 11),\n\t\t\t\tprogressValue: \"40%\"\n\t\t\t},\n\n\t\t]\n\t}];\n\t\/\/ create a data tree\n\tvar treeData = anychart.data.tree(data, \"as-tree\");\n\n\t\/\/ create a chart\n\tvar chart = anychart.ganttProject();\n\n\t\/\/ set the data\n\tchart.data(treeData);\n\t\/\/ configure the scale\n\tchart.getTimeline().scale().maximum(Date.UTC(2018, 06, 30));\n\t\/\/ set the container id\n\tchart.container(\"container\");\n\t\/\/ initiate drawing the chart\n\tchart.draw();\n\t\/\/ fit elements to the width of the timeline\n\tchart.fitAll();\n});\n&lt;\/script&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n<h2>Customizing the Gantt chart design<\/h2>\n<p>AnyChart provides a wide range of options to customize the design of data visualizations to suit your individual preferences and needs. In the data fields, you can set various attributes to customize the look and feel of your Gantt chart.<\/p>\n<p>For example, here are some data fields I specified in the above Gantt chart example:<\/p>\n<ul>\n<li><strong><code>id<\/code><\/strong> \u2014 sets the unique identifier of every task;<\/li>\n<li><strong><code>name<\/code><\/strong> \u2014 sets the name of every task;<\/li>\n<li><strong><code>actualStart<\/code><\/strong> \u2014 sets the start date of every task;<\/li>\n<li><strong><code>actualEnd<\/code><\/strong> \u2014 sets the end date of every task;<\/li>\n<li><strong><code>connectTo<\/code><\/strong> \u2014 is a type of connector that sets the target task;<\/li>\n<li><strong><code>connectorType<\/code><\/strong> \u2014 sets the type of connector, which can be \u201cstart-start,\u201d \u201cstart-finish,\u201d \u201cfinish-start,\u201d or \u201cfinish-finish\u201d;<\/li>\n<li><strong><code>progressValue<\/code><\/strong> \u2014 sets the progress value of every task as a percentage.<\/li>\n<\/ul>\n<p>Furthermore, AnyChart allows the following types of tasks, which can be visualized in different ways:<\/p>\n<ul>\n<li><strong>regular tasks<\/strong> \u2014 do not have relationships with other tasks;<\/li>\n<li><strong>parent tasks<\/strong> \u2014 have parent-child relationships with other tasks;<\/li>\n<li><strong>milestones<\/strong> \u2014 visualize events with zero duration. They can be specified by setting the same date on the <code>actualStart<\/code> and <code>actualEnd<\/code> fields.<\/li>\n<\/ul>\n<h2>Loading data as a table<\/h2>\n<p>If you want to create a chart by loading data from a relational database, you can organize the data as a table with parent\/child links.<\/p>\n<p>In that case, the <code>parent<\/code> field of every item should have the <code>id<\/code> value of its parent specified. Also, you should set the parent of a root item to <code>null<\/code>, or just fail to specify it.<\/p>\n<p>Here is what I\u2019m talking about:<\/p>\n<p>(You can also view the code <a href=\"https:\/\/playground.anychart.com\/IYaBmJLG\" target=\"_blank\" rel=\"nofollow\">here<\/a>).<\/p>\n<pre class=\"javascript\"><code>var data = [{\n\t\tid: 1,\n\t\tparent: null,\n\t\tname: \"Root\",\n\t\tactualStart: Date.UTC(2018, 01, 02),\n\t\tactualEnd: Date.UTC(2018, 06, 15),\n\t},\n\t{\n\t\tid: 2,\n\t\tparent: 1,\n\t\tname: \"Parent 1\",\n\t\tactualStart: Date.UTC(2018, 01, 02),\n\t\tactualEnd: Date.UTC(2018, 01, 22),\n\t\tprogressValue: \"90%\"\n\t},\n\t{\n\t\tid: 3,\n\t\tparent: 2,\n\t\tname: \"Child 1\u20131\",\n\t\tactualStart: Date.UTC(2018, 01, 23),\n\t\tactualEnd: Date.UTC(2018, 02, 20),\n\t\tprogressValue: \"75%\"\n\t},\n\t{\n\t\tid: 4,\n\t\tparent: 2,\n\t\tname: \"Child 1\u20132\",\n\t\tactualStart: Date.UTC(2018, 02, 23),\n\t\tactualEnd: Date.UTC(2018, 02, 23),\n\t\tprogressValue: \"60%\"\n\t},\n\t{\n\t\tid: 5,\n\t\tparent: 1,\n\t\tname: \"Parent 2\",\n\t\tactualStart: Date.UTC(2018, 02, 26),\n\t\tactualEnd: Date.UTC(2018, 04, 26),\n\t\tprogressValue: \"80%\"\n\t},\n\t{\n\t\tid: 7,\n\t\tparent: 5,\n\t\tname: \"Child 2\u20131\",\n\t\tactualStart: Date.UTC(2018, 04, 29),\n\t\tactualEnd: Date.UTC(2018, 05, 15),\n\t\tprogressValue: \"30%\"\n\t},\n];<\/code><\/pre>\n<p>Also, when you load data as a table, don\u2019t forget to change the second parameter in the <code>anychart.data.tree()<\/code> method from <code>\u201cas-tree\u201d<\/code> to <code>\u201cas-table\u201d<\/code>, so the whole line looks as follows:<\/p>\n<pre class=\"javascript\"><code>var treeData = anychart.data.tree(data, \"as-table\");<\/code><\/pre>\n<p>Here is a screenshot of the Gantt chart created when data is loaded as a table:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/create-gantt-chart-2.png\" alt=\"Gantt chart created using JS when data is loaded as a table\" width=\"100%\" class=\"alignnone size-full wp-image-12717\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/create-gantt-chart-2.png 980w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/create-gantt-chart-2-300x110.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/create-gantt-chart-2-768x282.png 768w\" sizes=\"(max-width: 980px) 100vw, 980px\" \/><\/p>\n<h2>Conclusion<\/h2>\n<p>That\u2019s it!<\/p>\n<p>As you can see, creating a Gantt chart using the AnyChart JavaScript charting library is simple and straightforward.<\/p>\n<p>In this tutorial, I\u2019ve just scratched the surface about what you can accomplish with Gantt charts. I hope you\u2019ve learnt the amazing capabilities of this type of chart and how it can assist you in managing your web development tasks.<\/p>\n<p>Of course, you can have a look at the easy to follow AnyChart\u2019s <a href=\"https:\/\/docs.anychart.com\/Gantt_Chart\/Overview\" target=\"_blank\" rel=\"nofollow\">Gantt chart documentation<\/a> to learn more ways of tweaking the Gantt chart to fit your design requirements and assist you in tracking your project management activities.<\/p>\n<p>All the best.<\/p>\n<hr \/>\n<p><em>The &#8220;Create Simple Gantt Chart Using JavaScript \u2014 Tutorial&#8221;\u00a0article is published on the AnyChart blog with permission of Alfrick Opidi.<\/p>\n<p>Originally appeared on <a href=\"https:\/\/towardsdatascience.com\/create-javascript-gantt-chart-55ff8ec08886 target=\"_blank\" rel=\"nofollow\">Towards Data Science<\/a> under the title &#8220;How to Create a Simple Gantt Chart Using JavaScript&#8221; on August 28, 2019.<\/em><\/p>\n<p><!-- SyntaxHighlighter --><link rel=\"stylesheet\" href=\"\/\/cdnjs.cloudflare.com\/ajax\/libs\/highlight.js\/9.12.0\/styles\/default.min.css\"><link rel=\"stylesheet\" href=\"\/\/cdnjs.cloudflare.com\/ajax\/libs\/highlight.js\/9.12.0\/styles\/atom-one-light.min.css\"><script src=\"\/\/cdnjs.cloudflare.com\/ajax\/libs\/highlight.js\/9.12.0\/highlight.min.js\"><\/script><script>hljs.initHighlightingOnLoad();<\/script><\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Use a JavaScript library to create a Gantt chart and take your project management efforts to the next level. Need to create a resource chart instead? See the Resource Chart Tutorial. Earlier this year, my team was looking for a project management tool that could assist us in charting the various tasks related to our [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,16,263,8,17,23,13,279,4],"tags":[35,127,258,54,256,350,775,39,32,55,149,144,36,141,81,57,148,58,65,56,230,227,30,1369,172],"class_list":["post-8634","post","type-post","status-publish","format-standard","hentry","category-anychart-charting-component","category-anygantt","category-big-data","category-business-intelligence","category-gantt-chart","category-html5","category-javascript","category-javascript-chart-tutorials","category-tips-and-tricks","tag-business-intelligence","tag-chart-types","tag-charts","tag-data-visualization","tag-data-visualization-examples","tag-data-visualization-projects","tag-dataviz-projects","tag-gantt-chart","tag-html5","tag-html5-charts","tag-html5-gantt-charts","tag-infographics","tag-javascript","tag-javascript-charting","tag-javascript-charting-library","tag-javascript-charts","tag-javascript-gantt-charts","tag-js-chart","tag-js-charting","tag-js-charts","tag-project-chart","tag-project-management","tag-tips-and-tricks","tag-towards-data-science","tag-tutorial","wpautop"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Create Simple Gantt Chart Using JavaScript \u2014 Tutorial<\/title>\n<meta name=\"description\" content=\"Learn how to quickly create a simple yet stylish interactive Gantt chart using JavaScript. Read this tutorial, it&#039;s a must for front-end web developers.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create Simple Gantt Chart Using JavaScript \u2014 Tutorial\" \/>\n<meta property=\"og:description\" content=\"Learn how to quickly create a simple yet stylish interactive Gantt chart using JavaScript. Read this tutorial, it&#039;s a must for front-end web developers.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"AnyChart News\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/AnyCharts\" \/>\n<meta property=\"article:published_time\" content=\"2019-09-04T12:59:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-03T11:59:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/gantt-chart-js-social.png\" \/>\n<meta name=\"author\" content=\"Alfrick Opidi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How to Create Simple Gantt Chart Using JavaScript \u2014 Tutorial\" \/>\n<meta name=\"twitter:description\" content=\"Learn how to quickly create a simple yet stylish interactive Gantt chart using JavaScript. Read this tutorial, it&#039;s a must for front-end web developers.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/gantt-chart-js-social.png\" \/>\n<meta name=\"twitter:creator\" content=\"@AnyChart\" \/>\n<meta name=\"twitter:site\" content=\"@AnyChart\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Alfrick Opidi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/\"},\"author\":{\"name\":\"Alfrick Opidi\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/b04f8646463ba21baf9c48d4e46809f3\"},\"headline\":\"Create Simple Gantt Chart Using JavaScript \u2014 Tutorial\",\"datePublished\":\"2019-09-04T12:59:56+00:00\",\"dateModified\":\"2026-03-03T11:59:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/\"},\"wordCount\":965,\"commentCount\":3,\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/Gantt-chart-can-greatly-visualize-data-for-project-management.jpg\",\"keywords\":[\"Business Intelligence\",\"chart types\",\"charts\",\"Data Visualization\",\"data visualization examples\",\"data visualization projects\",\"dataviz projects\",\"Gantt Chart\",\"HTML5\",\"html5 charts\",\"html5 gantt charts\",\"infographics\",\"JavaScript\",\"javascript charting\",\"JavaScript charting library\",\"javascript charts\",\"javascript gantt charts\",\"js chart\",\"js charting\",\"js charts\",\"project chart\",\"project management\",\"Tips and tricks\",\"Towards Data Science\",\"tutorial\"],\"articleSection\":[\"AnyChart Charting Component\",\"AnyGantt\",\"Big Data\",\"Business Intelligence\",\"Gantt Chart\",\"HTML5\",\"JavaScript\",\"JavaScript Chart Tutorials\",\"Tips and Tricks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/\",\"url\":\"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/\",\"name\":\"Create Simple Gantt Chart Using JavaScript \u2014 Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/Gantt-chart-can-greatly-visualize-data-for-project-management.jpg\",\"datePublished\":\"2019-09-04T12:59:56+00:00\",\"dateModified\":\"2026-03-03T11:59:53+00:00\",\"author\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/b04f8646463ba21baf9c48d4e46809f3\"},\"description\":\"Learn how to quickly create a simple yet stylish interactive Gantt chart using JavaScript. Read this tutorial, it's a must for front-end web developers.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/#primaryimage\",\"url\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/Gantt-chart-can-greatly-visualize-data-for-project-management.jpg\",\"contentUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/Gantt-chart-can-greatly-visualize-data-for-project-management.jpg\",\"width\":1400,\"height\":933},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.anychart.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create Simple Gantt Chart Using JavaScript \u2014 Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#website\",\"url\":\"https:\/\/www.anychart.com\/blog\/\",\"name\":\"AnyChart News\",\"description\":\"AnyChart JS Charts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.anychart.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/b04f8646463ba21baf9c48d4e46809f3\",\"name\":\"Alfrick Opidi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c544d1b91e74e29c40ec7e45a0d2281753ea00fbc1c76efb32e865a081574823?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c544d1b91e74e29c40ec7e45a0d2281753ea00fbc1c76efb32e865a081574823?s=96&r=g\",\"caption\":\"Alfrick Opidi\"},\"url\":\"https:\/\/www.anychart.com\/blog\/author\/alfrick_opidi\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create Simple Gantt Chart Using JavaScript \u2014 Tutorial","description":"Learn how to quickly create a simple yet stylish interactive Gantt chart using JavaScript. Read this tutorial, it's a must for front-end web developers.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/","og_locale":"en_US","og_type":"article","og_title":"How to Create Simple Gantt Chart Using JavaScript \u2014 Tutorial","og_description":"Learn how to quickly create a simple yet stylish interactive Gantt chart using JavaScript. Read this tutorial, it's a must for front-end web developers.","og_url":"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/","og_site_name":"AnyChart News","article_publisher":"https:\/\/www.facebook.com\/AnyCharts","article_published_time":"2019-09-04T12:59:56+00:00","article_modified_time":"2026-03-03T11:59:53+00:00","og_image":[{"url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/gantt-chart-js-social.png","type":"","width":"","height":""}],"author":"Alfrick Opidi","twitter_card":"summary_large_image","twitter_title":"How to Create Simple Gantt Chart Using JavaScript \u2014 Tutorial","twitter_description":"Learn how to quickly create a simple yet stylish interactive Gantt chart using JavaScript. Read this tutorial, it's a must for front-end web developers.","twitter_image":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/gantt-chart-js-social.png","twitter_creator":"@AnyChart","twitter_site":"@AnyChart","twitter_misc":{"Written by":"Alfrick Opidi","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/#article","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/"},"author":{"name":"Alfrick Opidi","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/b04f8646463ba21baf9c48d4e46809f3"},"headline":"Create Simple Gantt Chart Using JavaScript \u2014 Tutorial","datePublished":"2019-09-04T12:59:56+00:00","dateModified":"2026-03-03T11:59:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/"},"wordCount":965,"commentCount":3,"image":{"@id":"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/Gantt-chart-can-greatly-visualize-data-for-project-management.jpg","keywords":["Business Intelligence","chart types","charts","Data Visualization","data visualization examples","data visualization projects","dataviz projects","Gantt Chart","HTML5","html5 charts","html5 gantt charts","infographics","JavaScript","javascript charting","JavaScript charting library","javascript charts","javascript gantt charts","js chart","js charting","js charts","project chart","project management","Tips and tricks","Towards Data Science","tutorial"],"articleSection":["AnyChart Charting Component","AnyGantt","Big Data","Business Intelligence","Gantt Chart","HTML5","JavaScript","JavaScript Chart Tutorials","Tips and Tricks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/","url":"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/","name":"Create Simple Gantt Chart Using JavaScript \u2014 Tutorial","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/#primaryimage"},"image":{"@id":"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/Gantt-chart-can-greatly-visualize-data-for-project-management.jpg","datePublished":"2019-09-04T12:59:56+00:00","dateModified":"2026-03-03T11:59:53+00:00","author":{"@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/b04f8646463ba21baf9c48d4e46809f3"},"description":"Learn how to quickly create a simple yet stylish interactive Gantt chart using JavaScript. Read this tutorial, it's a must for front-end web developers.","breadcrumb":{"@id":"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/#primaryimage","url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/Gantt-chart-can-greatly-visualize-data-for-project-management.jpg","contentUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2019\/09\/Gantt-chart-can-greatly-visualize-data-for-project-management.jpg","width":1400,"height":933},{"@type":"BreadcrumbList","@id":"https:\/\/www.anychart.com\/blog\/2019\/09\/04\/create-gantt-chart-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.anychart.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Create Simple Gantt Chart Using JavaScript \u2014 Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/www.anychart.com\/blog\/#website","url":"https:\/\/www.anychart.com\/blog\/","name":"AnyChart News","description":"AnyChart JS Charts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.anychart.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/b04f8646463ba21baf9c48d4e46809f3","name":"Alfrick Opidi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c544d1b91e74e29c40ec7e45a0d2281753ea00fbc1c76efb32e865a081574823?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c544d1b91e74e29c40ec7e45a0d2281753ea00fbc1c76efb32e865a081574823?s=96&r=g","caption":"Alfrick Opidi"},"url":"https:\/\/www.anychart.com\/blog\/author\/alfrick_opidi\/"}]}},"_links":{"self":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/8634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/comments?post=8634"}],"version-history":[{"count":21,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/8634\/revisions"}],"predecessor-version":[{"id":20298,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/8634\/revisions\/20298"}],"wp:attachment":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/media?parent=8634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/categories?post=8634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/tags?post=8634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}