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

ChartLegend.DisplayMemberPath has not effect

1 Answer 49 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Anton Swanevelder
Top achievements
Rank 2
Anton Swanevelder asked on 01 Jun 2011, 04:54 PM
Hi,

I am following your example code to bind data to a Chart. I am able to see the data but not any labels. Labels only display as Item 1, Item 2 etc. even though I specify a DisplayMemberPath on the ChartLegend.

<telerik:RadChart d:LayoutOverrides="Width, Height" ItemsSource="{Binding ActivitySummaryModel}" MaxHeight="610">
                    <telerik:RadChart.DefaultSeriesDefinition>
                        <telerik:PieSeriesDefinition />
                    </telerik:RadChart.DefaultSeriesDefinition>
  
                    <telerik:RadChart.DefaultView>
                        <telerik:ChartDefaultView>
                            <telerik:ChartDefaultView.ChartLegend>
                                <telerik:ChartLegend x:Name="chartLegend" DisplayMemberPath="Category" Header="Category" />
                            </telerik:ChartDefaultView.ChartLegend>
                            <telerik:ChartDefaultView.ChartArea>
                                <telerik:ChartArea LegendName="chartLegend" DisplayMemberPath="Count" >
                                    <telerik:ChartArea.Extensions>
                                        <telerik:CameraExtension />
                                    </telerik:ChartArea.Extensions>
                                </telerik:ChartArea>
                            </telerik:ChartDefaultView.ChartArea>
                        </telerik:ChartDefaultView>
                    </telerik:RadChart.DefaultView>
  
                </telerik:RadChart>

Any help will be appreciated.

Thanks,
Anton

1 Answer, 1 is accepted

Sort by
0
Accepted
Ves
Telerik team
answered on 03 Jun 2011, 07:47 AM
Hello Anton,

Indeed, there is a property DisplayMemberPath in ChartLegend as it inherits from HeaderedItemsControl. This property is not used, however. The reason for this decision is in the number of scenarios supported by RadChart e.g.  several DataSeries, where the legend should include items for each series, but not for each DataPoint.

In order to populate the legend with values from your datasource, you will need to specify a SeriesMapping and a dedicated ItemMapping. You can find these explained in details in this help topic. You can also check this online example, there is a pie chart configured to show the country name in the legend.

Best regards,
Ves
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
Anton Swanevelder
Top achievements
Rank 2
Answers by
Ves
Telerik team
Share this question
or