Line series divided into sections by vertical line markers

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
skruegel
Newbie
Newbie
Posts: 5
Joined: Wed Jun 25, 2008 12:00 am
Contact:

Line series divided into sections by vertical line markers

Post by skruegel » Thu Dec 10, 2009 5:19 pm

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.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Line series divided into sections by vertical line markers

Post by Yeray » Fri Dec 11, 2009 3:34 pm

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;
            }
        }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply