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/stackrose
This example is the version from Sun, 17th Mar 2012.
Project "stackrose.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()
// Data for the chart
dim data0(-1) as double = array(5, 3, 10, 4, 3, 5, 2, 5.0)
dim data1(-1) as double = array(12, 6, 17, 6, 7, 9, 4, 7.0)
dim data2(-1) as double = array(17, 7, 22, 7, 18, 13, 5, 11.0)
dim angles(-1) as double = array(0, 45, 90, 135, 180, 225, 270, 315.0)
dim labels(-1) as string = array("North", "North"+endofline.unix+"East", "East", "South"+endofline.unix+"East", "South", "South"+endofline.unix+"West", "West", "North"+endofline.unix+"West")
// Create a PolarChart object of size 460 x 500 pixels, with a grey (e0e0e0)
// background and a 1 pixel 3D border
dim c as new CDPolarChartMBS(460, 500, &he0e0e0, &h000000, 1)
// Add a title to the chart at the top left corner using 15pts Arial Bold Italic
// font. Use white text on deep blue background.
c.addTitle("Wind Direction", "arialbi.ttf", 15, &hffffff).setBackground(&h000080)
dim LegendBox as CDLegendBoxMBS
legendBox = c.addLegend(230, 35, false, "arialbd.ttf", 9)
legendBox.setAlignment(CDPolarChartMBS.kTopCenter)
legendBox.setBackground(CDPolarChartMBS.kTransparent, CDPolarChartMBS.kTransparent, 1)
legendBox.addKey("5 m/s or above", &hff3333)
legendBox.addKey("1 - 5 m/s", &h33ff33)
legendBox.addKey("less than 1 m/s", &h3333ff)
// Set plot area center at (230, 280) with radius 180 pixels and white background
c.setPlotArea(230, 280, 180, &hffffff)
// Set the grid style to circular grid
c.setGridStyle(false)
// Set angular axis as 0 - 360, with a spoke every 30 units
c.angularAxis.setLinearScale(0, 360, labels)
dim count,i as integer
count=UBound(angles)
for i=0 to count
c.angularAxis.addZone(angles(i) - 10, angles(i) + 10, 0, data0(i),&h3333ff, 0)
c.angularAxis.addZone(angles(i) - 10, angles(i) + 10, data0(i), data1(i),&h33ff33, 0)
c.angularAxis.addZone(angles(i) - 10, angles(i) + 10, data1(i), data2(i),&hff3333, 0)
next
// Add an Transparent invisible layer to ensure the axis is auto-scaled using the
// data
call c.addLineLayer(data2, CDPolarChartMBS.kTransparent)
// 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.