Bar Chart XYGroupedAxis: Inconsistent BarGroupSpacing behaviour

Posted 2 months ago by Avatar Barry smith

I have a bar chart that sometimes displays a single data set, and sometimes displays two datasets. (The program displays calculated and measured levels, and uses the bar chart to allow quick visual comparison between the two. Sometimes the measured levels are unavailable.)

I would like to achieve the following behaviour:

When only one data set is available, it is shown with a space of 10 units between the bars.

When both data sets are available, they are shown with no spaces between the bars from different data sets, but space between each group.

Intuitively, I would like this to work by setting BarGroupSpacing to 10. However, when there is only one dataset, the bar chart doesn't seem to take notice of the BarGroupSpacing and instead uses BarSpacing.

I can work around this with a style, which sets the BarSpacing to 10 when only one dataset is available. I feel it would be neater if the library always used BarGroupSpacing.

 <Style TargetType="charts:XYGroupedAxis">
  <Setter Property="BarSpacing" Value="0"/>
  <Setter Property="BarGroupSpacing" Value="10"/> 
   <DataTrigger Binding="{Binding MeasuredDataAvailable}" Value="False">
    <Setter Property="BarSpacing" Value="10"/>

Comments (1)

Posted 2 months ago by Actipro Software Support - Cleveland, OH, USA

Hi Barry,

Thanks for the feedback.  I believe the original thought behind the design is that there are only bar "groups" when you have more than one series.  That's why the BarGroupSpacing is ignored for a single series.  I'm glad you found a workaround for this.

Actipro Software Support
Information The latest build of this product (2018.1 build 0673) was released 1 month ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.