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
Associating data points with data structures
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:
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 = "";
}
}
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
Thanks,
Larry
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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:
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 |
Instructions - How to post in this forum |