Dim penBrown As Brush = Brushes.Brown
Dim penBlue As Brush = Brushes.Blue
Dim penRed As Brush = Brushes.Red
Dim penPurple As Brush = Brushes.Purple
Dim penGreen As Brush = Brushes.Green
Dim penYellow As Brush = Brushes.Yellow
Dim penOrange As Brush = Brushes.Orange
Dim penLightBlue As Brush = Brushes.LightBlue
Dim penSilver As Brush = Brushes.Silver
Dim penGold As Brush = Brushes.Gold
Dim penPink As Brush = Brushes.Pink
Dim penGray As Brush = Brushes.Gray
Dim mesesArrayGraduaciones(12) As Integer
Dim colPens As New List(Of Brush)
colPens.Add(penBrown)
colPens.Add(penBlue)
colPens.Add(penRed)
colPens.Add(penPurple)
colPens.Add(penGreen)
colPens.Add(penYellow)
colPens.Add(penOrange)
colPens.Add(penLightBlue)
colPens.Add(penSilver)
colPens.Add(penGold)
colPens.Add(penPink)
colPens.Add(penGray)
For x As Integer = 0 To 11
Dim mes As Integer = x + 1
For Each unaGraduacion As Graduacion In colGraduaciones
If unaGraduacion.Mes = mes Then
mesesArrayGraduaciones(x) += unaGraduacion.CantidadAlumnos
End If
Next
Next
Dim graphic As Graphics = pbxEstadisticas.CreateGraphics()
graphic.Clear(Color.White)
Dim nextPos As Integer = 30
Dim tamanoTotalIngresos As Integer = pbxEstadisticas.Height
Dim maxSize As Integer = 0
For Each unInteger As Integer In mesesArrayGraduaciones
If (unInteger > maxSize) Then
maxSize = unInteger
End If
Next
If maxSize = 0 Then
maxSize = 1
Else
maxSize += 10
End If
For x As Integer = 0 To 11
Dim valor As Integer = mesesArrayGraduaciones(x)
Dim posY As Integer = Common.getSize(maxSize, pbxEstadisticas.Height, valor)
Dim valorFinal As Integer = pbxEstadisticas.Height - posY
'Dim posStatsY As Integer = pbxEstadisticas.Location.Y + valorFinal - 10
Dim posLabelY As Integer = (pbxEstadisticas.Height - 20) - CInt((valor * pbxEstadisticas.Height) / maxSize)
'If (posLabelY < pbxEstadisticas.Location.Y) Then
' posLabelY = 0
'End If
Dim posLabelX As Integer = nextPos
If CStr(valor).Length = 1 Then
posLabelX += 6
ElseIf CStr(valor).Length = 2 Then
posLabelX += 2
Else
posLabelX -= 4
End If
graphic.FillRectangle(colPens(x), nextPos, posY, 30, valorFinal)
graphic.DrawString(CStr(valor), New Font("Microsoft Sans Serif", 12, FontStyle.Bold), Brushes.Black, New Point(posLabelX, posLabelY))
nextPos += 40
Next
graphic.Dispose()