Jump to content
Software FX Community

UseCallbackEvents


Layman
 Share

Recommended Posts

Hi,

I am having two charts in my webform. Chart1 - is for displaying a "US Map. On click of a state in Chart1 I display some bar chart in Chart2. So in the click event of Chart1 i have written code to populate the Chart2. Something like this:

if (e.Object is MapRegion) {MapRegion objMapRegion = (MapRegion)e.Object;switch (objMapRegion.DataText){case "FL":this.Map1.MapSource = "US\\Counties\\FL Counties.svg";break;}

BarChart(objMapRegion.DataText);

}

Till this point it is working fine. The only hitch is the page is getting refreshed for each click. So to avoid that I set "UseCallBackEvents" as true for Chart1. Afterwards when I click on any state the second chart is not getting displayed at all. Am i missing something?RegardsLayman

(e.Object is MapRegion) {MapRegion objMapRegion = (MapRegion)e.Object;switch (objMapRegion.DataText){case "FL":this.Map1.MapSource = "US\\Counties\\FL Counties.svg";break;}

BarChart(objMapRegion.DataText);

}

Till this point it is working fine. The only hitch is the page is getting refreshed for each click. So to avoid that I set "UseCallBackEvents" as true for Chart1. Afterwards when I click on any state the second chart is not getting displayed at all. Am i missing something?RegardsLayman

Link to comment
Share on other sites

When you use UseCallBackEvents, you can only modify the object that snt the event in the CallBack code, only that one object is going to be snet back to the client.

In your case, you are receiving the event for Chart1 and modifying Chart2.

If you want to use CallBack refresh for Chart2 then the event must come from Chart2. The following code will do this:

Chart2.AllSeries.Link.Url = "javascript:SelectRegion('$DataText');";

In your Client's Java Script you do:

  function CallbackReady (chart,args)
  {
  processing = false;
  }
 
  function SelectRegion (regionName)
  {
  if (processing)
  return;
  processing = true;
  SFX_onCallbackReadyDelegate = CallbackReady;
  SFX_SendUserCallback("Chart2","Click: " + regionName); // Event sent to Chart2. This is important !
  }

Then on your server-side code you can capture the UserCallback event for Chart2 and process it. You will receive "Click: <state name>" as your prameter. Because you are handling the Chart2 event then you can make changes to Chart2.

 For more information on Chart FX's AJAX capabilities, check out the following KB article:

Q7651001. Chart FX for VS 2005 and AJAX
URL: http://support.softwarefx.com/ShowArticleSep.aspx?Type=KB&Product=CfxNet70&Source=http://support.softwarefx.com/kb/765/1/001.htm?_r=1

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...