Drawing X and Y axes on chart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Innervations
Newbie
Newbie
Posts: 13
Joined: Wed Dec 19, 2018 12:00 am

Drawing X and Y axes on chart

Post by Innervations » Tue Feb 26, 2019 12:11 pm

Is there any way to ensure TeeChart draws the X and Y axes on a graph. In other words I need to display a vertical and horizontal line through the origin (0,0) of my Fastline chart.

Thanks
Rob

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

Re: Drawing X and Y axes on chart

Post by Christopher » Wed Feb 27, 2019 9:49 am

Hi Rob,

maybe you have in mind something like this:
TeeChartPro_2019-02-27_10-46-07.png
TeeChartPro_2019-02-27_10-46-07.png (15.58 KiB) Viewed 9974 times
This can be achieved with code similar to this:

Code: Select all

        private void InitializeChart()
        { 
            var forvel = new FastLine(tChart1.Chart);

            var lines = File.ReadAllLines(@"D:\tmp\FastLine Data.csv").Skip(1)
              .Select(x => x.Split(','))
              .Select(x => x.Select(y => double.Parse(y)))
              .Select(x => new { Time = x.ToArray()[0], Velocity = x.ToArray()[1], Force = x.ToArray()[2] }).ToArray();

            forvel.Add(lines.Select(x => x.Velocity).ToArray(), lines.Select(y => y.Force).ToArray());

            tChart1.Axes.Left.AxisPen.Visible = true;
            tChart1.Axes.Left.PositionUnits = PositionUnits.Percent;
            tChart1.Axes.Bottom.PositionUnits = PositionUnits.Percent;

            tChart1.Axes.Left.RelativePosition = 50;
            tChart1.Axes.Bottom.RelativePosition = 50;

            tChart1.Axes.Left.SetMinMax(-2300, 2300);
            tChart1.Axes.Bottom.SetMinMax(-3, 3);
        }
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