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

5 posts, 0 answers
  1. Mark
    Mark avatar
    14 posts
    Member since:
    Jun 2006

    Posted 10 Oct 2011 Link to this post

    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:ZoomScrollSettings x:Name="zoomScrollSettings" />
                                            <telerik:ChartLegend x:Name="pctChartLegend" Visibility="Visible" />

    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));     

    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,

    Goolara, LLC
  2. Andrew Jackson
    Andrew Jackson avatar
    7 posts
    Member since:
    Jun 2009

    Posted 12 Oct 2011 Link to this post

    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);
    im = new ItemMapping("DataValue", DataPointMember.YValue);

    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}">
  3. Nikolay
    Nikolay avatar
    397 posts

    Posted 13 Oct 2011 Link to this post


    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,
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  4. Mark
    Mark avatar
    14 posts
    Member since:
    Jun 2006

    Posted 13 Oct 2011 Link to this post

    This is working for us.


  5. Andrew Jackson
    Andrew Jackson avatar
    7 posts
    Member since:
    Jun 2009

    Posted 14 Oct 2011 Link to this post

    I can confirm that this has also worked for us in WPF.

    Thanks for your help and support.
Back to Top