Page 1 of 1
Fill the area between the points on the line series
Posted: Wed Mar 15, 2006 10:52 am
by 9788742
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!
Posted: Wed Mar 15, 2006 2:51 pm
by narcis
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:
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);
}
}
Fill the area between the points on the line series
Posted: Thu Mar 16, 2006 5:30 am
by 9788742
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
Posted: Thu Mar 16, 2006 11:47 am
by narcis
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.