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

Large # of XAxis Items

1 Answer 66 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
PaulMrozowski
Top achievements
Rank 1
PaulMrozowski asked on 31 Dec 2008, 07:59 PM
 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")?


1 Answer, 1 is accepted

Sort by
0
PaulMrozowski
Top achievements
Rank 1
answered on 02 Jan 2009, 01:44 PM
> 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.
Tags
Chart (Obsolete)
Asked by
PaulMrozowski
Top achievements
Rank 1
Answers by
PaulMrozowski
Top achievements
Rank 1
Share this question
or