Saturday, January 16, 2010

How to fill data in MS Office chart control 10 in VB .NET?

I have created a chart in VB .NET using MS Chart control 10. I can fill information manually, that no problem and the chart works wonderful. The problem now comes when I want to fill data through a code. How do I do that? Your help guys will be highly appreciated.How to fill data in MS Office chart control 10 in VB .NET?
You going to have to set a reference to MS Chart Control 10 and the drag the control onto the form and rename the control to chart1:








Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load





Dim arrData(3, 3) As Object





arrData(1, 1) = ';Jan'; ' Set the labels in the first series.





arrData(2, 1) = ';Feb';





arrData(3, 1) = ';Mar';





arrData(1, 2) = 8





arrData(2, 2) = 4





arrData(3, 2) = 0.3





arrData(1, 3) = 0.2





arrData(2, 3) = 3





arrData(3, 3) = 6.3





Chart1.ChartData = arrData





End Sub

No comments:

Post a Comment