Page 1 of 1

Top and Bottom Axis

Posted: Mon Mar 13, 2017 3:42 am
by 17279216
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";

Re: Top and Bottom Axis

Posted: Mon Mar 13, 2017 3:58 pm
by Christopher
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;
    }

Re: Top and Bottom Axis

Posted: Mon Mar 13, 2017 9:49 pm
by 17279216
Thanks, it worked once I added the line you suggested - series.HorizAxis = HorizontalAxis.Both;