如何在RadHtmlChart中定位标签

时间:2014-03-01 10:12:52

标签: asp.net telerik rad radchart

我正在使用Telerik版本2013.我想在RadChart中显示y值,例如4,6,5,12和4。我怎样才能做到这一点? 目前,我的输出如下:

Enter image description here

ASPX代码:

<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadHtmlChart
    ID="RadHtmlChart"
    runat="server"
    Legend-Appearance-Visible="true"
    Legend-Appearance-Position="Bottom"
    Width="250px"
    Height="250px">
    <PlotArea>
        <Series>
            <telerik:PieSeries>
                <LabelsAppearance>
                    <TextStyle Margin="-30" />
                </LabelsAppearance>
            </telerik:PieSeries>
        </Series>
    </PlotArea>
</telerik:RadHtmlChart>

ASPX.CS代码:

protected void Page_Load(object sender, EventArgs e)
{
    SeriesItem s1 = new SeriesItem(6);
    s1.Name = "A";

    SeriesItem s2 = new SeriesItem(5);
    s2.Name = "B";

    SeriesItem s3 = new SeriesItem(12);
    s3.Name = "C";

    SeriesItem s4 = new SeriesItem(4);
    s4.Name = "D";

    SeriesItem s5 = new SeriesItem(4);
    s5.Name = "E";

    PieSeries ps = new PieSeries();
    ps.Items.Add(s1);
    ps.Items.Add(s2);
    ps.Items.Add(s3);
    ps.Items.Add(s4);
    ps.Items.Add(s5);
    ps.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.PieLabelsPosition.Column;
    ps.TooltipsAppearance.Visible = false;

    RadHtmlChart.PlotArea.Series.Add(ps);
    RadHtmlChart.DataBind();
}

1 个答案:

答案 0 :(得分:1)

看看这里:http://www.telerik.com/help/aspnet-ajax/htmlchart-server-side-api-configure-series.html。 在[SeriesType]中的属性属性&gt; LabelsAppearance 部分 - 您需要将位置属性设置为 InsideEnd

重要提示:升级到最新版本,我认为这是一项新功能:)