how can i show multiple label on pie chart?

Thread is closed for posting
2 posts, 0 answers
  1. shunman
    shunman avatar
    77 posts
    Member since:
    Jul 2011

    Posted 27 Sep 2011 Link to this post

    Is there a way to showing extra label on Pie Chart?
    I'm looking for solution for this woe.
    I wish to make a pie chart like  attaching image.

    From the Attaching image, the outside labels indicate "MonthCount" fields from datasource
    and Inside labels indecate "Month" field

    here is my datasource and definition pie chart control on aspx. thank you.
    Dim dataTablePieData As New DataTable()
            dataTablePieData = New DataTable()
            dataTablePieData.Columns.Add("Year")
            dataTablePieData.Columns.Add("Month")
            dataTablePieData.Columns.Add("MonthCount")
     
            dataTablePieData.Rows.Add(New Object() {"2009", "1", "20"})
            dataTablePieData.Rows.Add(New Object() {"2009", "2", "20"})
            dataTablePieData.Rows.Add(New Object() {"2009", "3", "70"})
            dataTablePieData.Rows.Add(New Object() {"2009", "4", "143"})
            dataTablePieData.Rows.Add(New Object() {"2009", "5", "210"})
            dataTablePieData.Rows.Add(New Object() {"2009", "6", "250"})
            dataTablePieData.Rows.Add(New Object() {"2009", "7", "252"})
            dataTablePieData.Rows.Add(New Object() {"2009", "8", "396"})
            dataTablePieData.Rows.Add(New Object() {"2009", "9", "406"})
            dataTablePieData.Rows.Add(New Object() {"2009", "10", "470"})
            dataTablePieData.Rows.Add(New Object() {"2009", "11", "472"})
            dataTablePieData.Rows.Add(New Object() {"2009", "12", "431"})
     
            GetPieData = dataTablePieData

    <telerik:RadChart ID="RadChartPieChart" SkinsOverrideStyles="true" runat="server" Width="800" Height="500" >
        <ChartTitle>
            <TextBlock Text="Pie Chart">
            </TextBlock>
        </ChartTitle>
        <PlotArea>
            <Appearance Dimensions-Margins="0px 0px 0px 0px"></Appearance>
        </PlotArea>
        <Series>
            <telerik:ChartSeries DataYColumn="MonthCount" Type="Pie">
                <Appearance LegendDisplayMode="Nothing" ShowLabelConnectors="true" >
                    <TextAppearance TextProperties-Color="Red">
                    </TextAppearance>
                    <LabelAppearance Distance="70"></LabelAppearance>
                </Appearance>
            </telerik:ChartSeries>
        </Series>
    </telerik:RadChart>
  2. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 30 Sep 2011 Link to this post

    Hello Shunman,

    Currently you can't have more than one label for RadChart. Why don't you show both of these in one and the same Label, separated by "-" for example. For the purpose you may wire to the ItemDataBound event and set the two fields as item.Label like this:
    Telerik.Charting.ChartSeriesItem item = e.SeriesItem;
      
        Data.DataRowView dataItem = (Data.DataRowView)e.DataItem;
      
        item.Label.TextBlock.Text = dataItem("Month").ToString() + " - " + dataItem("MonthCount").ToString();


    Regards,
    Evgenia
    the Telerik team
    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 their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top