I am trying to use the pie chart on my content page but it is not rendering. My XAML is:
<telerik:RadPieChart Grid.Row="0" x:Name="chart" HandlerChanged="chart_HandlerChanged">
<telerik:RadPieChart.BindingContext>
<vm:SystemStatsViewModel />
</telerik:RadPieChart.BindingContext>
<telerik:RadPieChart.Series>
<telerik:PieSeries ShowLabels="True"
RadiusFactor="0.8"
ValueBinding="Value"
ItemsSource="{Binding LoadChartItems}" />
</telerik:RadPieChart.Series>
</telerik:RadPieChart>
The view model returns sample data just to get the chart to render:
public ObservableCollection<LoadChartItem> LoadChartItems { get => new() {
new() { Category = "Test1", Value = 52 },
new() { Category = "Test2", Value = 19 },
new() { Category = "Test3", Value = 82 },
new() { Category = "Test4", Value = 23 }
};
}
There are other controls (labels, grids) on the page that render properly using the view model so I can rule out a bug in my view model. I have tried rendering the chart with and without the:
<telerik:RadPieChart.BindingContext>
<vm:SystemStatsViewModel />
</telerik:RadPieChart.BindingContext>
since the page references the SystemStatsViewModel in the bindingcontext. The control just never appears or throws an error of any kind. Any help or insights are appreciated.
Hi Jude,
I've just tested this in a sample .NET MAUI app and the PieChart is shown without a problem. I've attached the test app for a reference, please download it and give it a try.
In addition, you can check the HandlerChanged event handler - whether something there does not cause the issue.
Let me know how it goes.