Hi Chirag,
Thanks for using
Syncfusion products.
We have analyzed your requirement
and we suggest you to use “dataSource” property of chart series for rebind the
data and update its settings such as range and interval type as per the data
fetched from services. we have created “chartdata.js” file for storing the data
which is rendered after the button is clicked.
Please refer the code
snippet to achieve this:
<code>
[JS]
$('#id').click(function()
{
$.ajax({
type: "GET",
//create js file for creating data that render when this button is clicked
url:
"chartdata.js",
dataType:"json",
error: function (xhr, ajaxOptions, thrownError)
{
alert(xhr.status);
alert(thrownError);
},
success: function (result) {
debugger;
var chart=$("#container").ejChart("instance");
chart.model.series[0].points=null;
chart.model.series[0].dataSource={};
chart.model.series[0].dataSource.data=result;
chart.model.series[0].dataSource.xName="x";
chart.model.series[0].dataSource.yName="y";
$("#container").ejChart("redraw");
}
});
}
</code>
We have created a
simple sample and it can be downloaded in the following link.
http://www.syncfusion.com/downloads/support/directtrac/general/Ajax-447988740.zip
Please let us know if
you have any concern.
Regards,
Rekha.