Solved

ASP.net VB.net Generate a chart showing percentages

Posted on 2013-06-08
2
383 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
ID: 39232801
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
ID: 39245396
Thanks very much
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 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