Chart ClickSeries & ClickBackground events

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
norman
Newbie
Newbie
Posts: 82
Joined: Fri Jan 25, 2008 12:00 am

Chart ClickSeries & ClickBackground events

Post by norman » Thu Jan 07, 2010 11:48 am

Hi,

Please see the attached image which I refer to below.
Chart.png
Chart.png (29.93 KiB) Viewed 5349 times
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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Chart ClickSeries & ClickBackground events

Post by Narcís » Thu Jan 07, 2010 3:21 pm

Hi Norman,

I'm not able to reproduce the issue here using code below (find full WebForm attached). Can you reproduce the problem at your end using it? Can you please modify it so that we can reproduce the problem here?

Code: Select all

	protected void Page_Load(object sender, EventArgs e)
	{
		Steema.TeeChart.Chart ch1 = WebChart1.Chart;

		ch1.Aspect.View3D = false;

		Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(ch1);

		for (int i = 0; i < 10; i++)
		{
			line1.Add(i);
		}

		Steema.TeeChart.Tools.Annotation annotation1 = new Steema.TeeChart.Tools.Annotation(ch1);
		annotation1.Shape.CustomPosition = true;
		annotation1.Shape.Left = 100;
		annotation1.Shape.Top = 100;
		annotation1.Text = "my annotation";

		Label1.Text = "";
		Label2.Text = "";

		WebChart1.ClickBackground += new Steema.TeeChart.Web.WebChart.ClickEventHandler(WebChart1_ClickBackground);
		WebChart1.ClickSeries += new Steema.TeeChart.Web.WebChart.SeriesEventHandler(WebChart1_ClickSeries);
	}

	void WebChart1_ClickSeries(object sender, Steema.TeeChart.Styles.Series s, int valueIndex, EventArgs e)
	{
		Label1.Text = "ClickSeries";
	}

	void WebChart1_ClickBackground(object sender, ImageClickEventArgs e)
	{
		Label2.Text = "ClickBackGround";
	}
Thanks in advance.
Attachments
ClickBackground.zip
(1.14 KiB) Downloaded 534 times
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

norman
Newbie
Newbie
Posts: 82
Joined: Fri Jan 25, 2008 12:00 am

Re: Chart ClickSeries & ClickBackground events

Post by norman » Mon Jan 11, 2010 9:29 am

Hi,

Thanks for the reply. I'll try - I may no be able to reply immediately.

Kind regards,

Norman

Post Reply