Solved

ASP.net VB.net Generate a chart showing percentages

Posted on 2013-06-08
2
385 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

733 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