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:
And the function that this chart is passed to:
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 ); |
} |
} |