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

MBS Xojo Plugin Tutorial Videos

ChartDirectorArea Source

Class App
Inherits Application
// Constants
Const kFileQuitShortcut = Ctrl+Q
Const kFileQuit = E&xit
Const kEditClear = &Delete
End Class

Class Window1
Inherits Window
// Controls
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
Sub Action() Handles Event
update
End Sub
End ControlInstance

// Properties
Dim last As darwinvmStatisticsMBS
Dim CPUUser(59) As double
Dim CPUIdle(59) As double
Dim CPUSystem(59) As double

// Event implementations
Sub Open()
last=GetDarwinVMStatisticsMBS

End Sub

// Methods
Sub Update()
dim d as DarwinVMStatisticsMBS

d=GetDarwinVMStatisticsMBS

dim System,User,Idle as integer

System=d.CPUTicksSystem-last.CPUTicksSystem
User=d.CPUTicksUser-last.CPUTicksUser
idle=d.CPUTicksIdle-last.CPUTicksIdle

StaticText1.text="System: "+Format(System,"0")
StaticText2.text="User: "+Format(user,"0")
StaticText3.text="Idle: "+Format(Idle,"0")

last=d

dim total as double

total=user+idle+System

CPUUser.Append 100.0*user/total
CPUIdle.Append 100.0*idle/total
CPUSystem.Append 100.0*System/total

CPUUser.Remove 0
CPUSystem.Remove 0
CPUIdle.Remove 0

dim c as new CDXYChartMBS(Canvas1.Width, canvas1.Height, &hFFFFC0, &h000000)

c.setPlotArea(50,30,canvas1.Width-80, canvas1.Height-60).setBackground(&hFFFFFF)
c.addLegend(50,canvas1.Height-30, false,"",8).setBackground(CDXYChartMBS.kTransparent)

c.addTitle("CPU Usage", "arialbd.ttf", 8).setBackground(&hFFFF40, 0)

c.yAxis.setLinearScale 0,100
c.yAxis.setLabelFormat "{value}%"

dim layer as CDAreaLayerMBS
layer=c.addAreaLayer(CDXYChartMBS.kStack)

call layer.addDataSet(CPUUser, &h4040FF, "User")
call layer.addDataSet(CPUSystem, &hFF4040, "System")
call layer.addDataSet(CPUIdle, &h40FF40, "Idle")

canvas1.Backdrop=c.makeChartPicture

End Sub
End Class


All movies




Links
MBS Xojo Plugins