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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to create responsive Chart using jQuery UI

Platform: ASP.NET Web Forms |
Control: Chart

Chart supports the responsive behavior on resizing the browser window. We can also create responsive chart using the jQuery Resizable.

To create responsive chart in jQuery Resizable the below steps are followed

Step1: Create chart along with the required functionalities

 
<ej:Chart ClientIDMode="Static" ID="Chart1" runat="server" >     
</ej:Chart>
 

 

Step2: Add the scripts required for the jQuery UI in the sample

 
<script src="http://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
       //resizable container
<div id="resizable" >
 

 

Step3: In the stop event of the jQuery resizable the height and width of the resized container is set to the chart and it is redrawn

 
 
 $("#resizable").resizable ({
      // stop event of the resizable is triggered
            stop: function (event, ui) {
      // resized container height and width are obtained
               var height = ui.size.height;
                var width = ui.size.width;
                var chart = $("#Chart1").ejChart("instance");
       // chart is redrawn with the resized values
                chart.model.size.width = width.toString();
                chart.model.size.height = height.toString();
                chart.redraw();
                $(".e-input")[0].value = height.toString();
                $(".e-input")[2].value = width.toString();
            }
        });
 

 

The following screenshot displays the Chart resized using the jQuery UI and its height and width are displayed in the textbox

 

The Chart resized using the jQuery UI

Sample link: Sample

2X faster development

The ultimate ASP.NET Web Forms UI toolkit to boost your development speed.
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

Live Chat Icon For mobile