Bar Data slides down

Thread is closed for posting
3 posts, 0 answers
  1. Ernesto
    Ernesto avatar
    3 posts
    Member since:
    Feb 2011

    Posted 06 Jun 2011 Link to this post

    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. Missing user
    Missing user avatar

    Posted 09 Jun 2011 Link to this post

    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.

  3. Ernesto
    Ernesto avatar
    3 posts
    Member since:
    Feb 2011

    Posted 09 Jun 2011 Link to this post

    Thank you very much. I will give it a try.
    E.
Back to Top