0

我有两个查询给出两个不同的值

一个查询给出了可用空间

select sum(freesize) as freespace from freespace 

下一个查询给出了总空间

select sum(NumRegions) as totalspace from fileidtofilename 

然后usedspace=totalspace-freespace

现在我想在饼图中显示 usedspace 区域和 freespace 区域...

有什么建议么

饼图是:

 <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>
4

1 回答 1

0

这是你的做法:

首先,我使用 SQl 查询获得了可用空间和已用空间

然后我做了这个......希望这对一些人有帮助1

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";


    }
于 2009-12-28T22:06:13.947 回答