Hello all,
I am working in Visual Studio VB 2005 and I have a serial port collecting data.
Each time I get data, I input it in to an array Data(numofchannel)
I have dropped a Waveform Graph on a form. I want to continuously append the graph with the array.
And starting time of graph is always 00:00:00(hh:mm:ss) and interval of each sample is 10s.
My code are as follows,
------------------------------------------
Public waveformplot() As NationalInstruments.UI.WaveformPlot
Public waveformplotcollection As New NationalInstruments.UI.WaveformPlotCollection
Public plotOptions As AnalogWaveformPlotOptions
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
ReDim data(numofchannel - 1)
ReDim waveformplot(numofchannel - 1)
waveformplotcollection = WaveformGraph.Plots
plotOptions = New AnalogWaveformPlotOptions(AnalogWaveformPlotDisplayMode.Time, AnalogWaveformPlotScaleMode.Scaled, AnalogWaveformPlotTimingMode.Auto)
Dim i As Integer
For i = 0 To numofchannel - 1
waveformplot(i) = New WaveformPlot
waveformplot(i).DefaultWaveformPlotOptions = plotOptions
waveformplotcollection.Add(waveformplot(i))
Next
XAxis.AutoSpacing = True
XAxis.Mode = AxisMode.AutoScaleLoose
End Sub
--And every 10 seconds following codes run by timer
Private Sub Timer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer.Tick
.....some data array process
Dim i As Integer
For i = 0 To numofchannel - 1
waveformplot(i).PlotYAppend(tmp, interval)
Next
End Sub
--------------------------------------------------------------------------------------------------
So far, everyrhing looks good except xaxis label. I want make xaxis label as follows,
|-----------------------|---------------------------|-----------------------------|
00:00:00 XX:XX:XX XX:XX:XX XX:XX:XX
(XX:XX:XX changes every 10 seconds)
Thanks in advance.
D.J.
I want to point the TimerTick at the X axis as a time incrementer; the TimerTick intervals are not always the same.
I want to point the 8 channels at the Y axis and plot 8 separate lines in the graph.
I have experimented with .PlotYAppendMultiple where I send in my 2D array; it plots but I don't see how i can break out the time and the data to point it at the correct axis.
I have experimented with .PlotYAppend and I see how I could make it work in a very laborious fashion if I pick apart the array element by element.
Is there a better way? I can refashion my array.
Thanks.