VB.NET/Access/Chart - create a bar graph based on data from access query

  • Thread starter Thread starter Chet.Horton
  • Start date Start date
C

Chet.Horton

Guest
I have never created a chart before and don't understand how to do it. I want to create a bar graph that shows the competitor name and how many wins each competitor has. Here is my query...

Access.ExecQuery("SELECT CompetitionDate.FirstName, CompetitionDate.LastName, CompetitionDate.Wins FROM CompetitionDate ORDER BY Wins")

Can someone help?

Edit...

I tried this but get the following error on "Chart2.DataSource = Access.DBDT.TableName("CompetitionDate")"

Dim ChartArea2 As ChartArea = New ChartArea()
Dim Legend2 As Legend = New Legend()
Dim Wins2 As Series = New Series()
Dim Chart2 = New Chart()
Me.Controls.Add(Chart2)

ChartArea2.Name = "ChartArea2"
Chart1.ChartAreas.Add(ChartArea2)
Legend2.Name = "Legend2"
Chart2.Legends.Add(Legend2)
Chart2.Location = New System.Drawing.Point(13, 13)
Chart2.Name = "Chart2"
Wins2.ChartArea = "ChartArea2"
Wins2.Legend = "Legend2"
Wins2.Name = "Wins"
Chart2.Series.Add(Wins2)
Chart2.Size = New System.Drawing.Size(800, 400)
Chart2.TabIndex = 0
Chart2.Text = "Total Wins"

Chart2.Series("Wins").XValueMember = "FirstName"
Chart2.Series("Wins").YValueMembers = "Wins"

Chart2.DataSource = Access.DBDT.TableName("CompetitionDate")

Continue reading...
 
Back
Top