labels disappear

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
OMP
Newbie
Newbie
Posts: 21
Joined: Mon Dec 10, 2012 12:00 am

labels disappear

Post by OMP » Fri Jun 21, 2013 10:51 am

Dear,

I have made a TeeChart with the following code:

Code: Select all

            chartToTest.Aspect.View3D = false;

            Steema.TeeChart.Styles.Line line = new Steema.TeeChart.Styles.Line(chartToTest.Chart);
            line.Add(1, 45, "Label of first item");
            line.Add(2, 50, "Label of second item");
            line.Add(3, 60, "Label of third item");
            line.Add(4, 70, "Label of item 4");
            line.Add(5, 45, "Label of item 5");
            line.Add(6, 35, "Label of item 6");
            line.Add(7, 25, "Label of item 7");
            line.Add(8, 50, "Label of item 8");

            line.Pointer.Visible = true;

            chartToTest.Axes.Bottom.Labels.Angle = 45;
this results in the chart you can see in the attached screenshot.

Why can I only see the labels number 1, 3, 5 and 7? I would expect to see all the labels, as I rotated them.

thanks in advance,
Marijke Van Bergen
OM Partners
Attachments
Capture.PNG
Capture.PNG (25.62 KiB) Viewed 5918 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: labels disappear

Post by Sandra » Fri Jun 21, 2013 11:56 am

Hello Marijke Van Bergen,

The labels are positioned automatically and you need force the position of labels you want painting. Therefore I think to achieve as you want, you need use custom labels as do in next simple code:

Code: Select all

    private void InitializeChart()
    {
      string[] labels = new string[]{"Label of first item","Label of second item","Label of third item","Label of item 4",
        "Label of item 5","Label of item 5", "Label of item 6","Label of item 7","Label of item 8"}; 
      tChart1.Aspect.View3D = false;
      Steema.TeeChart.Styles.Line line1 = new Line(tChart1.Chart);
      line1.Add(1, 45);
      line1.Add(2, 50);
      line1.Add(3, 60);
      line1.Add(4, 70);
      line1.Add(5, 45);
      line1.Add(6, 35);
      line1.Add(7, 25);
      line1.Add(8, 50);
      AddCustomLabels(line1,labels); 
      line1.Pointer.Visible = true; 
     tChart1.Axes.Bottom.Labels.Angle = 45;
      tChart1.Panel.MarginLeft = 10;
    }
    private void AddCustomLabels(Steema.TeeChart.Styles.Series s, string[] arrayLabels)
    {
      tChart1.Axes.Bottom.Labels.Items.Clear();
      for (int i = 0; i < s.Count; i  )
      {
        tChart1.Axes.Bottom.Labels.Items.Add(s.XValues[i], arrayLabels[i]); 
      }
    }
Could you tell us if previous code works in your end?

Thanks,
Best Regards,
Sandra Pazos / 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: 21
Joined: Mon Dec 10, 2012 12:00 am

Re: labels disappear

Post by OMP » Mon Jun 24, 2013 7:07 am

Thank you very much.
This solves my issue.

Kind regards,
Marijke.

Post Reply