Page 1 of 1

SeriesMarks AutoPosition cuts off marks on top

Posted: Wed Jun 22, 2016 1:35 pm
by 15673848
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 24360 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

Re: SeriesMarks AutoPosition cuts off marks on top

Posted: Thu Jun 23, 2016 8:55 am
by Christopher
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 24347 times
toggling to 2D gives me this:
636022759525775819.png
636022759525775819.png (17.06 KiB) Viewed 24345 times
which version of TeeChart.dll are you using?

Re: SeriesMarks AutoPosition cuts off marks on top

Posted: Thu Jun 30, 2016 11:53 am
by 15673848
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.

Re: SeriesMarks AutoPosition cuts off marks on top

Posted: Thu Jun 30, 2016 1:20 pm
by narcis
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;

Re: SeriesMarks AutoPosition cuts off marks on top

Posted: Mon Jul 04, 2016 1:22 pm
by 15678474
Hi NarcĂ­s,

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