Javascript Chart Ajax Postback Problem

Recommended Posts



I have a chart that is being rendered with Javascript. However, when I do an AJAX postback, the chart disappears. Please can you point me to an example of using a javascript chart in C# .Net and performing an AJAX update of the chart data?


Many thanks.

Share this post

Link to post
Share on other sites

What if I have inserted my chart into the page using JavaScript like this:


<script type="text/javascript">

FusionCharts._fallbackJSChartWhenNoFlash(); var strXML = "<chart showValues='0' bgAlpha='100' bgColor='FFFFFF' showBorder='0' chartLeftMargin='10' chartRightMargin='20' chartTopMargin='10' chartBottomMargin='10' outCnvbaseFont='Trebuchet MS' outCnvBaseFontSize='12' outCnvbaseFontColor='000000' baseFontColor='000000' useRoundEdges='1' canvasbgAlpha='50' legendBgAlpha='70' showPercentageValues='0' showPercentInToolTip='0' inThousandSeparator=',' formatNumberScale='0' showLabels='1' enableSmartLabels='1' decimals='1' canvasBorderAlpha='30' xAxisName='Month' yAxisName='Number of accounts' caption='Total Accounts' imageSave='1' imageSaveURL='/Common/Handlers/FusionChartImageSave_v3.ashx'><categories><category label='Apr 2011' /><category label='May 2011' /><category label='Jun 2011' /></categories><dataset seriesName='YouTube' color='ff3333' alpha='100'><set value='640' /><set value='594' /><set value='601' /></dataset><dataset seriesName='Facebook' color='3b5998' alpha='100'><set value='68' /><set value='112' /><set value='127' /></dataset><dataset seriesName='Twitter' color='5599bb' alpha='100'><set value='875' /><set value='2538' /><set value='2832' /></dataset><styles><definition><style name='captionFont' type='font' font='Arial' size='12' color='000000' bold='1' letterSpacing='1' /></definition><application><apply toObject='Caption' styles='captionFont' /><apply toObject='subCaption' styles='captionFont' /></application></styles></chart>"; var myChart = new FusionCharts("MSLine.swf","pnlChartContainer_chart", "450", "300", "0", "0"); myChart.setXMLData(strXML); myChart.render("pnlChartContainer"); </script>


And the user does not have flash installed? I have tried many things, including calling the following on postback with the updated strXML


myChart.setXMLData(strXML); myChart.render("pnlChartContainer");


But of all the different ways I have tried, either no graph displays or it displays but with the old XML data, even though the XML in the page has been updated. How do I do the AJAX update when the chart has been rendered in this way?

Edited by RMG_85

Share this post

Link to post
Share on other sites



Please see http://forum.fusioncharts.com/topic/10676-lines-and-bars-not-displaying-in-html5-chart/#entry54085. I furnished all details there so I am not repeting the same once again.

I also have a screencast here: http://screencast.com/t/GCpgCmg7 to explain the issue.


What I am doing wrong? This is a strange problem I am having. Please help me out.




Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now