Series intersect
Series intersect
Hi,
I'm just wondering if there are any functions or methods to display text or marks on the point(s) where two different series intersect each other?
Thanks.
I'm just wondering if there are any functions or methods to display text or marks on the point(s) where two different series intersect each other?
Thanks.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi dave,
You can use CrossPoints function and make its marks visible. You'll find an example of this at All Features\Welcome !\Functions\Extended\Cross points in the features demo. The demo can be found at TeeChart's program group.
You can use CrossPoints function and make its marks visible. You'll find an example of this at All Features\Welcome !\Functions\Extended\Cross points in the features demo. The demo can be found at TeeChart's program group.
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 |
Thanks Narcis, I managed to get the CrossPoint working with a Styles.Point, however, I noticed that when I do a mouseover with MarkTips, it only shows the Y values. I would like the MarksTip to show the label on one of the series data (that intersects with another series). Is there a way how I can do this?
Also, could I change Styles.Point to show an x rather than a grey box?
Thanks.
Also, could I change Styles.Point to show an x rather than a grey box?
Thanks.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi dave,
Yes, try this:Thanks Narcis, I managed to get the CrossPoint working with a Styles.Point, however, I noticed that when I do a mouseover with MarkTips, it only shows the Y values. I would like the MarksTip to show the label on one of the series data (that intersects with another series). Is there a way how I can do this?
Code: Select all
marksTip1.Style = Steema.TeeChart.Styles.MarksStyles.Label;
Something similar, try this:Also, could I change Styles.Point to show an x rather than a grey box?
Code: Select all
points1.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.DiagCross;
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 |
Hi Narcis,
Thanks for the info. I'm already using
for my series lines, which works fine. However, when I include CrossPoints, MarksTip only show the Y-Value at points where the 2 series intersect. However, when the series are not intersecting, MarksTip will show the series label.
What I want is for MarksTip to also show the series label at points where the series intersects.
Thanks for the info. I'm already using
Code: Select all
marksTip1.Style = Steema.TeeChart.Styles.MarksStyles.Label;
What I want is for MarksTip to also show the series label at points where the series intersects.
Hi Dave
This happens because the CrossPoints don't have labels. You can put the labels as below code:
This happens because the CrossPoints don't have labels. You can put the labels as below code:
Code: Select all
private void Form1_Load(object sender, EventArgs e)
{
tChart1.Aspect.View3D = false;
line1.Add(5,"five");
line1.Add(2, "two");
line1.Add(6, "six");
line1.Add(3, "three");
line2.Add(1,"one");
line2.Add(6, "six");
line2.Add(3, "three");
line2.Add(8, "eight");
//line 3 is using CrossPoints function.
line3.CheckDataSource();
line3.Pointer.Visible = true;
for (int i = 0; i < line3.Count; i++)
{
line3.Labels[i] = "intersection point " + Convert.ToString(i + 1);
}
}
Hi Dave
You can change the text of the markTip in the "GetText" event of the markTip, also you can know which line is under the mouse cursor using the MouseMove event and series' Clicked method. You can do something similar as below code:
You can change the text of the markTip in the "GetText" event of the markTip, also you can know which line is under the mouse cursor using the MouseMove event and series' Clicked method. You can do something similar as below code:
Code: Select all
private void marksTip1_GetText(Steema.TeeChart.Tools.MarksTip sender, Steema.TeeChart.Tools.MarksTipGetTextEventArgs e)
{
if (on_CrossPoints != -1) //The mouse are on the line that use the CrossPoint function
{
if (on_lines != -1) //The mouse are on one intersection
e.Text = line1[on_lines].Label;
else //The mouse are on the line that use the CrossPoint but not on the intersection
e.Text = "";
}
}
private int on_CrossPoints;
private int on_lines;
private void tChart1_MouseMove(object sender, MouseEventArgs e)
{
on_CrossPoints = line3.Clicked(e.X, e.Y);
on_lines = line1.Clicked(e.X, e.Y);
}
Hi Dave
You can accede to series using an index, the first serie that it's been added in the chart, has got value 0, the second value 1, you can see how to use this index in the below line:
Also can be interesting know which is the line whose corresponds to crossPoint function. The function has one property which returns the serie associated.
Your code can be something similar as below code:
You can accede to series using an index, the first serie that it's been added in the chart, has got value 0, the second value 1, you can see how to use this index in the below line:
Code: Select all
tChart1.Series[0]; //Return the first serie
Code: Select all
crossPoints1.Series; //In the below example returns the "line3"
Code: Select all
private void Form1_Load(object sender, EventArgs e)
{
tChart1.Aspect.View3D = false;
}
private void marksTip1_GetText(Steema.TeeChart.Tools.MarksTip sender, Steema.TeeChart.Tools.MarksTipGetTextEventArgs e)
{
if (on_CrossPoints != -1) //The mouse are on the line that use the CrossPoint function
{
if (on_lines != -1) //The mouse are on one intersection
e.Text = tChart1.Series[0].Labels[on_lines];
else //The mouse are on the line that use the CrossPoint but not on the intersection
e.Text = "";
}
}
private int on_CrossPoints;
private int on_lines;
private void tChart1_MouseMove(object sender, MouseEventArgs e)
{
if (tChart1.Series.Count>0)
{
on_CrossPoints = crossPoints1.Series.Clicked(e.X, e.Y);
on_lines = tChart1.Series[0].Clicked(e.X, e.Y);
}
}
private Steema.TeeChart.Functions.CrossPoints crossPoints1;
private void button1_Click(object sender, EventArgs e)
{
Line line1 = new Line(tChart1.Chart);
line1.Add(5, "five");
line1.Add(2, "two");
line1.Add(6, "six");
line1.Add(3, "three");
Line line2 = new Line(tChart1.Chart);
line2.Add(1, "one");
line2.Add(6, "six");
line2.Add(3, "three");
line2.Add(8, "eight");
//line 3 is using CrossPoints function.
Line line3 = new Line(tChart1.Chart);
crossPoints1 = new Steema.TeeChart.Functions.CrossPoints();
line3.DataSource = new object[] {line1,line2};
line3.Function = crossPoints1;
line3.CheckDataSource();
line3.Pointer.Visible = true;
}
Hi,
I'm having some intermittent Index Out Of Bound errors with my code. It's similar to the code given previously.
I find it difficult to replicate the problem as it's intermittent. Do you have any suggestions on what could cause the index error to appear at that line of code?
Thanks.
I'm having some intermittent Index Out Of Bound errors with my code. It's similar to the code given previously.
Code: Select all
private void button1_Click(object sender, EventArgs e)
{
Line line1 = new Line(tChart1.Chart);
line1.Add(5, "five");
line1.Add(2, "two");
line1.Add(6, "six");
line1.Add(3, "three");
Line line2 = new Line(tChart1.Chart);
line2.Add(1, "one");
line2.Add(6, "six");
line2.Add(3, "three");
line2.Add(8, "eight");
//line 3 is using CrossPoints function.
Line line3 = new Line(tChart1.Chart);
crossPoints1 = new Steema.TeeChart.Functions.CrossPoints();
line3.DataSource = new object[] {line1,line2};
line3.Function = crossPoints1; //Index out of bound error showing here
line3.CheckDataSource();
line3.Pointer.Visible = true;
}
Thanks.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi pw,
Not that I can think of without being able to reproduce the problem here. Maybe you could try setting the series Function before setting its DataSource. Also, which TeeChart version are you using? Are you using latest version available at the client area?
Thanks in advance!
Not that I can think of without being able to reproduce the problem here. Maybe you could try setting the series Function before setting its DataSource. Also, which TeeChart version are you using? Are you using latest version available at the client area?
Thanks in advance!
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 |