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

Pie Chart - set custom text in legend

2 Answers 195 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Amy
Top achievements
Rank 1
Amy asked on 02 Nov 2010, 01:24 PM
Hi!  I've created an aspx page which displays a pie chart.   I would like to display text values of 'Recorded', 'In Process', and 'Not Started' in the legend.  The chart is being populated in the code behind by an array which is built through stored procedures.  The text I would like to display in the legend isn't stored in the database and I need a way to manually specify those values.

Could someone provide me a code example of how to do this please?
Thank you!!

2 Answers, 1 is accepted

Sort by
0
Amy
Top achievements
Rank 1
answered on 04 Nov 2010, 04:52 PM
Just an FYI...I figured out how to set custom text in the Chart legend.  It may not be the most graceful way but it works. :-)

Essentially I followed the link below and then used parts from the example that I needed:
Pie Chart Legend

In the RadChart I added the 'BeforeLayout' subroutine and set the 'LegendDisplayMode' to be the 'ItemLabels'
<telerik:RadChart ID="rcCustom" runat="server" DefaultType="Pie" Width="710px"
AutoTextWrap="true" OnItemDataBound="rcCustom_ItemDataBound" Skin="LightGreen"
OnBeforeLayout="rcCustom_BeforeLayout">
   <Appearance Dimensions-Width="600px">
   </Appearance>
   <Series>
      <telerik:ChartSeries Name="Recording Status" Type="Pie" DataYColumn="iCount">
      <Appearance LegendDisplayMode="ItemLabels" ShowLabelConnectors="true">
      </Appearance>
      </telerik:ChartSeries>
   </Series>
</telerik:RadChart>


And in the BeforeLayout sub routine in the code behind added the following lines of code:
rcCustom.Legend.Items(0).TextBlock.Text = "Recorded"
rcCustom.Legend.Items(1).TextBlock.Text = "In Process"
rcCustom.Legend.Items(2).TextBlock.Text = "Not Recorded"


0
Evgenia
Telerik team
answered on 05 Nov 2010, 01:27 PM
Hi Amy,

We are glad that the issue you were facing is now resolved. Actually this is the most appropriate way to have custom Text in your Legend.
Please do not hesitate to contact us if you have any additional questions.

Kind regards,
Evgenia
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart (Obsolete)
Asked by
Amy
Top achievements
Rank 1
Answers by
Amy
Top achievements
Rank 1
Evgenia
Telerik team
Share this question
or