ChartDirectorArea Source
Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /kunden/macsw.de/webseiten/monkeybreadsoftware-video/rbformat/rbcode.php on line 244
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
Watch other Xojo videos:
![]() | MBS Xojo Plugins 21.1 (English) 23:12 minutes |
![]() | Installing a Xojo Web App Server (English) 28:19 minutes |
![]() | MBS Plugin Installation Win (English) 22:03 minutes |
![]() | MBS Plugin Installation Mac (English) 25:17 minutes |
![]() | XDC 2020 MBS Plugins Presentation (English) 38:59 minutes |
![]() | MBS Plugins @ MBS 2019 (English) 42:28 minutes |
Links
MBS Xojo Plugins