Platforms to show: All Mac Windows Linux Cross-Platform
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/boxwhisker2
This example is the version from Thu, 6th Apr 2016.
Project "boxwhisker2.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class PicWindow Inherits Window
EventHandler Sub Open()
// Sample data for the Box-Whisker chart. Represents the minimum, 1st quartile,
// medium, 3rd quartile and maximum values of some quantities
dim Q0Data(-1) as double = array(40, 45, 35.0)
dim Q1Data(-1) as double = array(55, 60, 50.0)
dim Q2Data(-1) as double = array(62, 70, 60.0)
dim Q3Data(-1) as double = array(70, 80, 65.0)
dim Q4Data(-1) as double = array(80, 90, 75.0)
// The labels for the chart
dim labels(-1) as string
labels.append "<*img="+CDXYChartMBS.GetPath(FindFile("robot1.png"))+"*><*br*>Bipedal Type"
labels.append "<*img="+CDXYChartMBS.GetPath(FindFile("robot2.png"))+"*><*br*>Wolf Type"
labels.append "<*img="+CDXYChartMBS.GetPath(FindFile("robot5.png"))+"*><*br*>Bird Type"
// Create a XYChart object of size 540 x 320 pixels
dim c as new CDXYChartMBS(540, 320)
// swap the x and y axes to create a horizontal box-whisker chart
c.swapXY
// Set the plotarea at (75, 25) and of size 440 x 270 pixels. Enable both
// horizontal and vertical grids by setting their colors to grey (&hc0c0c0)
c.setPlotArea(75, 25, 440, 270).setGridColor(&hc0c0c0, &hc0c0c0)
// Add a title to the chart
call c.addTitle(" Robot Shooting Accuracy Scores")
// Set the labels on the x axis and the font to Arial Bold
c.xAxis.setLabels(labels).setFontStyle("arialbd.ttf")
// Disable x axis ticks by setting the length to 0
c.xAxis.setTickLength(0)
// Set the font for the y axis labels to Arial Bold
call c.yAxis.setLabelStyle("arialbd.ttf")
// Add a Box Whisker layer using light blue &h9999ff as the fill color and blue
// (&hcc) as the line color. Set the line width to 2 pixels
c.addBoxWhiskerLayer2(Q3Data, Q1Data, Q4Data, Q0Data, Q2Data).setLineWidth(2)
// 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
The items on this page are in the following plugins: MBS ChartDirector Plugin.