Welcome to the Xceed Community | Help
Community Search  
More Search Options

How to have vertical text labels on the xAxis?

Sort Posts: Previous Next
  •  07-01-2009, 3:25 PM Post no. 22195

    How to have vertical text labels on the xAxis?

    Hey everyone,

    I got a quick question. I am using a LineSeries chart at the moment and am supplying my own text labels for the xAxis ( xAxis.DimensionScale.AutoLabels = false;). I get my labels rendering just fine which is great. The issue I am having is that my labels are kinda long, so they tend to overwrite each other. 

    How can I get them to display vertically with a bit of a tilt as is common in such situations? Having them display horizontally right now is not working very well. 

    Thanks!

     

  •  07-13-2009, 8:14 PM Post no. 22529 in reply to 22195

    Re: How to have vertical text labels on the xAxis?

    Any body has a solution to this ? I am running into this same issue .

     

  •  07-24-2009, 1:27 PM Post no. 22883 in reply to 22195

    Re: How to have vertical text labels on the xAxis?

    Hi,

    If you launch the Xceed Chart Explorer for .NET (located in "C:\Program Files\Xceed Components\Bin\.NET\Xceed Chart Explorer.exe" by default), and if you open the "Texts and Labels" chapter and if you click on "General", you will see that you can add a new label and give it the orientation you want.  You can then click on the C# Code (or VB.NET Code). 

    private void UpdateLabelFromControls()
        {
          ChartLabel label = GetSelectedLabel();

          if (m_bUpdating)
            return;

          m_bUpdating = true;

          if (label != null)
          {
            EnableControls(true);

            label.HorizontalMargin = HorizontalMarginScrollBar.Value;
            label.VerticalMargin = VerticalMarginScrollBar.Value;
            label.TextProps.HorzAlign = (HorzAlign)HorizontalAlignComboBox.SelectedIndex;
            label.TextProps.VertAlign = (VertAlign)VerticalAlignComboBox.SelectedIndex;
            label.TextProps.Orientation = OrientationScrollBar.Value;
            label.TextProps.Backplane.Visible = HasBackplaneCheckBox.Checked;
            label.TextProps.Backplane.Style = (BackplaneStyle)ShapeComboBox.SelectedIndex;

            m_ChartControl.Refresh();
          }

          m_bUpdating = false;
        }

    So the important, here, is label.TextProps.Orientation = OrientationScrollBar.Value;

    Okay, this for a normal label.  If we are looking for the axes labels, then, still in the Xceed Chart Explorer for .NET,

    go to All Examples -> Axes -> General -> Appearance and, from there, click on the "Axis Texts Properties" at the right. 

    This is what is getting called :

        private void TextsFontButton_Click(object sender, System.EventArgs e)
        {
          if (m_Chart.Axis(StandardAxis.PrimaryY).Text.ShowEditor())
          {
            m_ChartControl.Refresh();
          }
        }

    So if you set:

            m_Chart.Axis(StandardAxis.PrimaryY).Text.Orientation = 45.0f; 

    you will be setting the Y axis text orientation 45 degrees counterclockwise.


    Ghislain
    Technical Support and software developer
    Xceed Software Inc.
    Knowledge Base : http://xceed.com/kb/
    Update Center : http://xceed.com/updates/
    Documentation Center : http://xceed.com/doc/
    For everything else, there is Google
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.