Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/background
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/background
This example is the version from Thu, 6th Apr 2016.
Project "background.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open() createChart(0, "background0") createChart(1, "background1") createChart(2, "background2") createChart(3, "background3") End EventHandler
Protected Sub CreateChart(img as integer, filename as string) dim w as new PicWindow w.Title=filename // The data for the chart dim data(-1) as double = array(85, 156, 179.5, 211, 123) dim labels(-1) as string = array("Mon", "Tue", "Wed", "Thu", "Fri") // Create a XYChart object of size 270 x 270 pixels dim c as new CDXYChartMBS(270, 270) // Set the plot area at (40, 32) and of size 200 x 200 pixels dim plotarea as CDPlotAreaMBS plotarea = c.setPlotArea(40, 32, 200, 200) // Set the background style based on the input parameter if (img = 0) then // Has wallpaper image c.setWallpaper(FindFile("tile.gif")) elseif (img = 1) then // Use a background image as the plot area background plotarea.setBackground(FindFile("bg.png")) elseif (img = 2) then // Use white (&hffffff) and grey (&he0e0e0) as two alternate plotarea // background colors plotarea.setBackground(&hffffff, &he0e0e0) else // Use a dark background palette c.setWhiteOnBlackColors end if // Set the labels on the x axis call c.xAxis.setLabels(labels) // Add a color bar layer using the given data. Use a 1 pixel 3D border for the // bars. dim colors(-1) as integer c.addBarLayer(data, colors).setBorderColor(-1, 1) w.Backdrop=c.makeChartPicture w.top=50+300*(img\2) w.left=300*(img mod 2) w.show End Sub
Function FindFile(name as string) As FolderItem // Look for file in parent folders from executable on dim parent as FolderItem = app.ExecutableFile.Parent while parent<>Nil dim file as FolderItem = parent.Child(name) if file<>Nil and file.Exists then Return file end if parent = parent.Parent wend End Function
End Class
Class PicWindow Inherits Window
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

Feedback, Comments & Corrections

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





Links
MBS Xojo PDF Plugins