)
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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Syncfusion Feedback

How to create responsive Chart using jQuery UI

Platform: jQuery |
Control: ejChart |
Published Date: August 6, 2017 |
Last Revised Date: July 3, 2019

Essential 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

 
  $("#container").ejChart(
      {
              });
                

 

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 = $("#container").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

 

Responsive Chart using jQuery UI

JS Playground link: http://jsplayground.syncfusion.com/twb2cbjg

 

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
Live Chat Icon