Equally spread axis labels

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
OMP
Newbie
Newbie
Posts: 4
Joined: Mon Jun 06, 2016 12:00 am

Equally spread axis labels

Post by OMP » Mon Feb 20, 2017 9:05 am

Hi,
We're experimenting with some label styles and like the fact that when using AxisLabelStyle.PointValue, axis labels are all lined up with the chart points.
We also like the fact that when using AxisLabelStyle.Value, axis labels are nicely spread along the axis. When there is not enough space, the interval between labels is increased, so that labels stay spread equally over the axis.

When there is not enough space when using AxisLabelStyle.PointValue however, individual labels are left out, depending on the available space, causing the labels not to be spread equally anymore.
What we're wondering now:
Is there an option to combine the behavior of both label styles, so that axis labels are still lined up with the chart points (AxisLabelStyle.PointValue), but when there is not enough space on the axis, to not hide individual labels, but just show 1 out of every 2, 3, 4,... labels, so that the labels are still spread nicely over the axis (AxisLabelStyle.Value)?
Attachments
labels_value_notenoughspace.png
AxisLabelStyle.Value - not enough space
labels_value_notenoughspace.png (14.23 KiB) Viewed 12504 times
labels_pointvalue_notenoughspace.png
AxisLabelStyle.PointValue - not enough space
labels_pointvalue_notenoughspace.png (14.75 KiB) Viewed 12503 times
labels_pointvalue_enoughspace.png
AxisLabelStyle.PointValue - enough space
labels_pointvalue_enoughspace.png (15.97 KiB) Viewed 12501 times

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

Re: Equally spread axis labels

Post by Christopher » Mon Feb 20, 2017 11:28 am

OMP wrote: Is there an option to combine the behavior of both label styles, so that axis labels are still lined up with the chart points (AxisLabelStyle.PointValue), but when there is not enough space on the axis, to not hide individual labels, but just show 1 out of every 2, 3, 4,... labels, so that the labels are still spread nicely over the axis (AxisLabelStyle.Value)?
A quick question - do you know if the gap between points, that is, the size of the TimeSpan between them, will be constant or not? If you cannot guarantee a constant gap value then your request is not going to be trivial to achieve.
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

OMP
Newbie
Newbie
Posts: 4
Joined: Mon Jun 06, 2016 12:00 am

Re: Equally spread axis labels

Post by OMP » Mon Feb 20, 2017 2:44 pm

Christopher wrote: A quick question - do you know if the gap between points, that is, the size of the TimeSpan between them, will be constant or not? If you cannot guarantee a constant gap value then your request is not going to be trivial to achieve.
Yes, we assume that the gap between 2 points will always be 1 week, so this is constant.

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

Re: Equally spread axis labels

Post by Christopher » Thu Feb 23, 2017 9:20 am

Hello,

Apologies for the delay in my reply. I can see what you mean - I think the situation can be slightly bettered by setting the bottom axis' label angle to 90º, e.g.

Code: Select all

    private void InitializeChart()
    {
      Line series = new Line(tChart1.Chart);

      DateTime now = DateTime.Now;
      Random rnd = new Random();

      for (int i = 0; i < 50; i++)
      {
        series.Add(now, rnd.Next(1000));
        now = now.AddDays(7);
      }


      tChart1.Axes.Bottom.Labels.DateTimeFormat = "dd/MM/yy hh:mm:ss";
      tChart1.Axes.Bottom.Labels.Angle = 90;
      tChart1.Axes.Bottom.Labels.Style = AxisLabelStyle.PointValue;
    }
but the gaps between the labels are still much bigger than when the Style is set to Auto. I have added this issue to our issue tracker with id=1801.
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

OMP
Newbie
Newbie
Posts: 4
Joined: Mon Jun 06, 2016 12:00 am

Re: Equally spread axis labels

Post by OMP » Mon Feb 27, 2017 7:46 am

Christopher wrote:Apologies for the delay in my reply. I can see what you mean - I think the situation can be slightly bettered by setting the bottom axis' label angle to 90º
No problem, thank you for the hint and for adding the issue to the issue tracker.

Post Reply