MSChart控件,饼图Pie,在饼图中间显示百分百的问题?求大神
我想要在饼图中间显示百分百,饼图下面显示图例。 但我写的代码怎么都在中间显示不了百分百,求大神给我改一下。页面代码
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="3DPie.aspx.cs" Inherits="TopenEDM.Web.admin.DataStatistics._3DPie" %>:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Chart ID="Chart1" runat="server" Palette="BrightPastel" BackColor="WhiteSmoke"
Height="296px" Width="412px" BorderlineDashStyle="Solid" BackSecondaryColor="White"
BackGradientStyle="TopBottom" BorderWidth="2" BorderColor="26, 59, 105" ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)">
<Titles>
<asp:Title ShadowColor="32, 0, 0, 0" Font="Trebuchet MS, 14.25pt, style=Bold" ShadowOffset="3"
Text="Pie Chart" Name="Title1" ForeColor="26, 59, 105" >
</asp:Title>
</Titles>
<Legends>
<asp:Legend BackColor="Transparent" Alignment="Center" Docking="Bottom" Font="Trebuchet MS, 8.25pt, style=Bold"
IsTextAutoFit="False" Name="Default" LegendStyle="Row">
</asp:Legend>
</Legends>
<BorderSkin SkinStyle="Emboss" />
<Series>
<asp:Series Name="Default" ChartType="Pie" BorderColor="180, 26, 59, 105" Color="220, 65, 140, 240" YValueType="String">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BackSecondaryColor="Transparent"
BackColor="Transparent" ShadowColor="Transparent" BorderWidth="0">
<Area3DStyle Rotation="0" />
<AxisY LineColor="64, 64, 64, 64">
<LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</AxisY>
<AxisX LineColor="64, 64, 64, 64">
<LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</AxisX>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
</div>
</form>
</body>
</html>
后台 Code:
protected void Page_Load(object sender, EventArgs e)
{
double[] yValues = { 65.62, 75.54, 60.45, 55.73, 70.42 };
string[] xValues = { "France", "Canada", "UK", "USA", "Italy" };
Chart1.Series["Default"].Points.DataBindXY(xValues, yValues);
Chart1.Series["Default"].ChartType = SeriesChartType.Pie;
Chart1.Series["Default"]["PieLabelStyle"] = "Disabled";
Chart1.Series["Default"].ChartType = (SeriesChartType)Enum.Parse(typeof(SeriesChartType),"Pie",true);
Chart1.Titles[0].Text = "Pie Chart";
Chart1.Series["Default"]["PieLabelStyle"] = "Inside";
Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;
this.Chart1.Legends[0].Enabled = true;
}
各位大神给修改下,我的需求是在饼图中间显示百分百,而不是文字,饼图下面还是显示文字图例
--------------------编程问答-------------------- 我擦,都发布了这么久了还没人来回答。是分数太少了呢?还是大神们0对这个问题不屑一顾!!!!!!!!! --------------------编程问答-------------------- 加一段下面的代码
foreach (DataPoint point in Chart1.Series["Default"].Points)
{
point.LegendText =point.AxisLabel;
}
补充:.NET技术 , ASP.NET