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

Legend items not appearing in 2011 Q2 hotfix (v. 1040)

4 Answers 52 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 10 Oct 2011, 02:33 PM
Dear Sir/Madam:

We have recently downloaded the latest Silverlight code from Telerik, v. 2011.2.1004.1040. However, none of our chart legends (that were appearing correctly when used with the previous Telerik version) appear to correctly adding items, resulting in legends with no items. Here is our XAML:

<telerik:RadChart Name="Chart" >
                            <telerik:RadChart.DefaultView>
                                <telerik:ChartDefaultView>
                                    <telerik:ChartDefaultView.ChartArea>
                                        <telerik:ChartArea>
                                            <telerik:ChartArea.ZoomScrollSettingsX>
                                                <telerik:ZoomScrollSettings x:Name="zoomScrollSettings" />
                                            </telerik:ChartArea.ZoomScrollSettingsX>
                                        </telerik:ChartArea>
                                    </telerik:ChartDefaultView.ChartArea>
                                    <telerik:ChartDefaultView.ChartLegend>
                                        <telerik:ChartLegend x:Name="pctChartLegend" Visibility="Visible" />
                                    </telerik:ChartDefaultView.ChartLegend>
                                </telerik:ChartDefaultView>
                            </telerik:RadChart.DefaultView>
                        </telerik:RadChart>

Here is our our code-behind for adding data serieses:

SeriesMapping percentageSeries = new SeriesMapping();
     StackedBar100SeriesDefinition percentageBarDefinition = new StackedBar100SeriesDefinition();
     percentageBarDefinition.Appearance.Fill = new SolidColorBrush(Color.FromArgb(255, 131, 255, 116));
     percentageBarDefinition.StackGroupName = "Stack1";
     percentageBarDefinition.ShowItemLabels = false;
     percentageBarDefinition.ShowItemToolTips = true;
     percentageBarDefinition.ItemToolTipFormat = "#STPERCENT{F2}%  #SERIESLABEL";
     percentageBarDefinition.LegendDisplayMode = LegendDisplayMode.SeriesLabel;
     percentageSeries.SeriesDefinition = percentageBarDefinition;
     percentageSeries.LegendLabel = "Success";
     
     percentageSeries.ItemMappings.Add(new ItemMapping("Success", DataPointMember.YValue));
     percentageSeries.ItemMappings.Add(new ItemMapping("Account", DataPointMember.XCategory));     
     Chart.SeriesMappings.Add(percentageSeries);

We then go on to add a number of these types of data series in similar fashion, each time assigning "LegendLabel" property to the series, followed by our databinding:

Chart.ItemsSource = results.Data;

I've tried not implementing the chart legend in the XAML and doing it strictly in the code-behind, but this made no difference: the legend items do not appear.

Thanks and all help appreciated,

Mark
Goolara, LLC

4 Answers, 1 is accepted

Sort by
0
Andrew Jackson
Top achievements
Rank 1
answered on 12 Oct 2011, 07:30 PM
We are also experiencing the same problem.

SeriesMapping mapping = new SeriesMapping();
mapping.LegendLabel = "Some Title";
 
BarSeriesDefinition bsd = new BarSeriesDefinition();
bsd.ShowItemToolTips = true;
bsd.LegendDisplayMode = LegendDisplayMode.SeriesLabel;
bsd.ItemLabelFormat = "$#Y{N0}";
mapping.SeriesDefinition = bsd;
 
ItemMapping im = new ItemMapping("FullName", DataPointMember.XCategory);
mapping.ItemMappings.Add(im);
 
im = new ItemMapping("DataValue", DataPointMember.YValue);
mapping.ItemMappings.Add(im);
 
Mappings.Add(mapping);

In the above example, the "Mappings" object is of type SeriesMappingCollection and is bound via the ViewModel to the XAML:

<telerik:RadChart x:Name="BarGraph" ItemsSource="{Binding Data}" SeriesMappings="{Binding Mappings}">
0
Nikolay
Telerik team
answered on 13 Oct 2011, 08:24 AM
Hi,

It appears that the legend items are missing because the legend hasn't been associated with the ChartArea :
<telerik:ChartArea LegendName="pctChartLegend">

Please, find attached a sample application we have created to test both scenarios from this thread ( using assemblies version 2011.2.1004 ). They seem to work as expected on our side. In case we are missing some of the details and the problem persists, it would be very helpful for us if you're able to modify it so that the issue is reproducible and send it back to us to debug locally.

Hope this helps.

Kind regards,
Nikolay
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Mark
Top achievements
Rank 1
answered on 13 Oct 2011, 05:09 PM
This is working for us.

Thanks,

Mark
0
Andrew Jackson
Top achievements
Rank 1
answered on 14 Oct 2011, 02:19 PM
I can confirm that this has also worked for us in WPF.

Thanks for your help and support.
Tags
Chart
Asked by
Mark
Top achievements
Rank 1
Answers by
Andrew Jackson
Top achievements
Rank 1
Nikolay
Telerik team
Mark
Top achievements
Rank 1
Share this question
or