I have a line series formulated using the below code:
line1.Add(1,1);
line1.Add(5,5);
line1.Add(10,1);
line1.Add(15,5);
line1.Add(20,1);
line1.Add(25,5);
This forms a triangular wave curve.
I need to know if there is any way to fill the triangular area formed by this series?
Thanks!
Fill the area between the points on the line series
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Lakshmi,
You have 2 options to achieve that:
1. Using Area series which already does that.
2. Custom drawing on TeeChart's canvas doing something like this:
You have 2 options to achieve that:
1. Using Area series which already does that.
2. Custom drawing on TeeChart's canvas doing something like this:
Code: Select all
private void Form1_Load(object sender, EventArgs e)
{
line1.Add(1, 1);
line1.Add(5, 5);
line1.Add(10, 1);
line1.Add(15, 5);
line1.Add(20, 1);
line1.Add(25, 5);
}
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
g.Brush.Color = line1.Color;
g.Brush.Solid = true;
g.Brush.Visible = true;
g.Brush.Transparency = 50;
int i;
for (i = 0; i+2 < line1.Count; i=i+2)
{
Steema.TeeChart.Drawing.Triangle3D Triangle = new Steema.TeeChart.Drawing.Triangle3D();
Triangle.p0.X = line1.CalcXPos(i);
Triangle.p0.Y = line1.CalcYPos(i);
Triangle.p1.X = line1.CalcXPos(i+1);
Triangle.p1.Y = line1.CalcYPos(i+1);
Triangle.p2.X = line1.CalcXPos(i+2);
Triangle.p2.Y = line1.CalcYPos(i+2);
g.Triangle(Triangle);
}
if (i<line1.Count)
{
Steema.TeeChart.Drawing.Triangle3D Triangle = new Steema.TeeChart.Drawing.Triangle3D();
Triangle.p0.X = line1.CalcXPos(i);
Triangle.p0.Y = line1.CalcYPos(i);
Triangle.p1.X = line1.CalcXPos(i + 1);
Triangle.p1.Y = line1.CalcYPos(i + 1);
Triangle.p2.X = line1.CalcXPos(i + 1);
Triangle.p2.Y = line1.CalcYPos(i);
g.Triangle(Triangle);
}
}
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 |
Fill the area between the points on the line series
Hi Narcis,
If I use the area series, then that would fill the area starting from origin, but I wish to fill the area only between the traingles. How do I achieve that using area series?
Thanks
If I use the area series, then that would fill the area starting from origin, but I wish to fill the area only between the traingles. How do I achieve that using area series?
Thanks
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Lakshmi,
You can set an origin for Area series as shown in the All Features\Welcome !\Chart styles\Standard\Area\Setting origin example at TeeChart's features demo.
You can set an origin for Area series as shown in the All Features\Welcome !\Chart styles\Standard\Area\Setting origin example at TeeChart's features demo.
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 |