Page 1 of 1
Line series divided into sections by vertical line markers
Posted: Thu Dec 10, 2009 5:19 pm
by 13049469
I have a requirement for a line series divided into sections by vertical lines. Optimally, I could choose the spacing and number of the vertical lines. It would also be helpful if those line sections had a different appearance, and an annotation.
Re: Line series divided into sections by vertical line markers
Posted: Fri Dec 11, 2009 3:34 pm
by yeray
Hi skruegel,
Have you seen the demos "
All Features\Welcome !\Tools\Color Line" and "
All Features\Welcome !\Tools\Annotation" from New features program included with the TeeChart installation?
Here is a starting example:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
chartController1.Chart = tChart1;
tChart1.Aspect.View3D = false;
tChart1.Legend.Visible = false;
Steema.TeeChart.Styles.FastLine fastline1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
fastline1.FillSampleValues(200);
tChart1.Draw();
int nColorLines = 5;
Steema.TeeChart.Tools.ColorLine tmpColorLine;
Steema.TeeChart.Tools.Annotation tmpAnnotation;
Random rnd = new Random();
for (int i = 0; i < nColorLines; i++)
{
tmpColorLine = new Steema.TeeChart.Tools.ColorLine(tChart1.Chart);
tmpColorLine.Axis = tChart1.Axes.Bottom;
tmpColorLine.Pen.Color = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
tmpColorLine.Value = (tmpColorLine.Axis.Maximum - tmpColorLine.Axis.Minimum) * (i+1) / (nColorLines+1);
tmpAnnotation = new Steema.TeeChart.Tools.Annotation(tChart1.Chart);
tmpAnnotation.Left = tChart1.Axes.Bottom.CalcPosValue(tmpColorLine.Value) + 5;
tmpAnnotation.Top = tChart1.Axes.Left.CalcPosValue(tChart1.Axes.Left.Maximum) + 10;
tmpAnnotation.Text = "ColorLine n" + (i+1).ToString();
tmpAnnotation.Shape.Color = tmpColorLine.Pen.Color;
}
}