Doughnut Chart not displaying data in UWP

3 posts, 0 answers
  1. Naweed Akram
    Naweed Akram avatar
    8 posts
    Member since:
    Aug 2002

    Posted 28 Feb Link to this post

    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. Naweed Akram
    Naweed Akram avatar
    8 posts
    Member since:
    Aug 2002

    Posted 28 Feb in reply to Naweed Akram Link to this post

    Btw,

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

  3. DevCraft banner
  4. Naweed Akram
    Naweed Akram avatar
    8 posts
    Member since:
    Aug 2002

    Posted 28 Feb Link to this post

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

     

Back to Top