Associating data points with data structures

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
LC
Newbie
Newbie
Posts: 8
Joined: Fri Jun 29, 2007 12:00 am
Contact:

Associating data points with data structures

Post by LC » Tue Jul 03, 2007 3:47 pm

I am interested in storing data about each data point in a series. When I mouse over the series, I want to be able to display the detailed data in text boxes below the graph. Anyone know if this is possible or how to do it?

Thanks, LC

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Wed Jul 04, 2007 8:33 am

Hi LC

You can use the e.X and e.Y values of the "mouseMove" event of the chart and the clicked method of the series, to know if the mouse is on some Series. You can do something similar as below code:

Code: Select all

 private void Form1_Load(object sender, EventArgs e)
        {
            bar1.Add(1, 2, "first");
            bar1.Add(2, 1, "second");
            bar1.Add(3, 5, "third");
            bar2.FillSampleValues(3);
        }
        private void tChart1_MouseMove(object sender, MouseEventArgs e)
        {
            foreach (Series s in tChart1.Chart.Series)
            {
                if (s.Clicked(e.X, e.Y) != -1)
                {
                    tChart1.Text = s.ToString() + "[" + s.Clicked(e.X, e.Y) + "] "+s[s.Clicked(e.X,e.Y)].Label;
                    break;
                }
                else
                    tChart1.Text = "";
            }
        }
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

LC
Newbie
Newbie
Posts: 8
Joined: Fri Jun 29, 2007 12:00 am
Contact:

Post by LC » Thu Jul 05, 2007 3:35 pm

Thanks...that'll help. What I am trying to do is associate details with each point on the graph. Can I get which data point in the series is begin moused over? I've been reading, and I think I can use hotspots to do that. I thought in the past that there was a data tag for each point, but I guess I was mistaken. Then again, I was using the ActiveX version before.

Thanks,
Larry

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 05, 2007 5:20 pm

Hi Larry,

Ok, in that case you may be interested in using MarkTips tool for that. You can find an example at All Features\Welcome !\Tools\Mark tips in the features demo. Demo can be found at TeeChart's program group. Also notice that you can customize the text displayed by the tool using its Style property and GetText event too.

Regarding data tag for each point, for now and as Edu told you, only a label can be added to each point. This can be done using Add method or directly accessing the label's StringList, for example:

Code: Select all

            line1.Labels[i]:="My Label";
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