How to manage width of chart bars?

3 posts, 2 answers
    M STOLYAR avatar
    12 posts
    Member since:
    Dec 2010

    Posted 21 Jul 2011 Link to this post

    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.

  2. Answer
    Rahul avatar
    118 posts
    Member since:
    Feb 2011

    Posted 24 Jul 2011 Link to this post

    Only one line of code is there.

    radChart1.DefaultView.ChartArea.ItemWidthPercent = 40;
  3. Answer
    Nikolay avatar
    397 posts

    Posted 26 Jul 2011 Link to this post


    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.

    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!

Back to Top