Pie Chart NoDataMessage Issue

4 posts, 0 answers
  1. Simon Chan
    Simon Chan avatar
    13 posts
    Member since:
    Jul 2009

    Posted 23 Nov 2009 Link to this post

    I'm using RadControls for Silverlight Q3 2009 release and create a pie chart with data binding to ChartData. When the chart is shown while loaded, the NoDataMessage is shown properly if the ChartData is null. However, if the pie chart once shows when there is data in ChartData, the NoDataMessage is not shown any more even though I assign null to the ChartData.

    <telerikChart:RadChart x:Name="mainChart" ItemsSource="{Binding ChartData}" >

        <telerikChart:RadChart.SeriesMappings>
            <telerikCharting:SeriesMapping >
                <telerikCharting:SeriesMapping.SeriesDefinition>
                    <telerikCharting:PieSeriesDefinition ShowItemLabels="False">
                    </telerikCharting:PieSeriesDefinition>
                </telerikCharting:SeriesMapping.SeriesDefinition>

                <telerikCharting:SeriesMapping.ItemMappings >
                    <telerikCharting:ItemMapping FieldName="Reading" DataPointMember="YValue" />
                    <telerikCharting:ItemMapping FieldName="Description" DataPointMember="LegendLabel" />
                </telerikCharting:SeriesMapping.ItemMappings>
            </telerikCharting:SeriesMapping>
        </telerikChart:RadChart.SeriesMappings>
    ...
    </telerikChart:RadChart>


    Regards,
    Simon
  2. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 26 Nov 2009 Link to this post

    Hello Simon,

    Please, find attached a small example, based on the code you provided. It works as expected for me, tested against the latest official release of RadControls for Silverlight. Give it a try and let me know if I have missed anything.

    Best regards,
    Ves
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Simon Chan
    Simon Chan avatar
    13 posts
    Member since:
    Jul 2009

    Posted 26 Nov 2009 Link to this post

    In your example, you're not using Data Binding to clear the data. You are using code behind to set the DataContext to null.

    Please try using the data binding syntax (MVVM approach) to set ItemsSource to "{Binding ChartData}" and then set ChartData to null instead of setting the DataContext to null directly.

    Rgds,
    Simon
  4. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 01 Dec 2009 Link to this post

    Hello Simon,

    Please, find attached an updated version of the page. Note, that in this case, the class holding ChartData should implement INotifyPropertyChanged interface.

    Best regards,
    Ves
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top