Pie Chart Legends

10 posts, 0 answers
  1. Andy
    Andy avatar
    12 posts
    Member since:
    Oct 2011

    Posted 06 Dec 2012 Link to this post

    I understand you have made automatic legends now work 

    http://www.telerik.com/help/winforms/chartview-features-legend.html

    How do I get this to work in Silverlight

    <telerik:RadPieChartx:Name="PieChartStockValue"Palette="Metro">

                            <telerik:PieSeries  ShowLabels="True"RadiusFactor="0.7"ValueBinding="StockValue"ItemsSource="{Binding}">

                                <telerik:PieSeries.LabelDefinitions>

                                    <telerik:ChartSeriesLabelDefinitionMargin="-30,0,0,0"/>

                                </telerik:PieSeries.LabelDefinitions>

                                <telerik:PieSeries.AngleRange>

                                    <telerik:AngleRange  SweepAngle="360"/>

                                </telerik:PieSeries.AngleRange>

                            </telerik:PieSeries>

                        </telerik:RadPieChart>

  2. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 11 Dec 2012 Link to this post

    Hi Andy,

    The Legend feature is currently available only for the WinForms version of the ChartView. We are planning to add support for integrated ChartLegend control with the Q1 2013 release to the WPF/Silverlight versions. 

    Regards,
    Petar Kirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Tim
    Tim avatar
    114 posts
    Member since:
    Aug 2011

    Posted 02 Jan 2013 Link to this post

    Hi Petar,

    this is an important feature! Is there already a date for the Q1 2013 release?
    Thanks a lot and a happy new year,
    Tim.
  5. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 04 Jan 2013 Link to this post

    Hi Tim,

    The Q1 2013 version of our controls is expected to be released in mid-February.
     
    Kind regards,
    Petar Kirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Tim
    Tim avatar
    114 posts
    Member since:
    Aug 2011

    Posted 21 Feb 2013 Link to this post

    Hello! Good to hear that Q1 2013 was released! Unfortunately there are currently no release notes available! Do we now have pie chart legends?

    Thanks a lot and cheers,
    Tim.
  7. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 26 Feb 2013 Link to this post

    Hi Tim,

    Here you can find the release notes for the last release.

    Basically this how the RadLegend can be used:
    <Grid>
      <telerik:RadPieChart x:Name="chart" Palette="Windows8"
                    HoverMode="FadeOtherItems">
          <telerik:PieSeries>
              <telerik:PieSeries.LegendSettings>
                  <telerik:DataPointLegendSettings />
              </telerik:PieSeries.LegendSettings>
              <telerik:PieSeries.DataPoints>
                  <telerik:PieDataPoint Value="5" Label="Item 1"/>
                  <telerik:PieDataPoint Value="3" Label="Item 2"/>
                  <telerik:PieDataPoint Value="8" Label="Item 3"/>
                  <telerik:PieDataPoint Value="1" Label="Item 4"/>
                  <telerik:PieDataPoint Value="12" Label="Item 5"/>
              </telerik:PieSeries.DataPoints>
          </telerik:PieSeries>
      </telerik:RadPieChart>
         
      <telerik:RadLegend Items="{Binding ElementName=chart, Path=LegendItems}"
                   HorizontalAlignment="Left" VerticalAlignment="Top"
                   HoverMode="FadeOtherItems"/>     
    </Grid>

    I have attached a screenshot of the result, where you can see how the hover mode FadeOtherItems works across the two controls.
     
    All the best,
    Petar Kirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  8. Tim
    Tim avatar
    114 posts
    Member since:
    Aug 2011

    Posted 28 Feb 2013 Link to this post

    Hi Petar,

    that's good news! Thanks a lot for your update and the detailed answer!
    Cheers,
    Tim.
  9. Goran
    Goran avatar
    77 posts
    Member since:
    Feb 2011

    Posted 06 Mar 2013 Link to this post

    Hi Petar,

    it seems that synchronization is not working properly. Example:

    <telerik:RadPieChart x:Name="chart">
      <telerik:PieSeries ItemsSource="{Binding List}"
                             ShowLabels="False"
                             SliceStyleSelector="{StaticResource pieSliceStyleSelector}"
                             ValueBinding="Value">
        <telerik:PieSeries.LegendSettings>
          <telerik:DataPointLegendSettings />
        </telerik:PieSeries.LegendSettings>
      </telerik:PieSeries>
    </telerik:RadPieChart>
    <telerik:RadLegend Grid.Column="1"
                       BorderBrush="{StaticResource dialogItemBackground}"
                       BorderThickness="1"
                       Items="{Binding LegendItems, ElementName=chart}"
                       ItemTemplate="{StaticResource legendItemTemplate}" />

    and legend item template

    <DataTemplate x:Key="legendItemTemplate">
      <StackPanel Orientation="Horizontal">
        <Border Background="{Binding Presenter.DataItem.Color, Mode=OneWay, Converter={StaticResource chartItemColorToBrushConverter}}" Width="10" Height="10" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Center" />
        <TextBlock Text="{Binding Presenter.DataItem.Label, Mode=OneWay}" />
      </StackPanel>
    </DataTemplate>

    I tried to keep things simple here and clear, so the reason why I am using Color property and color to brush converter (not to involve item types). List can contain variable number of items, and with different labels. This means that na new list can be recreated, which will contain new values. PieChart has no problem displaying the new values, but Radlegend behaves strangely. Example:

    List = new ObservableCollection<ChartEntity>();
    List.Add(new ChartEntity { Label = "ItemA", Value = 10, Color = Colors.Green }),
    List.Add new ChartEntity { Label = "ItemB", Value = 6, Color = Colors.Orange });

    Both Pie and Legend show two slices, ItemA is displayed in Green color, Iteb in Orange color. All is OK. Then we update the list:

    List = new ObservableCollection<ChartEntity>();
    // or List.Clear();
    List.Add(new ChartEntity { Label = "ItemC", Value = 15, Color = Colors.Gray }),

    On Pie, there is only one item displayed (ItemC), in Gray color - correct. Legend still shows two items, named ItemC and ItemB (!). The color for ItemC is.gray.

    Why RadLegend at this point does not show  only ItemC, as Pie does, but also shows ItemB?

    Regards,
    Goran
  10. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 11 Mar 2013 Link to this post

    Hi Goran,

    I have managed to reproduce this bug. I have logged it in our Public Issue Tracker on this link. There you can vote the PITS item and follow its progress.

    Thanks for reporting. I have updated your Telerik points.
     
    Kind regards,
    Petar Kirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  11. Vlad
    Vlad avatar
    1 posts
    Member since:
    Mar 2013

    Posted 19 Mar 2013 Link to this post

    If you need a temporary workaround you can do LegendItems.Clear() on PieChart object when you need to change ItemSource PieChart's series.
Back to Top
DevCraft banner