We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to update the dimensions for Gantt at run time

Platform: JavaScript |
Control: ejGantt |
Published Date: August 4, 2017 |
Last Revised Date: May 29, 2019

In Gantt control, the dimensions of the Gantt chart can be changed using the sizeSettings.height and sizeSettings.width properties. The height and width values can be provided in both pixels and percentage values.

To update the dimensions of the Gantt during run time, the following code snippets can be used.

Code snippets:

<body>
<div>
<button id="resizeGantt" style="display:block">Resize Gantt</button>
<div id="gantt"></div>
</div>   
<script type="text/javascript">
$(function () {
$("#gantt").ejGantt({
//…
sizeSettings: {
height: "450px",
width: "100%"
},
});
//Updating the height and width of Gantt through button click
$("#resizeGantt").click(function () {
var ganttObj = $("#gantt").data("ejGantt");
if (ganttObj.model.sizeSettings.height == "450px")
ganttObj.setModel({ "sizeSettings": { height: "300px", width: "70%" } });
else
ganttObj.setModel({ "sizeSettings": { height: "450px", width: "100%" } });
});
});
</script>
</body>

Sample link

A sample for updating the dimensions of Gantt chart is available in the following link. Sample

 

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon