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.
<charts:XYGroupedAxis.Style>
<Style TargetType="charts:XYGroupedAxis">
<Setter Property="BarSpacing" Value="0"/>
<Setter Property="BarGroupSpacing" Value="10"/>
<Style.Triggers>
<DataTrigger Binding="{Binding MeasuredDataAvailable}" Value="False">
<Setter Property="BarSpacing" Value="10"/>
</DataTrigger>
</Style.Triggers>
</Style>
</charts:XYGroupedAxis.Style>