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/polararea
This example is the version from Thu, 6th Apr 2016.
Project "polararea.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 labels(-1) as string = array("North", "North<*br*>East", "East", "South<*br*>East", "South", "South<*br*>West", "West", "North<*br*>West")
// Create a PolarChart object of size 460 x 500 pixels, with a grey (e0e0e0)
// background and 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 a wood pattern as the title background.
c.addTitle("Polar Area Chart Demo", "arialbi.ttf", 15).setBackground(c.patternColor(FindFIle("wood.png")))
// Set center of plot area at (230, 280) with radius 180 pixels, and white
// (ffffff) background.
c.setPlotArea(230, 280, 180, &hffffff)
// Set the grid style to circular grid
c.setGridStyle(false)
// Add a legend box at top-center of plot area (230, 35) using horizontal layout.
// Use 10 pts Arial Bold font, with 1 pixel 3D border effect.
dim b as CDLegendBoxMBS
b = c.addLegend(230, 35, false, "arialbd.ttf", 9)
b.setAlignment(CDPolarChartMBS.kTopCenter)
b.setBackground(CDPolarChartMBS.kTransparent, CDPolarChartMBS.kTransparent, 1)
// Set angular axis using the given labels
call c.angularAxis.setLabels(labels)
// Specify the label format for the radial axis
c.radialAxis.setLabelFormat("{value}%")
// Set radial axis label background to semi-transparent grey (40cccccc)
c.radialAxis.setLabelStyle.setBackground(&h40cccccc, 0)
// Add the data as area layers
call c.addAreaLayer(data2, -1,"5 m/s or above")
call c.addAreaLayer(data1, -1,"1 - 5 m/s")
call c.addAreaLayer(data0, -1,"less than 1 m/s")
// 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.