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

Pie Chart Legend won't show correctly

2 Answers 100 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Edmund Jung
Top achievements
Rank 1
Edmund Jung asked on 15 Sep 2008, 12:21 AM

Hello,

I have a pie chart (1 series) that won't show the legend correctly.  This was working fine before I installed the ASP.NET AJAX RadControls.

DataSource is bound to a recordset that comes back in two rows like this:
Status        Number
------        ---------
Complete        1234
Incomplete        345

The pie chart itself is fine, but the legend just shows "Number".  I've tried adding legends manually, but it won't correspond to the Series Item.  I've tried the LegendDisplayMode="ItemLabels" & the IntelligentLabelsEnabled=true & false.

Please help.  Thank you.

Here's the markup.

<telerik:RadChart ID="chartStatus" runat="server" DefaultType="Pie" Skin="Web20" Height="250px" Width="640px">

<PlotArea>

<XAxis>

<Appearance Color="149, 184, 206" MajorTick-Color="149, 184, 206">

<MajorGridLines Color="209, 221, 238" Width="0" />

</Appearance>

</XAxis>

<YAxis>

<Appearance Color="149, 184, 206" MajorTick-Color="149, 184, 206" MinorTick-Color="149, 184, 206">

<MajorGridLines Color="209, 221, 238" />

<MinorGridLines Color="209, 221, 238" />

</Appearance>

</YAxis>

<Appearance>

<FillStyle FillType="Solid" MainColor="249, 250, 251">

</FillStyle>

<Border Color="149, 184, 206" />

</Appearance>

</PlotArea>

<Appearance>

<Border Color="103, 136, 190" />

</Appearance>

<ChartTitle>

<Appearance>

<FillStyle MainColor="">

</FillStyle>

</Appearance>

<TextBlock>

<Appearance TextProperties-Color="0, 0, 79">

</Appearance>

</TextBlock>

</ChartTitle>

<Legend>

<Appearance Dimensions-Margins="17.6%, 3%, 1px, 1px" Dimensions-Paddings="2px, 8px, 6px, 3px"

Position-AlignedPosition="TopRight">

<Border Color="165, 190, 223" />

</Appearance>

</Legend>

<Series>

<telerik:ChartSeries Name="SurveyCount" Type="Pie">

<Appearance LegendDisplayMode="ItemLabels">

<FillStyle FillType="ComplexGradient">

<FillSettings>

<ComplexGradient>

<telerik:GradientElement Color="213, 247, 255" />

<telerik:GradientElement Color="193, 239, 252" Position="0.5" />

<telerik:GradientElement Color="157, 217, 238" Position="1" />

</ComplexGradient>

</FillSettings>

</FillStyle>

<TextAppearance TextProperties-Color="103, 136, 190">

</TextAppearance>

</Appearance>

</telerik:ChartSeries>

</Series>

</telerik:RadChart>

2 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 17 Sep 2008, 01:27 PM
Hello Edmund,

Indeed, setting LegendDisplayMode might not help in this case. Here is the catch: when DataYColumn property is set the chart will use the existing series. However, when it is not set RadChart will clear the existing series and it will create a new one. That new series will not have LegendDisplayMode set. You can do either of the following:
  • Set DataYColumn of the series to "Number"
  • Retrieve the series after RadChart has been databound (this can be in DataBound event handler) and set LegendDisplayMode to ItemLabels
Hope this helps.

Regards,
Ves
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Edmund Jung
Top achievements
Rank 1
answered on 19 Sep 2008, 08:02 AM
Thank you.  Since you answered my question in a support ticket, I thought I'd point everyone where you pointed me.  The sample worked great.

http://www.telerik.com/community/forums/thread/b311D-bgattd.aspx#633150

Tags
Chart (Obsolete)
Asked by
Edmund Jung
Top achievements
Rank 1
Answers by
Ves
Telerik team
Edmund Jung
Top achievements
Rank 1
Share this question
or