我每个月都在尝试更改图表的标签正确的顺序必须是最新的月份(Ago,Sep,Oct,Nov,Dic,Jan)但是当指令时
For Each mes As String In meses
Chart1.Series(0).Points(n).AxisLabel = meses(n)
n += 1
到达订单更改为图像中的一个显示
到目前为止,这是我的代码。
Dim meses(6) As String ' = {"Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"}
Dim Hoy As Date = DateTime.Now()
Dim ScopeHoy As Date = Hoy.AddMonths(-6)
Dim n As Integer = 0
While (ScopeHoy <= Hoy)
meses(n) = MonthName(ScopeHoy.Month, True)
ScopeHoy = ScopeHoy.AddMonths(1)
n += 1
End While
n = 0
For Each mes As String In meses
Chart1.Series(0).Points(n).AxisLabel = meses(n)
n += 1
Next
'Asignar un valor de X a cada Mes
n = 0
While n < 6
Chart1.Series(0).Points(n).XValue = n + 1
n += 1
End While
'Sacar contadores para Llenar Chart
Dim cM(11) As Integer
For Each Renglon As DataGridViewRow In ListaDataGridHOLDS.Rows
'If (Renglon.Cells("FInicial").Value > ) Then
Select Case CDate(Renglon.Cells("FInicial").Value).Month
Case 1
cM(0) = cM(0) + 1
Case 2
cM(1) = cM(1) + 1
Case 3
cM(2) = cM(2) + 1
Case 4
cM(3) = cM(3) + 1
Case 5
cM(4) = cM(4) + 1
Case 6
cM(5) = cM(5) + 1
End Select
Next
'Valores para pruebas
'cM(0) = Int((Rnd() * 20) + 1)
'cM(1) = Int((Rnd() * 5) + 1)
'cM(2) = Int((Rnd() * 5) + 1)
'cM(3) = Int((Rnd() * 20) + 1)
'cM(4) = Int((Rnd() * 20) + 1)
'cM(5) = Int((Rnd() * 5) + 1)
'cM(6) = Int((Rnd() * 5) + 1)
'cM(7) = Int((Rnd() * 5) + 1)
'cM(8) = Int((Rnd() * 5) + 1)
'cM(9) = Int((Rnd() * 5) + 1)
'cM(10) = Int((Rnd() * 5) + 1)
'cM(11) = Int((Rnd() * 5) + 1)
'Asignar la cantidad de días a Y
n = 0
While n < 6
Chart1.Series(0).Points(n).YValues(0) = cM(n)
n += 1
End While