We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,240 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Chart Control 4.0 - Plot line graph from specific columns from a DataGridView?

Hi all,

I'm developing a graphing application that plots several lines from a protein sequencer that outputs its values in .csv format.
I've read the csv into a DataGridView just fine, which is laid out like this:

Cycle | A1 | A2 | A3 (all the way up to A12, then again for each letter to H)
0 | XXXX | XXXX | XXXX
1 | XXXX | XXXX | XXXX
2 | XXXX | XXXX | XXXX
3 | XXXX | XXXX | XXXX
4 | XXXX | XXXX | XXXX
5 | XXXX | XXXX | XXXX

cycle goes down to 180

I want to plot a line graph from, say, just Cycle and A2.

Is there a way for me to specify in VB.NET for Chart Control to only plot from these two columns e.g.

Chart1.Series("Series1").Points.PlotXY(Column1, Column3) ?

Cheers guys!!

Here's the code I used to read in the csv, the file is C:\test.csv

Imports System.Data
Imports System.Data.OleDb
Imports System.Windows.Forms.DataVisualization.Charting



Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim objDataset1 As DataSet()

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load



        'Imports the csv into the datagridview

        Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\;Extended Properties=Text;"
        Dim objConn As New OleDbConnection(sConnectionString)
        objConn.Open()

        Dim objCmdSelect As New OleDbCommand("SELECT * FROM dude.csv", objConn)
        Dim objAdapter1 As New OleDbDataAdapter()
        objAdapter1.SelectCommand = objCmdSelect

        Dim objDataset1 As New DataSet()
        objAdapter1.Fill(objDataset1, "Test")
        DataGridView1.DataSource = objDataset1.Tables(0).DefaultView
        objConn.Close()

    End Sub

End Class
1
Contributor
0
Replies
1
View
nfrmn
Newbie Poster
1 post since Aug 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.1701 seconds using 2.72MB