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

Bar Chart --bar width optimization

1 Answer 85 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Bishwajit
Top achievements
Rank 1
Bishwajit asked on 09 Aug 2011, 12:37 PM
Hi,

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 .

ASAP.


1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 11 Aug 2011, 09:34 AM
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,
Evgenia
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.

Tags
Chart (Obsolete)
Asked by
Bishwajit
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or