Hello,
I have a chart that display a series of data across a date range. There are 24 data points per day. Sometimes we are displaying 30 days, sometimes we are displaying many more days. Obviously this is to many labels to display. I would liket there to always be about 30 labels no matter how many days worth of data I am sidplaying. I understand the only way to do this is by using the LabelStep property. I would like to set the label step property at runtime based on the number of data points that are in the chart.
I add the labels through the PlotArea.XAxis.AddRange method. The series is bound to the SQL datasource. In the chart_ItemDataBound event I get the number of datapoints and try to set the LabelStep property as shown below. However, no matter what I try the labelstep property that I set at runtime is not used and rather is uses the value set as designtime.
private
void
chart_ItemDataBound(
object
sender, EventArgs e)
{
//get handles
Telerik.Reporting.Processing.Chart ProcessingChart = (Telerik.Reporting.Processing.Chart)sender;
Telerik.Reporting.Chart ChartDefinition = (Telerik.Reporting.Chart)ProcessingChart.ItemDefinition;
//get the number of datapoints
int
iDataPoints = ChartDefinition.Series[0].Items.Count;
if
(iDataPoints > 0)
{
//setting the labelstep on chart defination object from the processing chart
ChartDefinition.PlotArea.XAxis.LabelStep = iDataPoints / 30;
//also have tried setting setting the labelstep on actual chart object
chart.PlotArea.XAxis.LabelStep = iDataPoints / 30;
}
}
Why is the chart not using the labelstep property that I set at runtime?
Thanks,
Chris