Chart ClickSeries & ClickBackground events
Posted: Thu Jan 07, 2010 11:48 am
Hi,
Please see the attached image which I refer to below.
From the image you will note that an annotation (A) and associated callout is attached to the x-axis. I have logic in my code that means when a user clicks either a series (i.e. the blue or red lines) or the x-axis a new blank annotation is added to the chart. At the same time a data entry panel is displayed below the chart where they can enter the text to be displayed on the annotation (i.e. "A") as well as the text that gets displayed when you move the mouse over the annotation (not shown). I also have some code that means when the user clicks an existing annotation the same data entry form is displayed where they can edit and update both of these values.
For the most part this all works fine however users have reported some strange behaviour. When they click on some annotations rather then the edit panel getting displayed with the details of the clicked annotation a new annotation is added to the chart instead.
After doing some investigation I managed to determine the source of the problem but I'm not sure as why its happening. In my code I handle the adding of an annotation in the WebChart_ClickSeries and WebChart_ClickAxis events and I handle the editing of an annotation in the WebChart_ClickBackground event (i.e. I get the mouse coords and determine if they are within the bounds of an annotation on the chart and if they are I show the edit panel etc.). For some reason when I click on the annotation A in the image the WebChart_ClickSeries event fires instead of the WebChart_ClickBackground event - with the result that a new annotation is added. Even more strange it depends on where exactly on the annotation I click - if I click the outer edges things work fine, if I click the middle of the annotation they don't. If you look at the image you'll note that the annotation is some distance from the series, so why is the WebChart_ClickSeries being triggered? This problem seems to depend on where the annotation is located because it doesn't happen for all annotations. I went through the exercise of plotting using an image editor the coords of the polygons visible in the page source (e.g. POLY coords=640,426,660,426,660,445,640,445> [not actual values] etc.) and the bounds of the annotations where in the correct place. I did notice that that there was an extra AREA at the end that seemed to apply to a series but it was located over the red line around the value of 02:00 on the x-axis so did not seem to interfere(?).
I'm afraid its not easy for me to post all the actual code because its part of a much larger project. Are you aware of any issues that may be a cause of the type of behaviour outlined above (i.e. WebChart_ClickSeries event triggering instead of WebChart_ClickBackground etc). I'm using TeeChart version 3.5.3371.26405.
Thanks,
Norman
Please see the attached image which I refer to below.
From the image you will note that an annotation (A) and associated callout is attached to the x-axis. I have logic in my code that means when a user clicks either a series (i.e. the blue or red lines) or the x-axis a new blank annotation is added to the chart. At the same time a data entry panel is displayed below the chart where they can enter the text to be displayed on the annotation (i.e. "A") as well as the text that gets displayed when you move the mouse over the annotation (not shown). I also have some code that means when the user clicks an existing annotation the same data entry form is displayed where they can edit and update both of these values.
For the most part this all works fine however users have reported some strange behaviour. When they click on some annotations rather then the edit panel getting displayed with the details of the clicked annotation a new annotation is added to the chart instead.
After doing some investigation I managed to determine the source of the problem but I'm not sure as why its happening. In my code I handle the adding of an annotation in the WebChart_ClickSeries and WebChart_ClickAxis events and I handle the editing of an annotation in the WebChart_ClickBackground event (i.e. I get the mouse coords and determine if they are within the bounds of an annotation on the chart and if they are I show the edit panel etc.). For some reason when I click on the annotation A in the image the WebChart_ClickSeries event fires instead of the WebChart_ClickBackground event - with the result that a new annotation is added. Even more strange it depends on where exactly on the annotation I click - if I click the outer edges things work fine, if I click the middle of the annotation they don't. If you look at the image you'll note that the annotation is some distance from the series, so why is the WebChart_ClickSeries being triggered? This problem seems to depend on where the annotation is located because it doesn't happen for all annotations. I went through the exercise of plotting using an image editor the coords of the polygons visible in the page source (e.g. POLY coords=640,426,660,426,660,445,640,445> [not actual values] etc.) and the bounds of the annotations where in the correct place. I did notice that that there was an extra AREA at the end that seemed to apply to a series but it was located over the red line around the value of 02:00 on the x-axis so did not seem to interfere(?).
I'm afraid its not easy for me to post all the actual code because its part of a much larger project. Are you aware of any issues that may be a cause of the type of behaviour outlined above (i.e. WebChart_ClickSeries event triggering instead of WebChart_ClickBackground etc). I'm using TeeChart version 3.5.3371.26405.
Thanks,
Norman