Vertical BarSeries with Grouped Y axis

Charts for WPF Forum

Posted 4 years 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 4 years 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 4 years ago]


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.