Sign in to follow this  
rPh

ASP.NET Ajax UpdatePanel

Recommended Posts

I have been trying to add fusion charts to an AJAX UpdatePanel in Visual Studio. There are problems when I change the dataXML and try to update. Has any one had any luck with getting FusionCharts working with the Visual Studio AJAX?

 

 

 

I have tried using the javascript in many different ways, any ideas?

Share this post


Link to post
Share on other sites

I'm having the same problem.  I have an update panel with a multiview, the intial chart loads with the onpageload event, but when a do an asyncronous postback in the update panel, no charts.  It just displays the word CHART. 

Everything I read about fusion charts says it works with ajax, but I have yet to see any support from infosoft global and the updatepanel is the simplest ajax control

Share this post


Link to post
Share on other sites

Hi,

FusionCharts works with AJAX as in custom JavaScripts and client side updates. Infact many industry standard AJAX grids are using FusionCharts - you can see few live demos at http://www.fusioncharts.com/Demos/Blueprint

We've not restricted ourselves to any specific AJAX framework like that of .NET or .... However, if you can send me a live link, I can debug into it and let you know the source of problem.

Share this post


Link to post
Share on other sites

why do you need a live link to debug ?

this is the problem that everybody whos using UpdatePanel is facing then why dont you just provide the solution or simply say that it doesnt Support Miscrosoft AJAX Extension

Share this post


Link to post
Share on other sites

FusionCharts is a platform independent tool - and as such we've "intentionally" chosen not to customize it to any specific language. We've thousands of ASP.NET users who're using the AJAX interface exposed by FusionCharts and they couple it with their own ASP.NET code.

Share this post


Link to post
Share on other sites

It can work with MS AJAX too - but not using the direct APIs provided by MS. You'll need to put JS code over that to access FusionCharts AJAX API.

Share this post


Link to post
Share on other sites

I think you guys are missing out on a LOT of business by not including basic support for MS Ajax UpdatePanels.

As it is i'm considering what other charting options i have.

(i really do not want to learn javascript)

MavStar

Share this post


Link to post
Share on other sites

Hey All,

Well i've come up with an easy solution to the updatepanel problem.

There is a free flash control on http://www.flash-control.net/

Protected Sub CreateChart()
Dim QueryString As String = String.Format("../xml/GetAccountsXml.aspx?UserName={0}&QueryType={1}", User.Identity.Name, GraphType.SelectedValue)
Dim dataURL As String = InfoSoftGlobal.FusionCharts.EncodeDataURL(QueryString, True)
Me.FlashControl1.Height = 350
Me.FlashControl1.Width = 900
Me.FlashControl1.BorderColor = Drawing.Color.WhiteSmoke
Me.FlashControl1.BackColor = Drawing.Color.WhiteSmoke
Me.FlashControl1.Menu = False
Me.FlashControl1.MovieUrl = "../FusionCharts/Line.swf"
Me.FlashControl1.SwLiveConnect = True
Me.FlashControl1.FlashVars = String.Format("&chartWidth={0}&chartHeight={1}&debugMode={2}&dataURL={3}", 900, 350, 0, dataURL)
End Sub

This is working brilliantly for me, plus it is free.

The only minor glitch is that it has that whole "click to activate thing" happening (control must be using html to render the chart)

Hope you have fun.

MavStar

Share this post


Link to post
Share on other sites

Hi,

 I am having the requirement that i am using updatepanel.but when i am using the update panel it is not refreshing the chart control.I saw ur solution and i am trying.But i am getting another issue that it is not identifying the fallowing from my code.

InfoSoftGlobal.FusionCharts.EncodeDataXml

will we get it only when we take licensed. How can I get above directive.

thanks and regards,

Y.Ashok

Share this post


Link to post
Share on other sites

Hi everybody,

Please stop fighting over the issue of implementing FusionCharts on ASP.NET AJAX...because fighting only leads us away from being codicated...from real challange of development.

 

