This is a migrated thread and some comments may be shown as answers.
RadChart + Callback
1 Answer 26 Views
This is a migrated thread and some comments may be shown as answers.
Robson L
Top achievements
Rank 1
Robson L asked on 23 Feb 2010, 10:54 PM
Hi, I have a page loading some radcharts dinamically.
I'm using javascript SetInterval to refresh the charts every 30 seconds by callback.
The series values in the radchart object are updated but the image of chart is not updated, someone has an example to help me?

thanks
Robson

1 Answer, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 26 Feb 2010, 02:08 PM
Hello Robson L,

Here is a sample code snippet that achieves the desired effect:

ASPX:
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<telerik:RadCodeBlock ID="cb1" runat="server">
 
    <script type="text/javascript">
        function pageLoad() {
            window.setTimeout(refresh, 1000);
        }
 
        function refresh() {
            var ajaxPanel = $find("<%= RadAjaxPanel1.ClientID %>");
            ajaxPanel.ajaxRequest("");
        }
    </script>
 
</telerik:RadCodeBlock>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" OnAjaxRequest="RadAjaxPanel1_AjaxRequest">
    <telerik:RadChart ID="RadChart1" runat="server">
    </telerik:RadChart>
</telerik:RadAjaxPanel>

C#:
private Random rand = new Random(DateTime.Now.Millisecond);
 
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        RadChart1.DataSource = new int[] { rand.Next(10, 100), rand.Next(10, 100), rand.Next(10, 100) };
        RadChart1.DataBind();
    }
}
 
protected void RadAjaxPanel1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
    RadChart1.DataSource = new int[] { rand.Next(10, 100), rand.Next(10, 100), rand.Next(10, 100) };
    RadChart1.DataBind();
}



Sincerely yours,
Manuel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Asked by
Robson L
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Share this question
or