Vertical BarSeries with Grouped Y axis

Charts for WPF Forum

The latest build of this product (v2020.1.0) was released 17 days ago, which was before this thread was created.
Posted 7 days ago by Marcus Jones - LN Systems Limited
Version: 20.1.0
Avatar

I am struggling to get a BarSeries chart to work in Vertical mode with the Y axis being from a bound string field. If I flip to horizontal it seems to work OK.

In horizontal mode this works;

<charts:XYChart VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="30,10" >
<charts:XYChart.YAxes>
<charts:XYDoubleAxis Minimum="0" Maximum="100"/>
</charts:XYChart.YAxes>
<charts:XYChart.XAxes >
<charts:XYGroupedAxis FontSize="8" />
</charts:XYChart.XAxes>
<charts:BarSeries x:Name="Data" XPath="Category" YPath="Percentage" ItemsSource="{Binding AllSafeCategories, Mode=OneWay}">
</charts:BarSeries>
</charts:XYChart>

But vertical mode does not work, no Y axis labels and no bars are shown;

<charts:XYChart VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="30,10" >
<charts:XYChart.XAxes>
<charts:XYDoubleAxis Minimum="0" Maximum="100"/>
</charts:XYChart.XAxes>
<charts:XYChart.YAxes >
<charts:XYGroupedAxis FontSize="8" />
</charts:XYChart.YAxes>
<charts:BarSeries x:Name="Data" YPath="Category" Orientation="Vertical" XPath="Percentage" ItemsSource="{Binding AllSafeCategories, Mode=OneWay}">
</charts:BarSeries>
</charts:XYChart>

The backing ViewModel has the following class, collection and initialisation data;

public class CategoryBarData
{
public string Category { get; private set; }
public double Percentage { get; private set; }

public CategoryBarData(string category, double percentage)
{
Category = category;
Percentage = percentage;
}
}

public ObservableCollection<CategoryBarData> AllSafeCategories { get; set; }

AllSafeCategories = new ObservableCollection<CategoryBarData>
{
new CategoryBarData("Category 1", 98),
new CategoryBarData("Category 2", 92),
new CategoryBarData("Category 3", 89.3),
new CategoryBarData("Category 4", 75.3),
new CategoryBarData("Category 5", 42.1)
};

Comments (1)

Answer - Posted 7 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Marcus,

Thanks for reporting this.  I believe we found the cause of the bug and have fixed it for the next maintenance release.

[Modified 7 days ago]


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.