Bottom Axis Label Start Position

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
tirby
Newbie
Newbie
Posts: 84
Joined: Mon Mar 16, 2009 12:00 am

Bottom Axis Label Start Position

Post by tirby » Tue Nov 24, 2015 10:43 pm

Hi,

In the 2 images I have posted here, I need to figure out how to make the 1st label and 1st vertical line appear at the leftmost position of the graph regardless of the value.
I have also uploaded the project as well.

This 1st picture shows the discrepancy.
Pic1.png
Pic1.png (49.42 KiB) Viewed 6856 times
This picture is similar what it should look like - it should have a time mark under the rightmost edge of the graph as well.
Please note that this picture seems to be exactly what I need, however at any given time this is not what it looks like - (see Pic1).
Pic2.png
Pic2.png (29.74 KiB) Viewed 6856 times
Thanks for your assistance!
Attachments
BottomAxisTest.Zip
(10.03 KiB) Downloaded 784 times

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

Re: Bottom Axis Label Start Position

Post by Christopher » Wed Nov 25, 2015 1:54 pm

Hello,

Do you mean something like this:

Code: Select all

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      Line line1 = new Line(tChart1.Chart);
      Random rnd = new Random();
      DateTime today = DateTime.Today;
      for (int i = 0; i < 20; i++)
      {
        line1.Add(today, rnd.Next(0, 1000));
        today = today.AddDays(1);
      }

      tChart1.Axes.Bottom.Labels.Angle = 90;
      tChart1.Axes.Bottom.Labels.DateTimeFormat = "dd/MM/yyyy";

      tChart1.BeforeDrawAxes += TChart1_BeforeDrawAxes;
    }

    private void TChart1_BeforeDrawAxes(object sender, Graphics3D g)
    {
      Axis bottom = tChart1.Axes.Bottom;
      AxisLabelsItems labels = bottom.Labels.Items;
      double min = bottom.Minimum;
      double max = bottom.Maximum;
      double inc = 1; //one day

      labels.Clear();

      for (double i = min; i <= max; i+=inc)
      {
        labels.Add(i, DateTime.FromOADate(i).ToString(bottom.Labels.DateTimeFormat));
      }
    }
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