How to create responsive Chart using jQuery UI in JavaScript?
Essential JavaScript 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
JS Playground link: https://jsplayground.syncfusion.com/twb2cbjg
Conclusion
I hope you enjoyed how to create responsive Chart using jQuery UI.
You can refer to our JavaScript Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript Chart example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!