Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/simpleline day
Function:
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, 13th Dec 2016.
Project "simpleline day.rbp"
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 // 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 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 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 g.DrawPicture c.makeChartPicture, 0, 0 End Sub
Sub redraw() draw out.Graphics End Sub
Property Current As Double
Property Datas() As Double
Property MaxValue As Double
Property MinValue As Double
Property Time As Double
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:

Feedback, Comments & Corrections

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




Links
MBS Xojo Plugins