Vertical X-Axis Labels & Spacing

Thread is closed for posting
3 posts, 0 answers
  1. Ty
    Ty avatar
    4 posts
    Member since:
    Apr 2009

    Posted 11 May 2009 Link to this post

    The spacing between labels works just fine when labels are horizontal, but when I rotate x-axis labels by 90 degrees they appear irregularly spaced from each other.  It appears the length of text in the label affects the spacing (example) between labels.

    Is there a way to make the labels equidistant apart as they are with AutoScale enabled, but still display these ShortDateTimeStrings?

    Here's the markup for a chart:
    <rad:RadChart ID="Chart1" runat="server" Height="450" Width="850" IntelligentLabelsEnabled="false" AutoLayout="true"
                    <Legend Visible="false" /> 
                    <PlotArea> 
                        <Appearance Dimensions-Margins="10,20,90,50" FillStyle-MainColor="White" FillStyle-FillType="Solid" Border-Visible="false" /> 
                    </PlotArea> 
                    <ChartTitle TextBlock-Text="Active POs by Client" Visible="false" /> 
                    <Appearance Dimensions-Height="450" Dimensions-Width="850" FillStyle-MainColor="White" Border-Visible="false" /> 
                </rad:RadChart> 


    And the function that this chart is passed to:
    private void PopulateChart( RadChart chart, string queryName, int clientID ) 
            { 
                Font calibri = new Font( "Calibri", 9 ); 
     
                ChartSeries series = new ChartSeries( string.Empty, ChartSeriesType.Area ); 
     
                series.Appearance.TextAppearance.TextProperties.Font = calibri; 
                chart.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = calibri; 
                chart.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Font = calibri; 
     
                chart.AddChartSeries( series ); 
                chart.PlotArea.XAxis.Clear( ); 
                chart.PlotArea.XAxis.AutoScale = false
                chart.PlotArea.XAxis.LayoutMode = ChartAxisLayoutMode.Normal; 
                chart.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 90; 
                chart.PlotArea.XAxis.Items.Clear( ); 
                chart.Series[0].Items.Clear( ); 
     
                foreach ( KeyValuePair<DateTime, int> item in GetData( clientID, queryName ) ) 
                { 
                    chart.PlotArea.XAxis.AddItem( item.Key.ToShortDateString( ) ); 
                    string label = item.Value.ToString( "N0" ); 
     
                    ChartSeriesItem i = new ChartSeriesItem( item.Value, label ); 
                    chart.Series[0].AddItem( i ); 
                } 
            } 

  2. Dessy
    Admin
    Dessy avatar
    73 posts

    Posted 12 May 2009 Link to this post

    Hi ,

    We were unable to reproduce the problem on our side. We created a test page using your code and changing only data values. RadChart generated from this code, is displaying its labels properly arranged in equal distance. 
    You can check the attached sample page, illustrating this. The resulting chart seems to be fine with both RadChart for ASP.NET and RadChart for ASP.NET AJAX version.
    Please, make sure you use the latest version of the control. We would recommend you to use the latest versions of our products, so you are able to take advantage of the new features and bugfixes.

    Regards,

    Dessy
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Ty
    Ty avatar
    4 posts
    Member since:
    Apr 2009

    Posted 12 May 2009 Link to this post

    Thank you for your help.
Back to Top