SeriesMarks AutoPosition cuts off marks on top

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
OMP
Newbie
Newbie
Posts: 5
Joined: Tue Jun 02, 2015 12:00 am

SeriesMarks AutoPosition cuts off marks on top

Post by OMP » Wed Jun 22, 2016 1:35 pm

Hi,

In our project, we are using SeriesMarks.AutoPosition, since this option makes sure series marks are put at an optimal position and we don't have to bother about putting marks at custom positions.
However, we bumped into the following situation, where the series mark is cut off at the top of the chart: (left: 2 values of 500, no cutoff - right: 1 value of 500, 1 value of 501, cutoff)
label_cutoff.png
Left: no cutoff - Right: cutoff
label_cutoff.png (32.26 KiB) Viewed 14265 times
The code to produce the right image:

Code: Select all

Steema.TeeChart.Styles.Line line = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line.Add(0, 0);
line.Add(1, 0);
line.Add(2, 500);
line.Add(3, 501);
line.Add(4, 0);
line.Add(5, 0);
line.Add(6, 0);

line.Marks.Visible = true;
line.Marks.Style = Steema.TeeChart.Styles.MarksStyles.LabelPercentTotal;
line.Marks.AutoPosition = true;
It seems strange that in the right image, the 2nd series mark is placed above the 1st series mark, causing it to be cut off, while there is plenty of space below the 1st series mark, so it should not be cut off. (as is done in the left image)
Is it possible to make sure the series mark is not cutoff in the right image without using custom series marks positions?

Best Regards,
Steven

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

Re: SeriesMarks AutoPosition cuts off marks on top

Post by Christopher » Thu Jun 23, 2016 8:55 am

Hello Steven,
OMP wrote: It seems strange that in the right image, the 2nd series mark is placed above the 1st series mark, causing it to be cut off, while there is plenty of space below the 1st series mark, so it should not be cut off. (as is done in the left image)
Is it possible to make sure the series mark is not cutoff in the right image without using custom series marks positions?
Using the latest version of TeeChart.dll, the chart created by your code looks like this:
636022756741665024.png
636022756741665024.png (23.71 KiB) Viewed 14252 times
toggling to 2D gives me this:
636022759525775819.png
636022759525775819.png (17.06 KiB) Viewed 14250 times
which version of TeeChart.dll are you using?
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: 5
Joined: Tue Jun 02, 2015 12:00 am

Re: SeriesMarks AutoPosition cuts off marks on top

Post by OMP » Thu Jun 30, 2016 11:53 am

Hi Christopher,

Thank you for your reply. I noticed that I forgot to include a small but important part in my code snippet:

Code: Select all

this.tChart1.Aspect.View3D = false;
this.tChart1.Header.Visible = false;
I suspect that making the header invisible triggers the series mark to be cut off.

We are currently using TeeChart version 4.1.2015.5144.

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

Re: SeriesMarks AutoPosition cuts off marks on top

Post by Narcís » Thu Jun 30, 2016 1:20 pm

Hi Steven,
OMP wrote: Thank you for your reply. I noticed that I forgot to include a small but important part in my code snippet:

Code: Select all

this.tChart1.Aspect.View3D = false;
this.tChart1.Header.Visible = false;
I suspect that making the header invisible triggers the series mark to be cut off.
Yes, doing so I got the same result.
OMP wrote: Is it possible to make sure the series mark is not cutoff in the right image without using custom series marks positions?
I'm afraid not, the only workarounds I can think are using CustomChartRect like this:

Code: Select all

      this.tChart1.Aspect.View3D = false;
      this.tChart1.Header.Visible = false;

      Steema.TeeChart.Styles.Line line = new Steema.TeeChart.Styles.Line(tChart1.Chart);
      line.Add(0, 0);
      line.Add(1, 0);
      line.Add(2, 500);
      line.Add(3, 501);
      line.Add(4, 0);
      line.Add(5, 0);
      line.Add(6, 0);

      line.Marks.Visible = true;
      line.Marks.Style = Steema.TeeChart.Styles.MarksStyles.LabelPercentTotal;
      line.Marks.AutoPosition = true;

      //tChart1.Panel.MarginTop = 10;
      //tChart1.Axes.Left.MaximumOffset = 30;

      tChart1.Draw();

      var rect = tChart1.Chart.ChartRect;
      var offset = 10;
      rect.Offset(new Point(0, offset));
      rect.Inflate(0, -offset);
      
      tChart1.Chart.CustomChartRect = true;
      tChart1.Chart.ChartRect = rect;
or increasing panel margin:

Code: Select all

      tChart1.Panel.MarginTop = 10;
or left axis offsets:

Code: Select all

      tChart1.Axes.Left.MaximumOffset = 30;
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

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

Re: SeriesMarks AutoPosition cuts off marks on top

Post by OMP » Mon Jul 04, 2016 1:22 pm

Hi Narcís,

Thank you for offering these workarounds.
I will further investigate what works best in our case.

Post Reply