
It is possible to create real-time plot using the built-in Chart control. This will be very slow, and in general will not meet real-time requirements. You absolutely should not attempt to plot one pointĪt a time. Also, I do not know what your data looks like, so I don't know what techinques should be used to speed the process. I do not use ZedGraph, so I do not know if there are speed issues with it. Not need to plot faster than every 100 mS, at the maximum. Certainly, you should not attempt to plot data more frequently than a human can read the changes. I recommend that you plot once per second.

The fastest way to plot is to call a Delegate from the DataReceived eventĪfter you have buffered a significant amount of data. If SerialPort1.IsOpen = True Then SerialPort1.Close()Įnd Sub Private Sub btn_Esci_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Exit.ClickĪdding a thread for plotting (which still must call a Delegate to do the actual work) will only slow the process, it will not speed it. Lbl_Campioni_al_Secondo.Text = contatore_ricezioni_al_secondoĮnd Sub Private Sub btn_stop_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_stop.Click Lbl_Ampiezza_Digitale.Text = Valore_AttualeĮnd If End Sub Private Sub Timer1_Tick( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If ( Not IsNothing(ip)) Then Dim Valore_Attuale As Integer While cq.TryDequeue(Valore_Attuale) Static Flag_primo_Settaggio As Boolean Static Indice_Plot As Int16ĭim ip As IPointListEdit = Graph_( "DATA").Points Static Vettore_Deviazioni(100) As Single Static Digital_Offset As Int16 Static Flag_Deviazione_Standard As Boolean Static Conteggio As Int16 Private Sub SerialPort1_DataReceived( ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceivedĬontatore_ricezioni_al_secondo = contatore_ricezioni_al_secondo + 1 Private Sub btn_start_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_start.Click Graph_Plot.IsShowPointValues = True ' up the proper scrolling parameters = New Fill(Color.White, Color.LightGray, 45.0F) = True ' Fill the axis background with a gradient = True ' Mostro la linea Zero dell'asse Y ' Mostro i Tic dell'asse Y anche a destra M圜urve = myPane.AddCurve( "DATA", Punto_Iniziale, Color.Green, SymbolType.Circle) ' Genero una curva verde con che rappresenta i dati Dim m圜urve As LineItem = "Amplitude" 'Creo il Punto Iniziale Dim Punto_Iniziale As New PointPairList Private Sub Form1_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loadĭim myPane As GraphPane = Graph_Plot.GraphPane Public Delegate Sub Puntatore_alla_Funzione_Cross_Thread()

Private T As New Threading.Thread( AddressOf Plot_Coda_Dati) Private contatore_ricezioni_al_secondo As Byte Private cq As New ConcurrentQueue(Of Integer)()
