right, i've got a good little real time graph which is just being updated by a timer event putting a sine wave onto the graph. i've set up a boolean to control when I start to scroll back in time, which stops updating the graph, but still updates the list, so when i double click the graph, it starts back up again. the only niggle i have with this is that when i scroll back in time, i can't scroll forwards because the scroll bar grows and doesn't let me.

here's my code, but thanks for the tips, as you can see, i can't seem to get the graph going without using the 'creategraph' sub. i tried doing it on form load, and then only using the refresh and axischange, but to no avail.?

even if this as far as i can go i still really like Zedgraph!

vb Code:
  1. Imports ZedGraph
  2. Public Class Form1
  3.     Private inhibit_scroll As Boolean = False
  4.     Private x As Double = 0.0, y As Double = 0.0
  5.     Private alist = New PointPairList()
  6.     Private zgc = New ZedGraphControl
  7.     Dim maxX As Double = 9.0, maxY As Double = 8000.0, minX As Double = 0.0, minY As Double = 0.0
  8.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  9.         ' CreateGraph(zgc)
  10.     End Sub
  11.     Private Sub CreateGraph(ByVal zgc As ZedGraphControl)
  12.         Dim myPane As GraphPane = zgc.GraphPane
  13.         myPane.XAxis.Scale.Max = maxX
  14.         myPane.XAxis.Scale.Min = minX
  15.         myPane.YAxis.Scale.Max = maxY
  16.         myPane.YAxis.Scale.Min = minY
  17.         ' Set the titles and axis labels
  18.         myPane.Title.Text = "Flow Meter A"
  19.         myPane.XAxis.Title.Text = "Time"
  20.         myPane.YAxis.Title.Text = "Kg/Hr"
  21.         myPane.CurveList.Clear()
  22.         ' Generate a blue curve
  23.         Dim myCurve As LineItem = myPane.AddCurve("Flow Meter A", alist, Color.Red, SymbolType.None)
  24.         myPane.Chart.Fill = New Fill(Color.Black, Color.Gray)
  25.         ' Calculate the Axis Scale Ranges
  26.         zgc.AxisChange()
  27.         'zgc.Invalidate()
  28.         zg1.Refresh()
  29.     End Sub
  30.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  31.         Label1.Text = x
  32.         Label2.Text = maxX
  33.         x = x + 0.1
  34.         y = (3800 * Math.Sin(0.5 * x)) + 4000
  35.         alist.add(x, y)
  36.         ' zgc = New ZedGraphControl
  37.         If Not inhibit_scroll Then
  38.             CreateGraph(zg1)
  39.         End If
  40.         ' if the graph has reached the end of the trace, then start to advance the axis.
  41.         If x > maxX Then
  42.             minX = minX + 0.1
  43.             maxX = maxX + 0.1
  44.         End If
  45.     End Sub
  46.     Private Sub zg1_ScrollProgressEvent(ByVal sender As ZedGraph.ZedGraphControl, ByVal scrollBar As System.Windows.Forms.ScrollBar, ByVal oldState As ZedGraph.ZoomState, ByVal newState As ZedGraph.ZoomState) Handles zg1.ScrollProgressEvent
  47.         inhibit_scroll = True
  48.     End Sub
  49.     Private Sub zg1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles zg1.DoubleClick
  50.         inhibit_scroll = False
  51.     End Sub
  52. End Class