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

[Solved] Unable to set the width of the chart bars

4 Answers 288 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
madladuk
Top achievements
Rank 2
madladuk asked on 09 Dec 2010, 12:37 PM
Hi, I have a bar chart and this is placed in a scrollviewer as we need the ability to support smaller screen resolutions. I want to force the maximum width of each bar. I have placed a custom style for the X-Axis labels but the chart does not change the width of space the bars use. I can changed the width of the text. I have attached a screen shot and what I want to acheive is that each entry is closer together.

Thanks
P

4 Answers, 1 is accepted

Sort by
0
madladuk
Top achievements
Rank 2
answered on 09 Dec 2010, 12:40 PM
If I remove the scrollbar then the content is adjusted to a reasonable size. So i basically want to force this size however having the ability to scroll should there be more values.
0
madladuk
Top achievements
Rank 2
answered on 09 Dec 2010, 12:43 PM
As you can see if you dont use a scrollviewer then on a smaller resolution the chart is unreadable.
0
Jason Best
Top achievements
Rank 1
answered on 14 Dec 2010, 01:28 AM
If you know the number of individual bars that are going to be in the chart, you can simulate this by manually setting the width of the overall chart (or would that be height for your case, since you're using a horizontal bar chart?).  Say you want each individual bar to be 20 pixels wide. Assuming there would be about 5 pixels inbetween, I would set the width of the entire chart to be (20 * numBars) + (5 * numBars). If you're having to account for the size of the legend, tack on another +20 there.

Unfortunately, that really only helps if you know the number of bars that are going to be in the chart.  Otherwise, there doesn't seem to be any specific variable to determine the width of the bars that I could find (it seems to just be relative to the size of the chart). Hope this helps.
0
Yavor
Telerik team
answered on 14 Dec 2010, 08:33 AM
Hello madladuk,

Bars' size is always represented as percent of the available plot area size. You can fix the bar's size by fixing the RadChart's size.

Best wishes,
Yavor Ivanov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
Chart
Asked by
madladuk
Top achievements
Rank 2
Answers by
madladuk
Top achievements
Rank 2
Jason Best
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or