We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

PieChart not rendering

Thread ID:

Created:

Updated:

Platform:

Replies:

121517 Dec 22,2015 01:47 PM Dec 23,2015 07:39 AM WPF 1
loading
Tags: SfChart
Matt Gianino
Asked On December 22, 2015 01:47 PM

I am trying to make a simple pie chart in WPF using dummy data. My XAML is the following:

<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>

My MainWindow code is the following:

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);
    }
}

And inside OverViewModel class is the following:

public class OverviewViewModel
{
 
 
    public IList<OverViewTestClass> UserCounts { getset; }
 
    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;
    }
}


And yet when I try to run my app, all I get is a blank grid. I've tried to find a detailed walkthrough of the piechart control and how to set it up properly but even when I followed the example (as above) I get nothing. Any ideas?

Santhiya Arulsamy [Syncfusion]
Replied On December 23, 2015 07:39 AM

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;