Solved Generate a chart showing percentages

Posted on 2013-06-08
Last Modified: 2013-06-13

I have a web app that calculates percentage scores for 4 subject areas.
eg 20, 40, 10, 30

What code would I use to show these scores in the chart,
whose markup is shown below. Thanks

    <asp:Chart ID="Chart5" runat="server" Height="336px" Width="348px">
            <asp:Title Text="">
            <asp:Series BorderWidth="5" ChartArea="MainChartArea" ChartType="Pie"
                Color="#000024" Name="MyCategories" YValuesPerPoint="6">
            <asp:ChartArea Name="MainChartArea">
Question by:murbro
LVL 20

Accepted Solution

informaniac earned 500 total points
ID: 39232801
DataTable dt = new DataTable();

Datarow dr = dt.NewRow();
dr[1] = 50;

Chart5.DataSource = dt;
    Chart5.Series["MyCategories"].XValueMember = "subject";
    Chart5.Series["MyCategories"].YValueMembers = "percentage";

Open in new window


Author Closing Comment

ID: 39245396
Thanks very much

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now