Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/simpleline realtime
Required plugins for this example: MBS ChartDirector Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /ChartDirector/simpleline realtime
This example is the version from Mon, 5th May 2019.
Project "simpleline realtime.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class PicWindow Inherits Window
Control out Inherits Canvas
ControlInstance out Inherits Canvas
EventHandler Sub Open() // fix some properties if set wrong in IDE me.DoubleBuffer = false me.EraseBackground = false #if RBVersion >= 2013.0 then me.Transparent = False #endif End EventHandler
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect) draw g End EventHandler
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action() current = current + rnd - 0.5 counter = counter + 1 // autoscale looks bad, so we use this: if current>MaxValue then MaxValue = current if current<MinValue then MinValue = current // update our list labels.Remove 0 datas.Remove 0 labels.Append str(Counter) datas.Append current // and draw new redraw End EventHandler
End Control
EventHandler Sub Open() for i as integer = 1 to 500 datas.Append CDBaseChartMBS.kNoValue labels.append "" next End EventHandler
Sub draw(g as Graphics) // Create a XYChart object of size 250 x 250 pixels dim c as new CDXYChartMBS(out.Width, out.Height) // Set the plotarea at (30, 20) and of size 200 x 200 pixels call c.setPlotArea(30, 20, out.Width-50, out.Height-50) // Add a line chart layer using the given data call c.addLineLayer(datas) // Set the labels on the x axis. call c.xAxis.setLabels(labels) // scaling of y axis c.yAxis.setLinearScale MinValue-0.5, MaxValue+0.5 // Display 1 out of 3 labels on the x-axis. c.xAxis.setLabelStep(50) // Output the chart g.DrawPicture c.makeChartPicture, 0, 0 End Sub
Sub redraw() Refresh End Sub
Property Current As Double
Property Datas() As Double
Property Labels() As string
Property MaxValue As Double
Property MinValue As Double
Property counter As Integer
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS ChartDirector Plugin.

The biggest plugin in space...

MBS Xojo blog

Start Chat