My client has asked me to make the bar width an absolute value, because they do not like the scaling that is going on. I have tried the ItemWidthPercent property and it is only relative and my client wants to be able to absolutely set the width for all bars in the chart. (They have a settings window where they want to pick the width of the bars using a slider min:10 => max:120). They want to set it to absolute integer values (in pixels)
From what I read on the forum setting the ItemWidthPercent property is the only way to set the width of a bar in the chart. Is this true? Could I not use Styles to set an absolute Width?
6 Answers, 1 is accepted
Bars' width is calculated dynamically according to other factors such as the axis range, ticks, etc. Setting the BarWidthPercent property will give the bars only a percentage of the space available between two ticks, but still they are calculated dynamically as before. One way of setting their width to fixed is to fix the other properties that the bar width depends on - the range, the step and the tick count. If these are fixed, the bar width will be fixed. For example if you want your bars to be 10% of the RadChart's size you can put these values into the AxisX:All the best,
the Telerik team
What exactly are those other factors?
About bar width calculation:
The factors that determine the bars' width are complex. Starting with the space - it depends on the space reserved for the RadChart itself, then the default view takes away some of the space for drawing series to show up some of its elements like the chart legend, title, axis, labels and ticks. After the place for the plotting area is determined the actual width of the bars is calculated. Remember, that if nothing else is specified, the RadChart will try to display all series items on the screen (using sampling with default threshold of 200). The width depends of the axis range, the number of major / minor ticks and the ticks distance. After all these factors are taken into account, the bar width percent reduces the bar size by a percentage of the determined size.
About categorical chart and bars width:
When you are using categorical axis you are using text instead of numbers. So setting the MinValue, MaxValue and Step doesn't make sense when using categories. You can try using the auto range, which will split the available size evenly for your bars. If you are not happy with the auto range you can try the using a numerical values with proper grouping. This approach is demonstrated in this thread in our forum.
All the best,
the Telerik team
Here is the Code.