Bar Chart --bar width optimization

Thread is closed for posting
2 posts, 0 answers
  1. Bishwajit
    Bishwajit avatar
    6 posts
    Member since:
    Mar 2011

    Posted 09 Aug 2011 Link to this post


    Can by any mean i fix the width of a bar in a bar chart.

    as if the number of bars are less ,then each bar takes enormous width whereas if the number of bars are more ,then  all the bars  shrinks to very small width.

    can any one suggest me any fix for this .


  2. Evgenia
    Evgenia avatar
    1437 posts

    Posted 11 Aug 2011 Link to this post

    Hello Bishwajit,

    RadChart is designed so that the bar width actually depends on the number of items. The more  the items - the narrower the bars. This provides the necessary level of flexibility, so that the chart can handle multiple cases with minimum adjustments. Still, in cases like this one RadChart allows you to fix the bar width by fixing the XAxis range. You can use these two lines:

    RadChart1.PlotArea.XAxis.AutoScale = false;
    RadChart1.PlotArea.XAxis.AddRange(0, max, 1);

    where max is defined by the max number of items in the underlying datasource. This way the X axis will always reserve space for max items, and even if there are less items in the chart the bars will not grow.

    All the best,
    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.

Back to Top