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/polygonbar
This example is the version from Sun, 17th Mar 2012.
Project "polygonbar.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 data(-1) as double = array( 85, 156, 179.5, 211, 123, 176, 195.0)
// The labels for the bar chart
dim labels(-1) as string = array("Square", "Star(8)", "Polygon(6)", "Cross", "Cross2", "Diamond", "Custom")
// Create a XYChart object of size 500 x 280 pixels.
dim c as new CDXYChartMBS(500, 280)
// Set the plotarea at (50, 40) with alternating light grey (f8f8f8) / white
// (ffffff) background
call c.setPlotArea(50, 40, 400, 200, &hf8f8f8, &hffffff)
// Add a title to the chart using 14 pts Arial Bold Italic font
call c.addTitle(" Bar Shape Demonstration", "arialbi.ttf", 14)
// Add a multi-color bar chart layer
dim layer as CDBarLayerMBS
dim colors(-1) as integer
layer = c.addBarLayer(data,colors)
// Set layer to 3D with 10 pixels 3D depth
layer.set3D(10)
// Set bar shape to circular (cylinder)
layer.setBarShape(c.kCircleShape)
// Set the first bar (index = 0) to square shape
layer.setBarShape(c.kSquareShape, 0, 0)
// Set the second bar to 8-pointed star
layer.setBarShape(c.StarShape(8), 0, 1)
// Set the third bar to 6-sided polygon
layer.setBarShape(c.PolygonShape(6), 0, 2)
// Set the next 3 bars to cross shape, X shape and diamond shape
layer.setBarShape(c.CrossShape, 0, 3)
layer.setBarShape(c.Cross2Shape, 0, 4)
layer.setBarShape(c.kDiamondShape, 0, 5)
// Set the last bar to a custom shape, specified as an array of (x, y) points in
// normalized coordinates
dim pattern1(-1) as integer = array( -500, 0, 0, 500, 500, 0, 500, 1000, 0, 500, -500, 1000)
layer.setBarShape(pattern1, 0, 6)
// Set the labels on the x axis.
call c.xAxis.setLabels labels
// Add a title to the y axis
call c.yAxis.setTitle("Frequency")
// Add a title to the x axis
call c.xAxis.setTitle("Shapes")
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.