1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim dst1 As New DataSet
Dim adpt1 As New SqlDataAdapter("select LCART FROM FACTURELIGNE where LDES ='" & Me.article.Text & "'", con)
adpt1.Fill(dst1, "T")
Dim code As String = dst1.Tables("T").Rows(0).Item(0)
MsgBox(code)
Dim dst2 As New DataSet
Dim adpt2 As New SqlDataAdapter("select SUM(DISTINCT LQLIV) from FACTURELIGNE where LCART ='" & code & "'and LDATOP between '2011-01-01' and'2011-12-31' AND (month (LDATOP))=1 ", con)
adpt2.Fill(dst2, "table")
'***************Créer un Chart*************************
'Il ne contient rien
Dim Chart1 As New Chart
'Créer un Chart Area
Dim chartArea1 As New ChartArea()
'*************************Ajouter le Chart Area au Chart**********************
Chart1.ChartAreas.Add(chartArea1)
'************************* création d 'une premiere series********************
Chart1.Series.Add("series1")
Chart1.Series("series1").ChartArea = chartArea1.Name
'****************************Création des points******************************
'**********************************Janvier************************************
Dim yValue As Double
Dim i As Integer
For i = 0 To dst2.Tables("table").Rows.Count - 1
If IsDBNull(dst2.Tables("table").Rows(i).Item(0)) Then
yValue = 0
Else
yValue = dst2.Tables("table").Rows(i).Item(0)
End If
Chart1.Series(0).Points.AddXY("Janvier", yValue)
Next i
' Positionner le controle Chart
Chart1.Location = New System.Drawing.Point(15, 45)
' Dimensionner le Chart
Chart1.Size = New System.Drawing.Size(700, 400)
' Ajouter le chart à la form
Me.Controls.Add(Chart1)
end sub |
Partager