Question

i have two queries which give two different values

One query gives the freespace

select sum(freesize) as freespace from freespace 

the next query gives totalspace

select sum(NumRegions) as totalspace from fileidtofilename 

then usedspace= totalspace- freespace

Now i want to display the usedspace region and freespace region in the piechart...

any suggestions

the piechart is:

 <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>
Was it helpful?

Solution

here is how you do it:

First i got the free space and used space using SQl query's

then i did this... hope this helps some1

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


    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top