Top and Bottom Axis

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
theyield
Newbie
Newbie
Posts: 16
Joined: Thu Sep 22, 2016 12:00 am

Top and Bottom Axis

Post by theyield » Mon Mar 13, 2017 3:42 am

How do I show both the bottom and top axis on my chart? I want to show a 6hr increment on the bottom axis and a day increment on the top.
It only shows the bottom axis.


var bottomAxis = tChart.Axes.Bottom;
bottomAxis.Automatic = true;
bottomAxis.Ticks.Length = 1;
bottomAxis.RelativePosition = 0;
bottomAxis.MinorGrid.Visible = false;
bottomAxis.MinorTicks.Visible = false;
bottomAxis.Grid.Visible = false;
bottomAxis.Labels.DateTimeFormat = "hh:mm tt";
bottomAxis.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.SixHours);



var topAxis = tChart.Axes.Top;
topAxis.Automatic = true;
topAxis.Ticks.Length = 1;
topAxis.Visible = true;

topAxis.RelativePosition = 0;
topAxis.MinorGrid.Visible = false;
topAxis.MinorTicks.Visible = false;
topAxis.Grid.Visible = true;
topAxis.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneDay);

topAxis.Labels.DateTimeFormat = "d MMM";

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

Re: Top and Bottom Axis

Post by Christopher » Mon Mar 13, 2017 3:58 pm

Hello,

You should be able to use e.g.:

Code: Select all

    private void InitializeChart()
    {
      Line series = new Line(tChart1.Chart);
      series.FillSampleValues();
      series.HorizAxis = HorizontalAxis.Both;
    }
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

theyield
Newbie
Newbie
Posts: 16
Joined: Thu Sep 22, 2016 12:00 am

Re: Top and Bottom Axis

Post by theyield » Mon Mar 13, 2017 9:49 pm

Thanks, it worked once I added the line you suggested - series.HorizAxis = HorizontalAxis.Both;

Post Reply