Answered by:
Is it possible to use Ajax for Chart Display?

Question
-
Hi, all.
Is it possible to use Ajax and ASP.net to control Chart Display?
I used Ajax and hope to display a Chart graph like below. The string of innerHTML is returned by Ajax. But it doesn't work at all.
Any one can give me some advice?
document.getElementById("ChartTest").innerHTML = "<asp:chart id='ChartTest' runat='server' Height='296px' Width='412px'><series><asp:Series Name='ChartTest' BorderColor='180, 26, 59, 105'><points><asp:DataPoint YValues='45' /><asp:DataPoint YValues='45' /><asp:DataPoint YValues='45' /><asp:DataPoint YValues='45' /><asp:DataPoint YValues='45' /></points></asp:Series></series><chartareas><asp:ChartArea Name='ChartArea1' BorderColor='64, 64, 64, 64' BorderDashStyle='Solid' BackSecondaryColor='White' BackColor='64, 165, 191, 228' ShadowColor='Transparent' BackGradientStyle='TopBottom'><area3dstyle Rotation='10' perspective='10' Inclination='15' IsRightAngleAxes='False' wallwidth='0' IsClustered='False'></area3dstyle><axisy linecolor='64, 64, 64, 64'><labelstyle font='Trebuchet MS, 8.25pt, style=Bold' /><majorgrid linecolor='64, 64, 64, 64' /></axisy><axisx linecolor='64, 64, 64, 64'><labelstyle font='Trebuchet MS, 8.25pt, style=Bold' /><majorgrid linecolor='64, 64, 64, 64' /></axisx></asp:ChartArea></chartareas></asp:chart>";
Thanks.Friday, April 17, 2009 8:03 AM
Answers
-
The browsers don't understand <asp: /> tags. You have to render the control on server side - you can call Control.Render to grab the output, which in the chart case is <img /> tag which browsers understand.Using AJAX UpdatePanel simplify this procedure, go ahed and check out. There is some AJAX samples also in chart samples: http://code.msdn.microsoft.com/mschart.Delian
- Marked as answer by DelianTModerator Monday, April 27, 2009 6:31 PM
Wednesday, April 22, 2009 4:57 PMModerator
All replies
-
The chart works well in AJAX update panel.If you cannot use it, your AJAX result should contain rendered on the server chart - the <img/> tag - not chart with runat="server".Delian
- Proposed as answer by DelianTModerator Monday, April 20, 2009 4:51 PM
Saturday, April 18, 2009 2:03 AMModerator -
The chart works well in AJAX update panel.
If you cannot use it, your AJAX result should contain rendered on the server chart - the <img/> tag - not chart with runat="server".Delian
Thanks, Delian.
Would you please explain me more detail?Saturday, April 18, 2009 5:32 PM -
The browsers don't understand <asp: /> tags. You have to render the control on server side - you can call Control.Render to grab the output, which in the chart case is <img /> tag which browsers understand.Using AJAX UpdatePanel simplify this procedure, go ahed and check out. There is some AJAX samples also in chart samples: http://code.msdn.microsoft.com/mschart.Delian
- Marked as answer by DelianTModerator Monday, April 27, 2009 6:31 PM
Wednesday, April 22, 2009 4:57 PMModerator