I have actualy posted something like this before but i think i asked the wrong questions....here the scenario: i have managed to make my app draw out data from an access file based on user input. my lecuturer have ask me to make the app able to generate charts on that data based on further user input.
I realised that the data is now in the datagrid and no longer in access. There were some suggestions from this forum (thanks guys
) that the best way to go ahead with making charts is using the pivot table (note: i fully intend to use/intergrate axcel or execel features with my app) with some input from the user.
is there any way of doing this without any complications my vb.net skills are quite rudimentary at best. From where i am looking I see that what I can do is:
1. code a pivot table like module for my app. I don't think I can do this, am not good enough![]()
so that leaves me with
2. send data to excel/access from my app and create the charts once the data is in excel/access. is there any way of doing this any assistance is higly appreciated, have not been able to find a solution for this for months.
Thank you.

coding charts with data in datagrid: is there a good way?
Jim Holloway
A.F.B,
According to your description, I'm not clear about your project very well. However, I don't think using pivot tabel is a good idea for your task. Since you would like to draw out data from an access file, I will provide you a code example that use the DisplayRegionData Help function to draw the data on your screen:
Public Sub DisplayRegionData(ByVal e As PaintEventArgs, ByVal len As Integer, _
ByVal dat As Drawing2D.RegionData)
' Display the result.
Dim i As Integer
Dim x As Single = 20
Dim y As Single = 140
Dim myFont As New Font("Arial", 8)
Dim myBrush As New SolidBrush(Color.Black)
e.Graphics.DrawString("myRegionData = ", myFont, myBrush, _
New PointF(x, y))
y = 160
For i = 0 To len - 1
If x > 300 Then
y += 20
x = 20
End If
e.Graphics.DrawString(dat.Data(i).ToString(), myFont, _
myBrush, New PointF(x, y))
x += 30
Next i
End Sub
There is also an article titled Data Access Layer(DAL) with SqlWrapper library in the code project and hope that can help you :-)
http://www.codeproject.com/cs/database/SqlWrapper.asp
Paresh Rathod
mr. yu,
Thanks for the feedback, I am trying to find the best way of creating charts from data which is displayed on a datagrid. Your suggesstion is interesting, is there anymore reference you could lead me to see how the displaydataregion works
thank you.
ray_newbie_SSIS
A.F.B,
The following example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. The code performs the following actions:
Creates a rectangle and draw its to the screen in black.
Creates a region using the rectangle.
Gets the RegionData.
Draws the region data (an array of bytes) to the screen, by using the DisplayRegionData helper function.
Public Sub GetRegionDataExample(ByVal e As PaintEventArgs)
' Create the first rectangle and draw it to the screen in black.
Dim regionRect As New Rectangle(20, 20, 100, 100)
e.Graphics.DrawRectangle(Pens.Black, regionRect)
' Create a region using the first rectangle.
Dim myRegion As New [Region](regionRect)
' Get the RegionData for this region.
Dim myRegionData As RegionData = myRegion.GetRegionData()
Dim myRegionDataLength As Integer = myRegionData.Data.Length
DisplayRegionData(e, myRegionDataLength, myRegionData)
End Sub
' Helper Function for GetRegionData.
Public Sub DisplayRegionData(ByVal e As PaintEventArgs, ByVal len As Integer, _
ByVal dat As RegionData)
' Display the result.
Dim i As Integer
Dim x As Single = 20
Dim y As Single = 140
Dim myFont As New Font("Arial", 8)
Dim myBrush As New SolidBrush(Color.Black)
e.Graphics.DrawString("myRegionData = ", myFont, myBrush, _
New PointF(x, y))
y = 160
For i = 0 To len - 1
If x > 300 Then
y += 20
x = 20
End If
e.Graphics.DrawString(dat.Data(i).ToString(), myFont, _
myBrush, New PointF(x, y))
x += 30
Next i
End Sub