Large # of XAxis Items

Thread is closed for posting
2 posts, 0 answers
  1. PaulMrozowski
    PaulMrozowski avatar
    80 posts
    Member since:
    Apr 2007

    Posted 31 Dec 2008 Link to this post

     I have a chart which is going to show an area chart with one point for each day over a 6 month period. I only want to show an X axis item for each month of the 6 month period. I tried just adding an Item for each new month (ex. RadChart1.PlotArea.XAxis.AddItem("Name of Month")) but then the other set of data doesn't show up (eg. the chart is empty).

    If I add one item for every item in my series (one for every day) I end up with a completely unreadable mess at the bottom of the chart. Instead, I tried added a new item, but setting it's text to empty, ex. RadChart1.PlotArea.XAxis.AddItem(""). That is also unreadable - it fills in the empty values with 0.

    Here's what the code basically looks like:

    this.radRollingChart.AutoLayout = true
    this.radRollingChart.AutoTextWrap = true
     
    Telerik.Charting.ChartSeries peopleSeries = new Telerik.Charting.ChartSeries("People", Telerik.Charting.ChartSeriesType.Area);                       
    this.radRollingChart.Series.Add(peopleSeries); 
     
    peopleSeries.PlotArea.XAxis.AutoScale = false
     
    int currentMonth = 0
    foreach (DataRow row in traffic.Rows) 
        DateTime ddate = (DateTime)row["ddate"]; 
        if (ddate.Month != currentMonth) 
        { 
            string date = ddate.ToString("MMM dd yyyy"); 
            this.radRollingChart.PlotArea.XAxis.AddItem(date); 
            currentMonth = ddate.Month; 
        } 
        else 
            this.radRollingChart.PlotArea.XAxis.AddItem(""); 
                     
        peopleSeries.AddItem((int)row["Count"]); 

    Any thoughts on how I can do this?

    Also, is there a way to shut off the value that appears at the top of each data point in the chart (above each "bar")?


  2. PaulMrozowski
    PaulMrozowski avatar
    80 posts
    Member since:
    Apr 2007

    Posted 02 Jan 2009 Link to this post

    > Also, is there a way to shut off the value that appears at the top of each data point in the chart (above each "bar")?

    It looks like if you set: chartSeries.Appearance.ShowLabels = false it will not show this.

    As far as the first problem I ended up setting "empty" values to a \n, ex. this.radRollingChart.PlotArea.XAxis.AddItem("\n"); - that appears to work. The main downside to this was that the labels are now vertical even though there is enough space between each of them. Setting this.radRollingChart.AutoTextWrap = false fixed that issue as well.
Back to Top