我试图创建一个图表,该图表的X轴从一月到十二月,而Y轴用于计算值。就像,从我在一月份从查询中获得的所有数据中,我将对“好”,“好”和“优秀”的值求和,并在二月到十二月进行相同的操作。然后图表将显示,例如在一月份有3个尼斯,5个伟大和2个优秀。 2月,很快就会有5个不错的酒店,3个很棒的酒店和2个很棒的酒店。 这是我的HTML代码
<asp:Chart ID="Chart1" runat="server" Width="800" Height="350">
<series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</chartareas>
<Legends>
<asp:Legend Name="Legend1">
</asp:Legend>
</Legends>
</asp:Chart>
这是我在VB.net中的代码
For i As Integer = 1 To 12
Dim series As DataVisualization.Charting.Series = New DataVisualization.Charting.Series(MonthName(i, True))
Dim dt As DataTable = (SELECT DATA)
For Each row As DataRow In dt.Rows
//.....do Calculation
If (z <= 75) Then
nice = nice+ 1
ElseIf (z > 75 And z <= 90) Then
great = great + 1
ElseIf (z > 90) Then
excellent = excellent + 1
End If
End If
Next
series.Points.AddXY(MonthName(i, True), nice)
series.Points.AddXY(MonthName(i, True), great)
series.Points.AddXY(MonthName(i, True), excellent)
Chart1.Series.Add(series)
Next