Solved

ASP.net VB.net Generate a chart showing percentages

Posted on 2013-06-08
2
386 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:Murray Brown
[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:Murray Brown
ID: 39245396
Thanks very much
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

695 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