Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/scattersymbols
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/scattersymbols
This example is the version from Thu, 6th Apr 2016.
Project "scattersymbols.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class PicWindow Inherits Window
EventHandler Sub Open() // The XY points for the scatter chart dim dataX(-1) as double = array(200, 400, 300, 250, 500.0) dim dataY(-1) as double = array(40, 100, 50, 150, 250.0) // The custom symbols for the points dim symbols(-1) as folderitem symbols.append FindFile("robot1.png") symbols.append FindFile("robot2.png") symbols.append FindFile("robot3.png") symbols.append FindFile("robot4.png") symbols.append FindFile("robot5.png") // Create a XYChart object of size 450 x 400 pixels dim c as new CDXYChartMBS(450, 400) // Set the plotarea at (55, 40) and of size 350 x 300 pixels, with a light grey // border (&hc0c0c0). Turn on both horizontal and vertical grid lines with light // grey color (&hc0c0c0) call c.setPlotArea(55, 40, 350, 300, -1, -1, &hc0c0c0, &hc0c0c0, -1) // Add a title to the chart using 18 pts Times Bold Itatic font. call c.addTitle("Battle Robots", "timesbi.ttf", 18) // Add a title to the y axis using 12 pts Arial Bold Italic font call c.yAxis.setTitle("Speed (km/s)", "arialbi.ttf", 12) // Add a title to the y axis using 12 pts Arial Bold Italic font call c.xAxis.setTitle("Range (km)", "arialbi.ttf", 12) // Set the axes line width to 3 pixels c.xAxis.setWidth(3) c.yAxis.setWidth(3) // Add each point of the data as a separate scatter layer, so that they can have // a different symbol dim i as integer for i = 0 to UBound(datax) dim coor1(0) as double = array(dataX(i)) dim coor2(0) as double = array(dataY(i)) call c.addScatterLayer(coor1, coor2).getDataSet(0).setDataSymbol(symbols(i)) next // Output the chart Backdrop=c.makeChartPicture End EventHandler
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
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