<Grid> <syncfusion:TabControlExt x:Name="tabControlExt" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CloseButtonType="Hide" IsNewButtonEnabled="False" Grid.ColumnSpan="2"> <syncfusion:TabItemExt Name="overviewTab" Header="Overview"> <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <syncfusion:SfChart Grid.Column="0" Grid.ColumnSpan="2" Header="Chart Header" HorizontalAlignment="Center" Margin="10" VerticalAlignment="Center"> <syncfusion:SfChart.PrimaryAxis> <syncfusion:CategoryAxis/> </syncfusion:SfChart.PrimaryAxis> <syncfusion:SfChart.SecondaryAxis> <syncfusion:NumericalAxis/> </syncfusion:SfChart.SecondaryAxis> <syncfusion:PieSeries Palette="Metro" Width="200" Height="200" ConnectorType="Bezier" PieCoefficient=".2" EnableSmartLabels="True" LabelPosition="OutsideExtended" x:Name="ClusterUserPieSeries" ShowTooltip="True" syncfusion:ChartTooltip.EnableAnimation="True" ItemsSource="{Binding Path=UserCounts}" YBindingPath="count" XBindingPath="name" Interior="Aqua"> </syncfusion:PieSeries> </syncfusion:SfChart> </Grid> </syncfusion:TabItemExt> <syncfusion:TabItemExt Name="clustersTab" Header="Clusters"></syncfusion:TabItemExt> <syncfusion:TabItemExt Name="vmTab" Header="VMs"></syncfusion:TabItemExt> </syncfusion:TabControlExt> </Grid>
public partial class MainWindow : Window { public OverviewViewModel OverviewModel; public MainWindow() { InitializeComponent(); init(); } private void init() { if(OverviewModel == null) OverviewModel = new OverviewViewModel(); this.DataContext = OverviewModel; Debug.WriteLine(OverviewModel.UserCounts.Count); } }
public class OverviewViewModel { public IList<OverViewTestClass> UserCounts { get; set; } public OverviewViewModel() { UserCounts = new List<OverViewTestClass>(); UserCounts.Add(new OverViewTestClass(1000, "CLUSTER1")); UserCounts.Add(new OverViewTestClass(2000, "CLUSTER2")); } } public class OverViewTestClass { public int count; public string name; public OverViewTestClass(int count, string name) { this.count = count; this.name = name; } }
Hi Matt,
Thanks for contacting Syncfusion support.
We can't refer the path value as variables for XBindingPath and YBindingPath properties in ChartSeries, instead of variables need to refer any defined property. We have modified the sample for your reference.Please find the sample from the following location.
Sample:PieSeries
Please refer the below UG documentation link to make customize the chart look.
http://help.syncfusion.com/wpf/sfchart/styling-and-customization
Thanks,
Santhiya A