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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
| Try
' Créer ChartArea (zone graphique)
Dim d3 As New ChartArea3DStyle
Dim ChartArea1 As New ChartArea()
' Ajouter le Chart Area à la Collection ChartAreas du Chart
Chart2.ChartAreas.Add(ChartArea1)
Chart2.ChartAreas("ChartArea1").Area3DStyle.Enable3D = True
Chart2.ChartAreas(0).AxisX.Title = "Numéros des postes"
Chart2.ChartAreas(0).AxisY.Title = "Poste de contrôle rongeur "
'Inclinaison
' défnir les couleurs
' Dim colorSet() As Color = {Color.Red, Color.Green, Color.Blue, Color.Purple}
' Chart2.PaletteCustomColors = colorSet
'Chart2.Palette = ChartColorPalette.None
'ajout de la legende
Dim legend1 As New Legend
Chart2.Legends.Add(legend1)
Chart2.Legends(0).ShadowOffset = 2
'ajouter un titre
Chart2.Titles.Add("Suivi des postes de contrôle rongeur du client N°" & frmGestionClt.DTGclient.CurrentRow.Cells.Item(0).Value & "")
' font, taille.. du titre
Chart2.Titles(0).Font = New Font("Arial", 12, FontStyle.Bold)
Chart2.Titles(0).ForeColor = Color.DarkRed
' Couleur du fond
' Couleur du bord
Chart2.Titles(0).BorderColor = Color.MediumBlue
' Position du texte dans le rectangle
Chart2.Titles(0).Alignment = System.Drawing.ContentAlignment.TopCenter
' Text du ToolTip du titre
Chart2.Titles(0).ToolTip = "Title"
' Positionner le controle Chart
Chart2.Location = New System.Drawing.Point(10, 10)
' Dimensionner le Chart
Chart2.Size = New System.Drawing.Size(900, 550)
'Pour modifier l'épaisseur des StepLine
Chart2.Series.Clear()
' Set Border Skin
Chart2.BorderSkin.SkinStyle = BorderSkinStyle.Emboss
' Set Back Color
Chart2.BorderSkin.BackColor = Color.Red
' Set Back Gradient End Color
Chart2.BorderSkin.BackSecondaryColor = Color.Blue
' Set Hatch Style
Chart2.BorderSkin.BackHatchStyle = ChartHatchStyle.DarkVertical
' Set Gradient Type
Chart2.BorderSkin.BackGradientStyle = GradientStyle.DiagonalRight
' Set Border Color
Chart2.BorderSkin.BorderColor = Color.Yellow
' Set Border Style
Chart2.BorderSkin.BorderDashStyle = ChartDashStyle.Solid
' Set Border Width
Chart2.BorderSkin.BorderWidth = 2
' 30% de perspective
Chart2.ChartAreas("ChartArea1").Area3DStyle.Perspective = 30
' Rotation d'un Angle de 30
Chart2.ChartAreas("ChartArea1").Area3DStyle.Rotation = 30
'Inclinaison
Chart2.ChartAreas("ChartArea1").Area3DStyle.Inclination = 45
' Mettre le Point Depth à 100 (profondeur de la colonne)
Chart2.ChartAreas("ChartArea1").Area3DStyle.PointDepth = 100
' Mettre le Point Gap Width à 0 (profondeur entre les series)
Chart2.ChartAreas("ChartArea1").Area3DStyle.PointGapDepth = 0
Chart2.ChartAreas("ChartArea1").Area3DStyle.IsClustered = False
'Epaisseur du mur gris
Chart2.ChartAreas(0).Area3DStyle.WallWidth = 10
'Chart2.ChartAreas(0).AxisX.MajorGrid.Interval = 1
'Chart2.ChartAreas(0).AxisX.MajorTickMark.Interval = 1
Chart2.ChartAreas(0).Area3DStyle.IsRightAngleAxes = True
Chart2.ChartAreas(0).AxisX.IsLogarithmic = False
Dim req As String
req = ""
Dim u As Integer
u = 0
Dim dateu(50) As String
Dim longdatu, i As Integer
Dim serie As Series
For i = 0 To frmparametre.CheckedListBox1.Items.Count - 1
If frmparametre.CheckedListBox1.GetItemChecked(i) Then
req = req & "date = " & """" & frmparametre.CheckedListBox1.Items.Item(i) & """" & " or "
dateu(u) = frmparametre.CheckedListBox1.Items.Item(i)
longdatu = u
serie = New Series(dateu(u).ToString)
Chart2.Series.Add(serie)
Chart2.Series(dateu(u).ToString).BorderWidth = 4
'Chart2.Series(dateu(u).ToString).IsXValueIndexed = True
' Chart2.Series(dateu(u).ToString).IsXValueIndexed = True
u = u + 1
End If
Next
req = Mid(req, 1, Len(req) - 4)
Dim MyConString As String = "DRIVER={MySQL ODBC 3.51 Driver};" + "SERVER=" & server & ";" + "DATABASE=prj;" + "UID=" & user & ";" + "PASSWORD= " & mp & ";"
Dim con As New OdbcConnection(MyConString)
Dim MyDataReader As OdbcDataReader
Dim MyCommand As New OdbcCommand()
Dim x, idclient As Integer
con.Open()
MyCommand.Connection = con
'récupérer id_client
MyCommand.CommandText = "select Id_client from client where Numero_de_client=" & "'" & frmGestionClt.client & "'"
MyDataReader = MyCommand.ExecuteReader()
x = MyDataReader.Read()
idclient = MyDataReader.GetInt32(0)
MyDataReader.Close()
Dim dt As New DataTable
'idclient
Dim d, a, j As String
Dim s As Integer
MyCommand.CommandText = " SELECT i.`Date` , p.numero_du_poste, r.`F#C`, r.`M#C`,r.`T#C` FROM intervention i, poste p, client c, caracteristique r WHERE c.id_client = p.id_client AND c.id_client = i.id_client and r.id_poste=p.id_poste and r.id_intervention=i.id_intervention and (" & req & ") AND i.id_client =""" & idclient & "order by i.Date """
MyDataReader = MyCommand.ExecuteReader()
While (MyDataReader.Read())
s = 0
If MyDataReader.GetString(2) = "VRAI" Then
s = s + 1
End If
If MyDataReader.GetString(3) = "FAUX" Then
s = s + 2
End If
If MyDataReader.GetString(4) = "VRAI" Then
s = s + 7
End If
d = MyDataReader.GetDate(0).ToString
d = Mid(d, 1, 10)
d = Replace(d, "/", "-")
a = Mid(d, 7, 4)
j = Mid(d, 1, 2)
d = Mid(d, 3, 4)
d = a & d & j
Chart2.Series(d).Points.AddXY(MyDataReader.GetInt32(1), s)
End While
MyDataReader.Close()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
' Ajouter le chart à la form
Me.Controls.Add(Chart2) |
Partager