This is a migrated thread and some comments may be shown as answers.

Trouble in adding a Label to X Axix...?

1 Answer 67 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Dane
Top achievements
Rank 1
Dane asked on 26 Feb 2009, 06:59 AM
When I add a label to X axix of my bar chart it only shows few x axix values, records doesn't show correctly. When I remove the label it shows all the X axix values, but then there is no x axix label to denote what is x axix means.
This may be a stupid mistake I'm doing... Following is my ASP.NET page... why all of records in my table doesn't display...?

<radc:RadChart ID="RadChartq" runat="server" Margins-Bottom="125px" Margins-Left="10%" 
                    Margins-Right="10%" Width="800px" Palette="Gradient" Height="500px"
                    <Gridlines> 
                        <VerticalGridlines Visible="False" /> 
                        <HorizontalGridlines Color="DarkGray" /> 
                    </Gridlines> 
                    <YAxis MaxValue="65"
                        <Label ShadowColor="180, 0, 0, 0" TextFont="Arial, 10pt"
                        </Label> 
                       
                    </YAxis> 
                    
                    
                    <XAxis AutoScale="False" DataLabelsColumn="hour_start" MaxItemsCount="24" LabelRotationAngle="-70" 
                        ValueFormat="ShortTime"
                        <Label ShadowColor="180, 0, 0, 0" TextFont="Arial, 10pt"
                        </Label> 
                    </XAxis> 
                    <Legend VAlignment="Top" VSpacing="40"
                        <Background BorderColor="144, 144, 144" FillStyle="Solid" MainColor="White" /> 
                    </Legend> 
                    <Background BorderColor="Gray" FillStyle="Gradient" MainColor="Silver" SecondColor="White" 
                        BorderWidth="1" Corners-RoundSize="6" /> 
                    <PlotArea BorderColor="" Corners-BottomLeft="Round" Corners-BottomRight="Round" Corners-RoundSize="6" 
                        Corners-TopLeft="Round" Corners-TopRight="Round" /> 
                    <ChartTitle HorPadding="10" HSpacing="10" ShadowColor="180, 0, 0, 0" TextColor="White" 
                        TextFont="Arial, 16px" > 
                        <Background FillStyle="Solid" /> 
                    </ChartTitle> 
                    <EmptySeriesMessage ShadowColor="180, 0, 0, 0" TextColor="Red" TextFont="Arial, 12pt"
                    </EmptySeriesMessage> 
                </radc:RadChart> 

Code Behind..
DataSet dsData = new WebServices().METHOD(); 
            Font labelFont = new Font("Arial", 9, GraphicsUnit.Pixel); 
            ChartSeries Series1 = this.RadChart1.CreateSeries("TITLE..", Color.Empty, ChartSeriesType.Bar); 
            Series1.LabelAppearance.TextColor = Color.DarkSlateGray; 
            Series1.LabelAppearance.Alignment = ContentAlignment.TopCenter; 
            Series1.LabelAppearance.TextFont = labelFont; 
            Series1.LabelAppearance.RotationAngle = -90; 
            Series1.LabelAppearance.VerPadding = 5; 
            Series1.LineWidth = 2; 
            Series1.MainColor = Color.Green; 
 
            foreach (DataRow row in dsData.Tables[0].Rows) 
            { 
                ChartSeriesItem item = new ChartSeriesItem(); 
                item.XValue = ((DateTime)row["hour_start"]).ToLocalTime().ToOADate(); 
                item.YValue = Convert.ToDouble(row["ROWS"]); 
                Series1.Items.Add(item); 
            } 
 
I need to display the label in date time format.  My table has only two columns, ROWS, and hour_start Appreciate help..

1 Answer, 1 is accepted

Sort by
0
Vladimir Milev
Telerik team
answered on 02 Mar 2009, 07:40 AM
Hello Dane,

I have prepared a small example project for you to demonstrate the basic functionality of adding custom XAxis labels manually. It seems to be working fine. Can you please take a look? It may be what you are after.

Regards,
Vladimir Milev
Tags
Chart (Obsolete)
Asked by
Dane
Top achievements
Rank 1
Answers by
Vladimir Milev
Telerik team
Share this question
or