Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/simpleline day


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 day

This example is the version from Wed, 19th Mar 2019.

Project "simpleline day.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) if pic <> nil then g.DrawPicture pic, 0, 0 end if End EventHandler
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action() current = current + rnd - 0.5 // autoscale looks bad, so we use this: if current>MaxValue then MaxValue = current if current<MinValue then MinValue = current // update our list datas(time) = current time = time + 1 if time>UBound(datas) then time = 0 end if datas(time) = CDBaseChartMBS.kNoValue // and draw new redraw End EventHandler
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
EventHandler Sub Open() // init array with no data for i as integer = 0 to 86400-1 step 60 // one minute datas.Append CDBaseChartMBS.kNoValue times.Append i next MinValue = -10 MaxValue = 10 // random start position time = rnd * UBound(datas) End EventHandler
Sub redraw() // 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 dim l as CDLineLayerMBS = c.addLineLayer(datas) l.setXData(times) c.xAxis.setLabelFormat "{value|hh:nn:ss}" c.xAxis.setDateScale 0, 86400-1 // scaling of y axis c.yAxis.setLinearScale MinValue-0.5, MaxValue+0.5 // Output the chart pic = c.makeChartPicture out.invalidate End Sub
Property Current As Double
Property Datas() As Double
Property MaxValue As Double
Property MinValue As Double
Property Time As Double
Property pic As Picture
Property times() As Double
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:

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


The biggest plugin in space...