No effect with Axes.Bottom.Labels.Separation = 0;

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
JohnS
Newbie
Newbie
Posts: 31
Joined: Mon Aug 26, 2013 12:00 am

No effect with Axes.Bottom.Labels.Separation = 0;

Post by JohnS » Thu Aug 29, 2013 6:29 am

Dear all,


Version: TeeChartNET2013_4.1.2013.07300
Visual Studio 2012
Windows 7 32 bit

We have a chart with bottom axis as follows:

tChart1.Aspect.ClipPoints = true; //Cut values that are outside ChartRect
tChart1.Aspect.View3D = false;
tChart1.AutoRepaint = false;
tChart1.Axes.Bottom.Automatic = false;
tChart1.Axes.Bottom.Labels.DateTimeFormat = "HH:mm:ss";
tChart1.Axes.Bottom.Labels.Font.Name = "Arial";
tChart1.Axes.Bottom.Labels.Font.Size = 10;
tChart1.Axes.Bottom.Labels.RoundFirstLabel = false;
tChart1.Axes.Bottom.Labels.Separation = 0; //Disable automatic control of the increment factor
tChart1.Axes.Bottom.Labels.Style = AxisLabelStyle.Value; //Labels display axis scales
tChart1.Axes.Bottom.Title.Font.Name = "Arial";
tChart1.Axes.Bottom.Title.Font.Size = 12;
tChart1.Axes.Depth.Visible = false;
tChart1.Axes.DepthTop.Visible = false;
tChart1.Axes.Left.Visible = false;
tChart1.Axes.Right.Visible = false;
tChart1.Axes.Top.Visible = false;


Even though tChart1.Axes.Bottom.Labels.Separation = 0 the labels with grid lines are changed automatically
as seen on the enclosed screen dumps.

The increment of the bottom axis of the chart shown on the screen dumps is set like this:
tChart1.Axes.Bottom.Increment = Utils.DateTimeStep[(int)DateTimeSteps.OneHour];

The difference between the two screen dumps is that another Y-axis was added,
and thereby the width of the chart was reduced a litte (on purpose).
In this case the labels should simply overlap, as I then intend to hide every other label in the "tChart1_GetAxisLabel" event.

How can it be that the labels and grid lines are still automatically adjusted, and how can this mechanism be turned off,
if not by setting tChart1.Axes.Bottom.Labels.Separation to 0?


Thanks in advance!
Attachments
Would overlap, but automatic prevented.jpg
Would overlap, but automatic prevented.jpg (124.71 KiB) Viewed 8561 times
Not overlapping yet.jpg
Not overlapping yet.jpg (137.51 KiB) Viewed 8562 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: No effect with Axes.Bottom.Labels.Separation = 0;

Post by Yeray » Fri Aug 30, 2013 1:55 pm

Hi,

The only way I can think on would be to use custom labels to define the exact labels you want to show.
See the example at "All Features\Welcome !\Axes\Labels\Custom labels" in the features demo.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

JohnS
Newbie
Newbie
Posts: 31
Joined: Mon Aug 26, 2013 12:00 am

Re: No effect with Axes.Bottom.Labels.Separation = 0;

Post by JohnS » Sat Aug 31, 2013 12:51 pm

Does this mean that the function of Labels.Separation in TChart .net version is not the same as the function in the VCL version??

In the VCL version (2010) setting Labels.Separation to 0 turned the automatic overlap prevention off!

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: No effect with Axes.Bottom.Labels.Separation = 0;

Post by Narcís » Mon Sep 02, 2013 9:51 am

Hi JohnS,

Labels.Separation won't let labels to overlap in .NET. You are right, this behavior differs from the VCL version.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

JohnS
Newbie
Newbie
Posts: 31
Joined: Mon Aug 26, 2013 12:00 am

Re: No effect with Axes.Bottom.Labels.Separation = 0;

Post by JohnS » Mon Sep 02, 2013 11:05 am

Hi Narcís,

Thanks for the answer.

With the VCL version I allowed the labels to overlap, and then I hided every second label in the "tChart1_GetAxisLabel" event myself.
This way I still had all grid lines, but only a label on every second grid line.
How can I achieve this with the .net version?

By the way: can you help us out with the critical issue with the license problem described in my other post?
It starts to get embarrassing for us (and for Steema...?).
We paid for a license, so it is ironic, that the license appears to cause problems.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: No effect with Axes.Bottom.Labels.Separation = 0;

Post by Narcís » Mon Sep 02, 2013 11:45 am

Hi JohnS,
With the VCL version I allowed the labels to overlap, and then I hided every second label in the "tChart1_GetAxisLabel" event myself.
This way I still had all grid lines, but only a label on every second grid line.
How can I achieve this with the .net version?
You can add blank spaced custom labels every second point, for example:

Code: Select all

      tChart1.Axes.Bottom.Labels.Items.Clear();

      for (int i = 0; i < bar1.Count; i++)
      {
        string text = (i % 2 != 0) ? " " : bar1.XValues[i].ToString();
        tChart1.Axes.Bottom.Labels.Items.Add(bar1.XValues[i], text);
      }
By the way: can you help us out with the critical issue with the license problem described in my other post?
It starts to get embarrassing for us (and for Steema...?).
We paid for a license, so it is ironic, that the license appears to cause problems.
Sure, I just posted a reply on that thread.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply