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 following screenshot displays the Chart after calling Redraw method.
|
This page will automatically be redirected to the sign-in page in 10 seconds.