What i have figured out trying to implement FusionCharts in ASP.NET as well as AJAX that the only thing that is hampering the implementation is the mal-treatment of FlashObjects inside <FORMS> (which should be present in ASP.NET pages eventually for UpdatePanel controls)...

From JavaScript's (as AJAX is 80-90% JavaScript)point of view in IE ids inside <form>s are not declared as window[id] but as document.forms[index][id]....hence poor IE cant recognize the obejct .... you may refer to the documentation and way outs (where there's a will there's a way) published by Adobe regarding this... http://kb.adobe.com/selfservice/viewContent.do?externalId=kb400730&sliceId=1

 

TIP 1: If one is using registerWithJS, after rendering a chart one must use this :

 

if(!document.embeds[chartId])

  window[chartId]=document.getElementById(chartId); //or else document.forms[formName/formIndex][chartId]

 

Using all resouces i have easily, simply and successfully implemented FusionCharts in ASP.NET AJAX and can change chart data using setDataXML/setDataURL...

 

oh! 1 thing i missed ... i have modified getChartFromId in FusionCharts.js thus :

 

infosoftglobal.FusionChartsUtil.getChartObject = function(id)

{

//  if (window.document[id]) {

// return window.document[id];

//  }

  if (navigator.appName.indexOf("Microsoft Internet")==-1) {

  if (document.embeds && document.embeds[id])

  return document.embeds[id];

  } else {

  return document.getElementById(id);

  }

}

 

this worked in IE 6/7, Firefox, Opera 9...i have no more browsers installed but will surely check in Safari soon..

Share this post


Link to post
Share on other sites

Thanks for your help on this but how do I implement your Tip #1?

Where do I put this javascript?

TIP 1: If one is using registerWithJS, after rendering a chart one must use this :

if(!document.embeds[chartId])

  window[chartId]=document.getElementById(chartId); //or else document.forms[formName/formIndex][chartId]

thanks

Share this post


Link to post
Share on other sites

Hi,

some where you are using the fusionCharts javascript embedding method...i.e.

var c1=new FusionCharts(..,"mapID1",..);

c1.setDataURL(...) or c1.setDataXML(...);

c1.render(divID);

if(!document.embeds["mapID1"])

  window["mapID1"]=document.getElementById("mapID1");

Share this post


Link to post
Share on other sites

Sorry I must have misunderstood your solution, I am actually using the FusionCharts.dll and the vb.net examples

so I have something like this in HTML

<%=GetChart()%>

and code behind

Public function GetChart() as string
Dim strXML as string = GetChartData(DateRange)
return FusionCharts.RenderChart("fusioncharts/FCF_Column2D.swf","",strXML,"Chart1", "200","100", false,true)
end function

Works fine first time but not on ajax async postback, not sure how i can use your javascript solution code.

Share this post


Link to post
Share on other sites

HI,

Here is a simple sample using FusionCharts in ASP.NET.AJAX Update Panel ... try this and explore more and let us know. We are currently developing more samples on various aspects and facets of UpdatePanel and ASP.NET.AJAX... we will publish them soon...

Developers eager to share their experiences of failure and success while using FusionCharts in Update Panel and ASP.NET.AJAX may post too.

FusionCharts.ASP.Net.AJAX.zip

Edited by Guest

Share this post


Link to post
Share on other sites

Hi,

 

sorry its took so long to reply been busy!

 

Anyway thanks for your ajax example code it worked great for generating charts on 'postback' after the page has loaded.

 

 

 

However I wanted to generate the chart on 'Page Load' and then on 'Postbacks'

 

 

 

If you use RenderChartHTML on page load then you get the 'click to activate' message in IE.

 

 

 

If you use RenderChart on page load and then RenderChart on postbacks then the postback charts don't display.

 

 

 

However! If you use RenderChart on page load then RenderChartHTML on any postback then all problems are solved.

 

 

 

Not sure if there's an easier way around this but at least it works and I'm happy.

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
Sign in to follow this