Home Forums WinForms controls Xceed Chart for WinForms How to have vertical text labels on the xAxis?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #19144 |

    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!

     

    Imported from legacy forums. Posted by Nazeeh (had 2643 views)

    User (Old forums)
    Member
    Post count: 23064

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

     

    Imported from legacy forums. Posted by Vihang (had 1149 views)

    User (Old forums)
    Member
    Post count: 23064

    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.

    Imported from legacy forums. Posted by Ghislain (had 2858 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.