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 use the redraw method of chart?

Platform: JavaScript |
Control: ejChart |
Published Date: January 20, 2015 |
Last Revised Date: July 1, 2019 |
Product Version: 12.1.0.43

The redraw method is used to dynamically refresh the chart content and redraw the chart based on the updated values. Refer to the following code example that explains you how to redraw and update the chart on button click by using redraw method.

JS

<div id="container"></div>
<button onclick="Redraw()"> Redraw </button>
<script type="text/javascript">
$("#container").ejChart({
    series: [{
        points: [{ x: "Jan", y: 33 }, { x: "Feb", y: 18 },
            { x: "Mar", y: 10 }, { x: "Apr", y: 28 }, { x: "May", y: 29 }, { x: "Jun", y: 30 },
            { x: "Jul", y: 33 }, { x: "Aug", y: 32 }, { x: "Sep", y: 54 }, { x: "Oct", y: 32 },
            { x: "Nov", y: 52 }, { x: "Dec", y: 31 }
        ], name: 'India', type: 'spline',  
        marker:
        {
            shape: 'circle',
            size:
            {
                height: 6, width: 6
            },
            visible: true
        },
        //…
    }]
});
function Redraw() {
    chartObj = $("#container").ejChart("instance");
    chartObj.model.series[0].points[5].y = 5;
    chartObj.model.series[0].type="column";
    $("#container").ejChart("redraw");
}
</script>

 

JS Playground Link: Redraw

The following screenshot displays the Chart on page load.

The Chart on page load

The following screenshot displays the Chart after calling Redraw method.

The Chart after calling Redraw method

 

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