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

How to manage width of chart bars?

2 Answers 153 Views
Chart
This is a migrated thread and some comments may be shown as answers.
M STOLYAR
Top achievements
Rank 1
M STOLYAR asked on 21 Jul 2011, 09:18 AM
Hello.
I'm using RadChart with BarSeriesDefinition(or StackedBarSeriesDefinition).
I'm adding 10 data points on chart and observe 10 "quite thin" bars, it looks good.
If I'm adding only 1 data point, I observe 1 "thick" bar and it looks not good. I'd like to get 1 "quite thin" bar at the center of chart.

I've looked for some MinimalWidth property in the list of properties of BarSeriesDefinition, but didn't find one.

How can I set MinimalWidth for bar that added to chart?
Or maybe I can define "number of bars" that is used by RadChart control to calculate final width of bars depending on the availaible space? For example, I setting "number of bars" to 10, adding 2 data points and getting 2 "quite thin" bars at the center of chart.
Is there some way to manage width of chart bars?

Now, if added only 1 data point the chart look like 1.jpg;
If added 7 data points the chart look like 2.jpg;
I'd like to get something like 3.jpg, if added 3 data points.

Regards.

2 Answers, 1 is accepted

Sort by
0
Accepted
Rahul
Top achievements
Rank 2
answered on 24 Jul 2011, 06:38 PM
Only one line of code is there.

radChart1.DefaultView.ChartArea.ItemWidthPercent = 40;
0
Accepted
Nikolay
Telerik team
answered on 26 Jul 2011, 07:46 AM
Hello,

As already mentioned the ItemWidthPercent property is a sufficient way to alter the width of the bars. You can find more information on the subject in this help topic.

Regards,
Nikolay
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Chart
Asked by
M STOLYAR
Top achievements
Rank 1
Answers by
Rahul
Top achievements
Rank 2
Nikolay
Telerik team
Share this question
or