radc:RadChart - Bar Chart - Display dynamic string value in label for X axix

Thread is closed for posting
4 posts, 0 answers
  1. Dane
    Dane avatar
    4 posts
    Member since:
    Feb 2009

    Posted 25 Feb 2009 Link to this post

    I,m very new to radc:RadChart.
    This may be really simple thing. But still cannot do this. radc:RadChart I started today.:)  
    I have a bar chart, which I need to display 24 hours in X value, but I need to display this value as string. Because this a dynamic field I'm getting from database.

    as an example i need to display last 24 hours as 1 hour time gap from current time to back 24 hours.

    9.34-8.34| 8.34 - 7.34 | 7.34-6.34| ...

    I have this data. I just want to add this value to label and display on x axix.

    For y axix I have integer value coming from same table.

    My table structure as belows. It has only two columns.

    count - int -> Y axix
    TimeSpan - string -> X axix
    Appreciate help., I'm already playing with charts..
  2. Dane
    Dane avatar
    4 posts
    Member since:
    Feb 2009

    Posted 25 Feb 2009 Link to this post

    Ok.. i think I got it.. if I want to add these values in code behind, this is the way...
    this seems Ok...

    RadChart2.XAxis.AddItem("1.34 - 2.34");
                RadChart2.XAxis.AddItem("2.34 - 3.34");
                RadChart2.XAxis.AddItem("3.34 - 4.34");
  3. Dane
    Dane avatar
    4 posts
    Member since:
    Feb 2009

    Posted 25 Feb 2009 Link to this post

    no I'm not getting correct values in chart.. :(

    This is my ASPX page..,

    <radc:RadChart ID="RadChart2" BarWidthPercent="90" runat="server" Height="400px"
                        <Legend ItemFont="Arial, 6.75pt"></Legend>
                        <YAxis Step="1">
                            <radc:ChartTitle Text="Bar" TextFont="Arial, 9.75pt, style=Bold">
                        <XAxis AutoScale="False" DataLabelsColumn="hour_start" MaxItemsCount="24" LabelRotationAngle="-70"
                            <radc:ChartSeries Name="Series 1">
                                <Appearance MainColor="199, 243, 178" SecondColor="17, 147, 7" BorderColor="DimGray">
                                <LabelAppearance TextFont="Arial, 8pt">

    this is my code behind..

    ChartSeries s = RadChart2.GetChartSeries(0);
                foreach (DataRow dr in dsHourlyData.Tables[0].Rows)
                    ChartSeriesItem item = new ChartSeriesItem();
                    item.YValue = Convert.ToDouble(dr["Count"]);

    but this dosn't give me the exact out put as record in my data table.. :(
    Appreciate some body tell me whats wrong I'm doing here...

  4. Vladimir Milev
    Vladimir Milev avatar
    1061 posts

    Posted 02 Mar 2009 Link to this post

    Hello Dane,

    What do you mean you are not getting correect values? The string values will appear in the order you are adding them (i.e. they will not be sorted), and in this case SeriesItem XValues will not be respected because you are supplying string data, not numeric. But besides that everything looks correct. Can you please elaborate a bit?

    Sincerely yours,
    Vladimir Milev
Back to Top