我编写了以下VB.NET代码,它将标准分数绘制为Windows窗体上日期和时间的函数。
Public Sub PopulateChart(ByVal PairId As Integer, ByVal SymbolA As String, ByVal SymbolB As String)
Dim DateTimes As List(Of DateTime)
Dim StandardScores As List(Of Double)
Me.Visible = True
Me.BringToFront()
Me.Text = SymbolA & " " & SymbolB
graStandardScores.Series("StandardScores").Points.Clear()
DateTimes = GetStandardScoreDates(PairId)
StandardScores = GetStandardScores(PairId)
For i = 0 To StandardScores.Count - 1
If Double.IsInfinity(StandardScores(i)) = False Then
graStandardScores.Series("StandardScores").Points.AddXY(DateTimes(i), StandardScores(i))
End If
Next i
End Sub
每个点相隔30秒,数据跨越多天。我希望每天只有一个标签显示在x轴上,但也是每天每小时的标签。实现这一目标的最佳方法是什么?