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/stackedbar
This example is the version from Sun, 17th Mar 2012.
Project "stackedbar.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()
// The data for the bar chart
dim data0(-1) as double = array(100, 125, 245, 147, 67.0)
dim data1(-1) as double = array(85, 156, 179, 211, 123.0)
dim data2(-1) as double = array(97, 87, 56, 267, 157.0)
// The labels for the bar chart
dim labels(-1) as string = array("Mon", "Tue", "Wed", "Thu", "Fri")
// Create a XYChart object of size 500 x 320 pixels
dim c as new CDXYChartMBS(500, 320)
// Set the plotarea at (100, 40) and of size 280 x 240 pixels
call c.setPlotArea(100, 40, 280, 240)
// Add a legend box at (400, 100)
call c.addLegend(400, 100)
// Add a title to the chart using 14 points Times Bold Itatic font
call c.addTitle("Weekday Network Load", "timesbi.ttf", 14)
// Add a title to the y axis. Draw the title upright (font angle = 0)
dim t as CDTextBoxMBS
t=c.yAxis.setTitle("Average"+EndOfLine.UNIX+"Workload"+EndOfLine.UNIX+"(MBytes"+EndOfLine.UNIX+"Per Hour)")
t.setFontAngle(0)
// Set the labels on the x axis
call c.xAxis.setLabels(labels)
// Add a stacked bar layer and set the layer 3D depth to 8 pixels
dim layer as CDBarLayerMBS
layer = c.addBarLayer(c.kStack, 8)
// Add the three data sets to the bar layer
call layer.addDataSet(data0, &hff8080, "Server # 1")
call layer.addDataSet(data1, &h80ff80, "Server # 2")
call layer.addDataSet(data2, &h8080ff, "Server # 3")
// Enable bar label for the whole bar
call layer.setAggregateLabelStyle
// Enable bar label for each segment of the stacked bar
call layer.setDataLabelStyle
// output the chart
Backdrop=c.makeChartPicture
End EventHandler
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.