Configuring Pie Chart to show multiple items in legend

Thread is closed for posting
2 posts, 0 answers
  1. AJ
    AJ avatar
    33 posts
    Member since:
    Jun 2011

    Posted 30 Aug 2011 Link to this post

    Alright, I'm trying to create a pie chart that shows Locations in the Legend so that each location as a designated color, and the values assigned to each location is TotalSales. I thought it would be an easy thing to implement, but I'm running into issues.

    When I implement the code below, it shows the TotalSales all around the pie chart (I know that's because of LabelLocation="Auto") but the legend on the right would just say "Series xx". I know how to get the name to change, but I don't know how to get it to create a new item for each location.

    Can someone help me out with this?

    Here's my code:

    <telerik:RadChart ID="radSales" AutoLayout="true" runat="Server" Width="900px" Skin="Web20"
            Style="margin: 0px auto;">
            <Legend Visible="true">
                <Appearance GroupNameFormat="#VALUE">
            <ChartTitle TextBlock-Text="Total Sales">
                    <Appearance TextProperties-Font="Verdana, 20px, style=Bold" TextProperties-Color="#00529B">
                <Appearance Dimensions-Margins="18%, 22%, 12%, 14%">
                <XAxis DataLabelsColumn="Location">
                        <TextAppearance TextProperties-Font="Verdana, 8pt, style=Bold">
                <telerik:ChartSeries DataXColumn="Location" DataYColumn="TotalSales" DefaultLabelValue="#Y{C}"
                        <LabelAppearance LabelLocation="Auto">
                        <TextAppearance TextProperties-Font="Verdana, 11pt, style=Bold" TextProperties-Color="#00529B">

  2. Peshito
    Peshito avatar
    590 posts

    Posted 02 Sep 2011 Link to this post

    Hi Brian,

    Try setting the LegendDisplayMode to ItemLabels. This will create new legend items with accordance to the color of each pie slice.

    For example:
        <telerik:ChartSeries Type=Pie DataYColumn="Data" DataLabelsColumn="Name">
        <Appearance LegendDisplayMode="ItemLabels" />

    Hope that helps.

    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Back to Top