Reputation: 5529
I have now changed my x axis to DateAsOrdinal, but I would like to improve the label format. I currently handle the XAxis.ScaleFormatEvent like this:
Private Function OnXScaleFormatEvent(ByVal pane As GraphPane, ByVal axis As Axis, ByVal val As Double, ByVal index As Integer) As String
Dim result As String = ""
If val < priceBars.Count Then
Dim time As Date = Date.FromOADate(priceBars(val).X)
result = [String].Format("{0:D2}{1}{2:D2}", time.Hour, ":", time.Minute)
End If
Return result
End Function
How can I make the labels only print every whole 30 minutes? Or every 2 hours as in image below? I believe I still need to reference the bar x-values, because I need to plot multiple days continuously, with only some hours from each day, like the image shows; 09:00-23:00.
Upvotes: 2
Views: 2726
Reputation: 3301
I think, this will do:
chart.GraphPane.XAxis.Scale.MajorStepAuto = False
chart.GraphPane.XAxis.Scale.MajorUnit = DateUnit.Minute
chart.GraphPane.XAxis.Scale.MajorStep = 30
chart.GraphPane.XAxis.Scale.BaseTic = 0
Upvotes: 1