Realize custome line

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
coldwind
Newbie
Newbie
Posts: 41
Joined: Tue Dec 27, 2022 12:00 am

Realize custome line

Post by coldwind » Fri Feb 03, 2023 8:43 am

hello:
I got a question, That's how to realize custome line ?
Just like the color line in demo, but i need to add the custome label above the end of the line and make the solid line to be dotted line

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Realize custome line

Post by Christopher » Mon Feb 06, 2023 9:08 am

Hello,

you can change the style of the ColorLine Pen by using the Pen.Style property, e.g.

Code: Select all

        readonly ColorLine colorLine;

        public Form1()
        {
            InitializeComponent();

            var bar = new Bar(tChart1.Chart);
            bar.FillSampleValues();
            colorLine = new ColorLine(tChart1.Chart)
            {
                Axis = tChart1.Axes.Bottom,
                Value = 2.5
            };
            colorLine.Pen.Width = 3;
            colorLine.Pen.Color = Color.Red;
            colorLine.Pen.Style = Steema.TeeChart.Drawing.DashStyle.Dot;

            tChart1.AfterDraw += TChart1_AfterDraw;
        }

        private void TChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.IGraphics3D g)
        {
            g.Font.Size = 16;
            g.TextOut(tChart1.Axes.Bottom.CalcXPosValue(colorLine.Value), tChart1.Axes.Left.IStartPos, "Hello");
        }
Screenshot from 2023-02-06 10-07-15.png
Screenshot from 2023-02-06 10-07-15.png (30.88 KiB) Viewed 2795 times
Best Regards,
Christopher Ireland / 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

Post Reply