Solved

ASP.net VB.net Generate a chart showing percentages

Posted on 2013-06-08
2
381 Views
Last Modified: 2013-06-13
Hi


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

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


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

Accepted Solution

by:
informaniac earned 500 total points
Comment Utility
DataTable dt = new DataTable();
dt.Columns.Add("subject",typeof(string));
dt.Columns.Add("percentage",typeof(decimal));

Datarow dr = dt.NewRow();
dr[0]="Science";
dr[1] = 50;
dt.Rows.Add(dr);

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

Open in new window

0
 

Author Closing Comment

by:murbro
Comment Utility
Thanks very much
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

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…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

763 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

11 Experts available now in Live!

Get 1:1 Help Now