Data from the series in ganttchart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Hans
Newbie
Newbie
Posts: 15
Joined: Mon Jun 20, 2005 4:00 am

Data from the series in ganttchart

Post by Hans » Wed Jul 27, 2005 2:51 pm

In dotnet everything is different from the windows versions.
It's so unclear. I work in delphi dotnet.

How can I get the seriesdata if I point at a seriesitem in the ganttchart?

I want the index of the record and the x(datevalue) and the y values.

Hans

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

Post by Narcís » Thu Jul 28, 2005 10:44 am

Hi Hans,

Are you working in a VCL.NET project or a Delphi for .NET Windows Forms project? Anyway, you shouldn't have much problems, the code snippet below is in C# but can be easily ported to VCL.

Code: Select all

		private void gantt1_Click(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			int index=gantt1.Clicked(e.X,e.Y);

			tChart1.Header.Text="Index: " + index.ToString() +
													" Value: " + (DateTime.FromOADate(gantt1.XValues[index])).ToString() + 
													" - " + gantt1.YValues[index].ToString();						
		}
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

Hans
Newbie
Newbie
Posts: 15
Joined: Mon Jun 20, 2005 4:00 am

Post by Hans » Thu Jul 28, 2005 11:33 am

OK, thanks I will try this.

And how do I get the index if I only point(mouseenter event) and not click at the points?

Hans

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

Post by Narcís » Thu Jul 28, 2005 11:48 am

Hi Hans,

It would be quite similar, you should use tChart's MouseMove event and implement something like:

Code: Select all

		private void tChart1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			int index=gantt1.Clicked(e.X,e.Y);

			if (index != -1)
				tChart1.Header.Text="Index: " + index.ToString() +
														" Value: " + (DateTime.FromOADate(gantt1.XValues[index])).ToString() + 
														" - " + gantt1.YValues[index].ToString();						
			else tChart1.Header.Text="";
		}
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

Hans
Newbie
Newbie
Posts: 15
Joined: Mon Jun 20, 2005 4:00 am

Post by Hans » Thu Jul 28, 2005 2:45 pm

Is it not possible to use Gantt1_MouseEnter and Gantt1_MouseLeave, because those are the events for moving over a seriespoint?

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

Post by Narcís » Thu Jul 28, 2005 3:06 pm

Hi Hans,

Those events don't have X and Y coordinates parameters to get the index you request with Clicked method.
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

Hans
Newbie
Newbie
Posts: 15
Joined: Mon Jun 20, 2005 4:00 am

Post by Hans » Thu Jul 28, 2005 5:07 pm

Narcis,

OK, clear, but what is the function of those 2 events. What can we do, read, edit, etc. in those events?

Hans

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

Post by Narcís » Fri Jul 29, 2005 9:09 am

Hi Hans,

You could manage to read values or so by manually getting mouse coordinates or capturing them from MouseMove event and using Clicked method as I showed you before. However, those events can also be used for other kinds of interaction as, for example, changing one series appearence when mouse being over it.
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

Post Reply