Layman Posted May 8, 2007 Report Share Posted May 8, 2007 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 More sharing options...
Frank Posted May 8, 2007 Report Share Posted May 8, 2007 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 AJAXURL: 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 More sharing options...
Layman Posted May 11, 2007 Author Report Share Posted May 11, 2007 Thanks Frank. It helped.RegardsLayman Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.