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

Configuring Pie Chart to show multiple items in legend

1 Answer 94 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
AJ
Top achievements
Rank 2
AJ asked on 30 Aug 2011, 07:34 PM
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">
            </Appearance>
        </Legend>
        <ChartTitle TextBlock-Text="Total Sales">
            <TextBlock>
                <Appearance TextProperties-Font="Verdana, 20px, style=Bold" TextProperties-Color="#00529B">
                </Appearance>
            </TextBlock>
        </ChartTitle>
        <PlotArea>
            <Appearance Dimensions-Margins="18%, 22%, 12%, 14%">
            </Appearance>
            <XAxis DataLabelsColumn="Location">
                <Appearance>
                    <TextAppearance TextProperties-Font="Verdana, 8pt, style=Bold">
                    </TextAppearance>
                </Appearance>
            </XAxis>
        </PlotArea>
        <Series>
            <telerik:ChartSeries DataXColumn="Location" DataYColumn="TotalSales" DefaultLabelValue="#Y{C}"
                Type="Pie">
                <Appearance>
                    <LabelAppearance LabelLocation="Auto">
                    </LabelAppearance>
                    <TextAppearance TextProperties-Font="Verdana, 11pt, style=Bold" TextProperties-Color="#00529B">
                    </TextAppearance>
                </Appearance>
            </telerik:ChartSeries>
        </Series>
    </telerik:RadChart>

1 Answer, 1 is accepted

Sort by
0
Peshito
Telerik team
answered on 02 Sep 2011, 11:31 AM
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:
<Series>
    <telerik:ChartSeries Type=Pie DataYColumn="Data" DataLabelsColumn="Name">
    <Appearance LegendDisplayMode="ItemLabels" />
    </telerik:ChartSeries>
  </Series>

Hope that helps.

Regards,
Peshito
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 >>

Tags
Chart (Obsolete)
Asked by
AJ
Top achievements
Rank 2
Answers by
Peshito
Telerik team
Share this question
or