This is a migrated thread and some comments may be shown as answers.

Doughnut Chart not displaying data in UWP

2 Answers 74 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Naweed Akram
Top achievements
Rank 2
Naweed Akram asked on 28 Feb 2016, 11:41 AM

Hi,

I am facing an issue. Following the samples on "http://docs.telerik.com/windows-universal/controls/radchart/getting-started" to display data in a Doughnut chart, but all I get is a display which says no data to display. I checked and my datacontext has around 15 items. Here is the code. I am scratching my head for past 3 hours. Any idea?

                <!-- Genres Chart -->
                <telerik:RadPieChart x:Name="chtGenres" 
                                     HorizontalAlignment="Center"
                                     Margin="0,30,0,0"                                     
                                     Width="500" Height="500" 
                                     ClipToBounds="False" 
                                     PaletteName="DefaultDark"
                                     DataContext="{x:Bind ViewModel.Stats_GenresSplit, Mode=OneWay}"
                                     RelativePanel.AlignRightWithPanel="True"
                                     RelativePanel.AlignLeftWithPanel="True">
                  <telerik:DoughnutSeries ShowLabels="True">
                    <telerik:DoughnutSeries.ValueBinding>
                      <telerik:PropertyNameDataPointBinding PropertyName="GenreCount"/>
                    </telerik:DoughnutSeries.ValueBinding>
                    <telerik:PieSeries.LegendTitleBinding>
                      <telerik:PropertyNameDataPointBinding PropertyName="DisplayText"/>
                    </telerik:PieSeries.LegendTitleBinding>
                  </telerik:DoughnutSeries>
                  </telerik:RadPieChart>

                  <telerikPrimitives:RadLegendControl LegendProvider="{Binding ElementName=chtGenres}"
                                                      Margin="0,10,0,0"
                                                      HorizontalAlignment="Center"
                                                      RelativePanel.Below="chtGenres"
                                                      RelativePanel.AlignRightWithPanel="True"
                                                      RelativePanel.AlignLeftWithPanel="True">
                    <telerikPrimitives:RadLegendControl.ItemsPanel>
                      <ItemsPanelTemplate>
                        <StackPanel Orientation="Vertical"/>
                      </ItemsPanelTemplate>
                    </telerikPrimitives:RadLegendControl.ItemsPanel>
                    <telerikPrimitives:RadLegendControl.ItemTemplate>
                      <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                          <Ellipse Fill="{Binding Fill}" Stroke="{Binding Stroke}"
                                   StrokeThickness="1" Width="10" Height="10"/>
                          <TextBlock Text="{Binding Title}" Foreground="{Binding Fill}"
                                     Margin="10"/>
                        </StackPanel>
                      </DataTemplate>
                    </telerikPrimitives:RadLegendControl.ItemTemplate>
                  </telerikPrimitives:RadLegendControl>

 

And, here is my object in the view model.

    public class GenreSplit

    {
        public string GenreName { get; set; }
        public int GenreCount { get; set; }

        public string DisplayText
        {
            get
            {
                return GenreName + ": " + GenreCount.ToString() + " SHOWS";
            }
        }
    }

}

        private List<GenreSplit> _stats_GenresSplit;
        public List<GenreSplit> Stats_GenresSplit
        {
            get { return _stats_GenresSplit; }
            set
            {
                SetProperty(ref _stats_GenresSplit, value);
            }
        }

 

 

2 Answers, 1 is accepted

Sort by
0
Naweed Akram
Top achievements
Rank 2
answered on 28 Feb 2016, 02:54 PM

Btw,

If I change the DoughutSeries to PieSeries, it works. Is there some problem with DoughnutSeries?

0
Naweed Akram
Top achievements
Rank 2
answered on 28 Feb 2016, 03:31 PM

Please close. Issue resolved. In the legend definition,  was using  instead of doighnutseries.

 

Tags
Chart
Asked by
Naweed Akram
Top achievements
Rank 2
Answers by
Naweed Akram
Top achievements
Rank 2
Share this question
or