I have GPS device which send me speed data each second. I want to show data on MSChart, XY scatter.
User input is FirstDate and I calculate SecondDate = First date + 24 Hours
FirstDate= 18.07.2007 15:00:00
SecondDate= 19.07.2007 14:59:59
Than I convert 24 hours = 86400 sec.
I create array:
Redim arrvalues(1 to 86399, 1 to 2)
For i = 1 to 86399
arrValues(i, 1) = i / 3600 ‘ to find hour
arrValues(i, 2) = Speed(i)
Next i
Than I want to show chart:
With MSChart1
.ChartData = arrValues
.chartType = VtChChartType2dXY
.Plot.Axis(VtChAxisIdY).AxisScale.Type = VtChScaleTypeLinear
.Plot.Axis(VtChAxisIdX).AxisScale.Type = VtChScaleTypeLinear
.Plot.Axis(VtChAxisIdX).ValueScale.Auto = False
.Plot.UniformAxis = False
.Plot.Axis(VtChAxisIdX).AxisGrid.MajorPen.Style = 0
.Plot.Axis(VtChAxisIdX).AxisGrid.MinorPen.Style = 0
.Plot.Axis(VtChAxisIdX).ValueScale.Maximum = 24 ‘hours
.Plot.Axis(VtChAxisIdX).ValueScale.Minimum = 0
.Plot.Axis(VtChAxisIdX).ValueScale.MajorDivision = 24
.Plot.Axis(VtChAxisIdX).ValueScale.MinorDivision = 0
.Plot.Axis(VtChAxisIdY).ValueScale.Auto = False
.Plot.Axis(VtChAxisIdY).AxisGrid.MajorPen.Style = 0
.Plot.Axis(VtChAxisIdY).AxisGrid.MinorPen.Style = 0
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 100
.Plot.Axis(VtChAxisIdY).ValueScale.Minimum = 0
.Plot.Axis(VtChAxisIdY).ValueScale.MajorDivision = 10
.Plot.Axis(VtChAxisIdY).ValueScale.MinorDivision = 2
End With
What is the problem?
If I start from 18.07.2007 00:00:00 everything is fine, my x-axis goes from 0-24, I watch only one day.
But, if I start from 18.07.2007 15:00:00 I want my x-axis labels to be:
15 16 17 18 19 20 21 22 23 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
So I can see data from yesterday at 15 PM to today at 15 PM, actually I watch 24 hours period in 2 days.
Can anybody help me with this?
User input is FirstDate and I calculate SecondDate = First date + 24 Hours
FirstDate= 18.07.2007 15:00:00
SecondDate= 19.07.2007 14:59:59
Than I convert 24 hours = 86400 sec.
I create array:
Redim arrvalues(1 to 86399, 1 to 2)
For i = 1 to 86399
arrValues(i, 1) = i / 3600 ‘ to find hour
arrValues(i, 2) = Speed(i)
Next i
Than I want to show chart:
With MSChart1
.ChartData = arrValues
.chartType = VtChChartType2dXY
.Plot.Axis(VtChAxisIdY).AxisScale.Type = VtChScaleTypeLinear
.Plot.Axis(VtChAxisIdX).AxisScale.Type = VtChScaleTypeLinear
.Plot.Axis(VtChAxisIdX).ValueScale.Auto = False
.Plot.UniformAxis = False
.Plot.Axis(VtChAxisIdX).AxisGrid.MajorPen.Style = 0
.Plot.Axis(VtChAxisIdX).AxisGrid.MinorPen.Style = 0
.Plot.Axis(VtChAxisIdX).ValueScale.Maximum = 24 ‘hours
.Plot.Axis(VtChAxisIdX).ValueScale.Minimum = 0
.Plot.Axis(VtChAxisIdX).ValueScale.MajorDivision = 24
.Plot.Axis(VtChAxisIdX).ValueScale.MinorDivision = 0
.Plot.Axis(VtChAxisIdY).ValueScale.Auto = False
.Plot.Axis(VtChAxisIdY).AxisGrid.MajorPen.Style = 0
.Plot.Axis(VtChAxisIdY).AxisGrid.MinorPen.Style = 0
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 100
.Plot.Axis(VtChAxisIdY).ValueScale.Minimum = 0
.Plot.Axis(VtChAxisIdY).ValueScale.MajorDivision = 10
.Plot.Axis(VtChAxisIdY).ValueScale.MinorDivision = 2
End With
What is the problem?
If I start from 18.07.2007 00:00:00 everything is fine, my x-axis goes from 0-24, I watch only one day.
But, if I start from 18.07.2007 15:00:00 I want my x-axis labels to be:
15 16 17 18 19 20 21 22 23 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
So I can see data from yesterday at 15 PM to today at 15 PM, actually I watch 24 hours period in 2 days.
Can anybody help me with this?