我有两个查询,它们提供两个不同的值
一个查询提供了自由空间
select sum(freesize) as freespace from freespace
下一个查询给出总空间
select sum(NumRegions) as totalspace from fileidtofilename
然后usedspace = totalspace-freespace
现在我想在饼图中显示usedspace区域和自由空间区域......
任何建议
饼图是:
<asp:Chart ID="Chart4" runat="server" >
<Series>
<asp:Series ChartType="Pie" Name="Series1">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
答案 0 :(得分:0)
这是你如何做到的:
首先,我使用SQl查询
获得了可用空间并使用了空间然后我做了这个...希望这有助于某些人
protected void Page_Load(object sender, EventArgs e)
{
GetFreeSpace();
GetTotalData();
usedSpace = totalSpace - freeSpace;
// Display 3D Pie Chart
Chart1.Series[0].ChartType = SeriesChartType.Pie;
Chart1.Series[0]["PieLabelStyle"] = "Inside";
Chart1.ChartAreas[0].Area3DStyle.Enable3D = true;
// Display a Title
Chart1.Titles.Add("Show Space");
// Add Data to Display
string[] xValues = { "Used Space","Free Space" };
double[] yValues = { usedSpace,freeSpace};
Chart1.Series[0].Points.DataBindXY(xValues, yValues);
// Call Out The Letter "Free Space"
Chart1.Series[0].Points[1]["Exploded"] = "true";
// Display a Legend
Chart1.Legends.Add(new Legend("Alphabet"));
Chart1.Legends["Alphabet"].Title = "Letters";
Chart1.Series[0].Legend = "Alphabet";
}