hello!
I have problem to show hours in graph.
I have this registers in DataBase MySQL:
hora: temperatura:
8:34:14 +025.52
8:35:15 +026.43
8:36:16 +026.24
8:37:17 +027.50
. .
. .
. .
. .
so I'm graphing it:
https://i.stack.imgur.com/RZxQz.jpg
the XAxis is showing the hours "70000, 80000, 90000,...."
I want the Xaxis show hours like "7:00:00 8:00:00 9:00:00"
so, I have the hours stored in database.
this is the code:
Private Sub CreateGraph(ByVal zgc As ZedGraphControl)
Try
Dim query As String = "SELECT * from termocuplas WHERE id_modulo = '#03H' AND fecha = '2019-08-27' ORDER BY fecha ASC, hora ASC" 'ORDER BY fecha ASC
Dim connection As New MySqlConnection(connStr)
Dim cmd As New MySqlCommand(query, connection)
connection.Open()
reader = cmd.ExecuteReader()
Dim myPane As GraphPane = zgc.GraphPane
myPane.Title.Text = "Termocupla"
myPane.XAxis.Title.Text = "Tiempo(hh:mm:ss)"
myPane.XAxis.Scale.MagAuto = False
myPane.YAxis.Title.Text = "Temperatura °C"
myPane.YAxis.Scale.MagAuto = False
Dim list1 = New PointPairList()
Dim y As Single
Dim x As Single
If reader.Read Then
While reader.Read()
y = Convert.ToSingle(Replace(reader.GetString(3), ".", ","))
x = Convert.ToSingle(Replace(reader.GetString(11), ":", ""))
list1.Add(x, y)
End While
reader.Close()
Else
MessageBox.Show("Nothing")
End If
Dim myCurve As LineItem = myPane.AddCurve("Termocupla Vapor", list1, Color.Red, SymbolType.None)
myCurve.Line.Fill = New Fill(Color.White, Color.Red, 45.0F) ' Make the symbols opaque by filling them with white
myCurve.Symbol.Fill = New Fill(Color.White) ' Fill the axis background with a color gradient
myPane.Chart.Fill = New Fill(Color.White, Color.LightGoldenrodYellow, 45.0F) ' Fill the pane background with a color gradient
myPane.Fill = New Fill(Color.White, Color.FromArgb(220, 220, 255), 45.0F)
zgc.AxisChange()
connection.Close()
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub
What I have tried:
so, what can I do to show the hours correctly?