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

Chart Bar Width / Chart Whitespace

3 Answers 100 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.
Drew
Top achievements
Rank 1
Drew asked on 12 Aug 2010, 09:42 PM
Is it possible to control the width of the bars drawn in a bar graph?  The bars being drawn in my application are more narrow than I would like them to be.  The result is a lot more whitespace than I would prefer.

My chart is populated by setting the ItemsSource property to an ObservableCollection<Activity>.  (Activity is just a simple object I've defined with several properties, including a string property with the name of Priority.)

My mappings are set up with the following code:

<code>
SeriesMapping seriesMapping = new SeriesMapping();
seriesMapping.SeriesDefinition = new BarSeriesDefinition();

seriesMapping.ItemMappings.Add(new ItemMapping("Priority", DataPointMember.XCategory));

ItemMapping yItem = new ItemMapping();
yItem.AggregateFunction = ChartAggregateFunction.Count;
yItem.DataPointMember = DataPointMember.YValue;
seriesMapping.ItemMappings.Add(yItem);

seriesMapping.GroupingSettings.GroupDescriptors.Add(new ChartGroupDescriptor("Priority"));

chartControl.SeriesMappings.Clear();
chartControl.SeriesMappings.Add(seriesMapping);
</code>

I have attached a screenshot of the resulting graph.  I would like the bars to be thicker and take up more of the whitespace of the graph.  If possible, I would also like the bars to be centered over the labels underneath each category.

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 18 Aug 2010, 08:02 AM
Hi Drew,

You can use the ItemWidthPercent property to control this behavior:

Chart.DefaultView.ChartArea.ItemWidthPercent = 10;

The bigger the value, the wider the bars will be.

Sincerely yours,
Yavor
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Drew
Top achievements
Rank 1
answered on 23 Aug 2010, 09:32 PM
Hi Yavor,

Unfortunately, I have experimented with the ItemWidthPercent property but I have not had success with the results.  The bars are slightly larger at 100% but they still leave the majority of the graph as whitespace (picture attached).  I can make them larger by exceeding 100% but this forces some bars to be drawn outside the bounds of the chart container, making them invisible.  Is there another way to make the bar size larger?

Thanks,
Drew
0
Yavor
Telerik team
answered on 24 Aug 2010, 07:03 AM
Hi Drew,

I double- tested the approach on my end, and it worked as expected. I suspect that there may be another setting/style which may be influencing the behavior of the bars at your end. However, based on the supplied information, it is hard to pinpoint the cause. If the issue persists, you can open a formal support ticket, and send us a small working project, demonstrating your settings, and the resulting layout, for additional review and testing.

Best wishes,
Yavor
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
Drew
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Drew
Top achievements
Rank 1
Share this question
or