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

How to add extra value (customized ) to a pie chart ??

1 Answer 15 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
PuriTelerik
Top achievements
Rank 1
PuriTelerik asked on 04 Sep 2013, 08:58 PM
HI, Am using a pie chart where I have to show a value on chart. I am able to show the value "Value1" but not value2. How can I achieve to show both these values?

<Series>
                                            <telerik:ChartSeries Name="Series0" Type="Pie" DataYColumn="value1" DataYColumn2="value2" >
                                                <appearance legenddisplaymode="lables">
                                                    <FillStyle FillType="Solid" ">
                                                    </FillStyle>
                                                    <TextAppearance TextProperties-Color="Black">
                                                    </TextAppearance>
                                                    <Border Color="" />
                                            </appearance>
                                            </telerik:ChartSeries>
                                        </Series>

In code behind: am trying 
radchart1.Series[0].DefaultLabelValue = "#Y, #Y2";


Please help me on this.

1 Answer, 1 is accepted

Sort by
0
Petar Kirov
Telerik team
answered on 09 Sep 2013, 04:15 PM
Hi Santele,

Using the DefaultLabelValue property you can not show value2 because the DataYColumn2 binding is not evaluated for Pie series.

Instead you can use the ItemDataBound event to set the format of each item label, like this:
this.radChart1.ItemDataBound += radChart1_ItemDataBound;
 
this.radChart1.DataBind();
 
void radChart1_ItemDataBound(object sender, ChartItemDataBoundEventArgs e)
{
    var dataItem = (DataRowView)e.DataItem;
    e.SeriesItem.Label.TextBlock.Text =
    string.Format("{0}, {1}",
        dataItem["value1"],
        dataItem["value2"]);
}

I hope this helps.

Regards,
Petar Kirov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Chart (Obsolete)
Asked by
PuriTelerik
Top achievements
Rank 1
Answers by
Petar Kirov
Telerik team
Share this question
or