Jump to content
Software FX Community

Refresh multiple charts on a web page


wuttrain
 Share

Recommended Posts

Hi,

 I have 2 (or more) charts on a page, and I have a HTML select control (1 week; 1 month; 1 year). So when I select 1 month from the list, I'd like to refresh my charts to 1 month data.  I have created this function in Javascript, and created the UserCallBack for each chart

function Select_OnChange(dropdown) {

var myindex = dropdown.selectedIndex;var SelValue = dropdown.options[myindex].value;

SFX_SendUserCallback(

'Chart1', myindex ,false);

SFX_SendUserCallback(

'Chart2', myindex ,false );

}

But it seems that only Chart1 is refreshed/reloaded but not Chart2.  I am not really familiar with Javascript, so I'm not even sure if calling SFX_SendUserCallback twice will do it.

 Please let me know.

Thanks!

wuttrain

Link to comment
Share on other sites

SFX_SendUserCallback is assynchronous. You can not make another call to it untill the first one has finished.

What you need to do is make your second call AFTER the first call returns. To do this, you can set:

SFX_onCallbackReadyDelegate = function () {

SFX_onCallbackReadyDelegate =

null;SFX_SendUserCallback('Chart2', 'param' ,false );

};

SFX_SendUserCallback(

'Chart1', 'param' ,false);
Link to comment
Share on other sites

I changed the code to this, but it only updates Chart1 and not Chart2:

function Select_OnChange(dropdown) {

var myindex = dropdown.selectedIndex;SFX_onCallbackReadyDelegate = function () {

SFX_onCallbackReadyDelegate =

null;SFX_SendUserCallback('Chart2', myindex ,false);

}

SFX_SendUserCallback('Chart1', myindex ,false );

}

 Thanks Frank.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...