Page 1 of 1

ColorLine Text description

Posted: Fri Feb 03, 2023 1:39 am
by 21094727
Can you add a description at the top left, bottom left, top right and bottom right positions of the color line

Effect display

__________________________________________________________________________________
Description: Average line

Re: ColorLine Text description

Posted: Mon Feb 06, 2023 8:57 am
by Christopher
Hello,

You can draw text to the Chart using one of its Drawing events, and can use the position of Chart elements to draw text relative to them, 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;

            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 09-56-36.png
Screenshot from 2023-02-06 09-56-36.png (32.91 KiB) Viewed 3206 times