Articles in this section
Category / Section

How to use the redraw method of chart?

1 min read

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

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied