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

Bar Data slides down

2 Answers 44 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Ernesto
Top achievements
Rank 1
Ernesto asked on 06 Jun 2011, 04:21 PM
Hi,

I have a chart that that makes a comparison. Let's say I have in the x-axis information from Q1 through Q4 for two companies. Therefore, I should have two bars for Q1, two bars for Q2 and so on. This works fine when I do have data for all four quarters.
This set up does not work when one of the companies does not have data for one of the quarters. Let's say Q3 does not have data for one of the companies. In this scenerio, the value of Q4 slides down to fill in the value in Q3, and Q4 is left without data for that company.

The following is how the chart is set up:
chartDefinition.DataGroupColumn = "Name";
chartDefinition.PlotArea.XAxis.DataLabelsColumn = "TimePeriod";
chartDefinition.Legend.Appearance.GroupNameFormat = "#VALUE:#NAME";

How can I fix this issue?
Thanks,
E.

2 Answers, 1 is accepted

Sort by
0
Missing User
answered on 09 Jun 2011, 01:18 PM
Hello Ernesto,

RadChart groups the items correctly and the chart series contain the correct items with their corresponding values. The ChartSeriesItems however do not have their XValue property set, so all the series start from the very left position. To fix this you have to set items' X position (XValue), unfortunately RadChart will not do it in this scenario. This can be done by wiring the ItemDataBound event of RadChart. The event args contain the ChartSeriesItem that you need to update and the underlying data item, which provides the data. Please, find attached a small example, based on the information provided. You might need to update the code, which retrieves the XValue if you have data for more than one year.

I hope that this helps.

All the best,
Polina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Ernesto
Top achievements
Rank 1
answered on 09 Jun 2011, 01:40 PM
Thank you very much. I will give it a try.
E.
Tags
Chart (Obsolete)
Asked by
Ernesto
Top achievements
Rank 1
Answers by
Missing User
Ernesto
Top achievements
Rank 1
Share this question
or