Sign in to follow this  
parki

Quick question on setDataURL

Recommended Posts

Hello -

 

 

 

This is a (I think) quick/easy two part question, but couldn't find the answer in the docs...

 

 

 

1. I am using an MSSpline chart, and using setDataURL to get the XML data generated using JSF. This is working great. When there is a change to the data on the server, I'd like to have JavaScript code tell the chart to re-render. As near as I can tell, the only way to do this is:

 


getChartFromId("mySplineChart").setDataURL("data/mySplineChart.jsf");

 

I'd prefer to be able to just tell the chart to 're-render', and not have to have the URL to the JSF page in the JavaScript code - is there a way to do this?

 

 

 

2. In the result from mySplineChart.jsf, some effects are being set up using the "styles" tag.

 

 

 

This is great for when the chart *first* displays, but after when I'm updating it, I'd like to disable the effects. Can anyone show me how to do this? I'm assuming that I put this code in the FC_Rendered function, but unsure how this is done.

 

 

 

Any help is greatly appreciated.

 

 

 

Regards,

 

 

 

parki...

Share this post


Link to post
Share on other sites

Hi,

1. I am afraid setDataURL is the only shortest way.

2. Styles can only be set in the XML itself which s generated by the jsf file. You need to have some mechanism, like passing a QueryString to the jsf (to tell it whether it will add style or not) or keeping a session Flag that will tell the JSF (whether it is running for the firsttime or not through which JSF will determine whether to add styles or not.

Share this post


Link to post
Share on other sites

One further question about chart update -

 

 

 

Everything is working well - when I call "setDataURL" on the chart, it updates correctly with the new XML data generated on the server.

 

 

 

BUT.

 

 

 

It flickers when it updates - goes blank, and then reloads the data.

 

 

 

Is it possible to turn this off?

 

 

 

I'd really like a seamless update - are there options available to do that?

 

 

 

If not, are there techniques? Do I have to handle two charts, and do offscreen rendering (I hope not :-)

 

 

 

Any help is greatly appreciated.

 

 

 

Regards,

 

 

 

Brian Parkinson

 

Architect,

 

Avaning Inc.

Share this post


Link to post
Share on other sites

Hi Brian,

 

 

 

Can you try using setDataXML method instead then? Load the XML data in a JS XML object and once loaded, call the setDataXML method of chart.

Share this post


Link to post
Share on other sites

Hi:

 

 

 

Unfortunately, I can't use the setDataXml via JavaScript, as we are basing the chart implementation on JSF - we have JSF pages which generate the chart XML data, and have been using setDataURL (which works fine, aside from the fact that we can't control the refresh).

 

 

 

If we call setDataURL, and the chart data has not changed, we'd like to have a repaint without flicker.

 

 

 

This is a bit of a stumbling block for us - minor, but annoying to our users.

 

 

 

Can anything be done without having to resort to using setDataXML (as this requires a lot of code changes).

 

 

 

Any help is greatly appreciated.

 

 

 

parki...

Share this post


Link to post
Share on other sites

Forget what I said in the comment above:

 

 

 

Played around with the setDataXML method, and this works - there is NO flicker when using setDataXML (there is when using setDataURL).

 

 

 

It's a one-liner using the mighty JQuery JavaScript library:

 

 

 


   jQuery.get("data/today.jsf", function(data) {

     gTodayChart.setDataXML(data);

   });

 

 

 

Thanks.

 

 

 

parki...

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