Sign in to follow this  
noah977

Can't get Chart Object

Recommended Posts

I have an interesting puzzle. This works perfectly in a standard HTML page, but I can't seem to get it working in ExtJS.

 

 

 

Here is what I do in the HTML:

 

1) Draw a chart (with Fusion) in a DIV tag.

 

2) Reference the DIV tag in javascript to call setDataURL. This updates the chart data without a full page reload

 

 

 

So, In Extjs:

 

1) Draw the chart in the HTML div

 

2) Load the DIV into a Panel using contentEl

 

3) call setDataURL on the chart DIV from a handler function.

 

4) **** ERROR! I get an error that chart DIV doesn't exist. This is weird, because Firebug show it in the DOM inspector

 

 

 

Can someone help me sort this one out.

 

 

 

The Javascript is:

 


var chart1 = new FusionCharts("Charts/ScrollLine2D.swf", "chartHistory", "900", "400", "0", "1");



   function updateHandler1(){

       var nf = Ext.get('g1feed').getValue();

       var st = Ext.get('g1term').getValue();

       var dt = Ext.get('g1date').getValue();

       var newurl = '/v7/chartxml.php?'+ 'nf=' + nf + '&st='+ st + '&dt=' + dt;

       Ext.Msg.alert('New URL is', newurl);

       var chartObj = getChartFromId(chartHistory);

       chartObj.setDataURL(newurl);

   }

Share this post


Link to post
Share on other sites

hi,

 

I went through your problem. Please try the solution stated below :

 

 

 

 

 

var newurl = '/v7/chartxml.php?'+ 'nf=' + nf + '&st='+ st + '&dt=' + dt;

 

 

 

// please add this line for url encode

 

newurl = escape(newurl );

 

 

 

// chartHistory must be with in quotes

 

var chartObj = getChartFromId("chartHistory");

 

 

 

i think it will solve your problem

 

 

 

Arindam

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