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/polarzones2
This example is the version from Sun, 17th Mar 2012.
Project "polarzones2.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 chart
dim data(-1) as double = array(5.1, 1.5, 5.1, 4.0, 1.7, 8.7, 9.4, 2.1, 3.5, 8.8, 5.0, 6.0)
// The labels for the chart
dim labels(-1) as string = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec")
// Create a PolarChart object of size 400 x 420 pixels. with a metallic blue
// (9999ff) background color and 1 pixel 3D border
dim c as new CDPolarChartMBS(400, 420, CDPolarChartMBS.metalColor(&h9999ff), &h000000, 1)
// Add a title to the chart using 16 pts Arial Bold Italic font. The title text
// is white (&hffffff) on deep blue (000080) background
c.addTitle("Chemical Concentration", "arialbi.ttf", 16, &hffffff).setBackground(&h000080)
// Set center of plot area at (200, 240) with radius 145 pixels. Set background
// color to green (&h33ff33)
c.setPlotArea(200, 240, 145, &h33ff33)
// Set the labels to the angular axis
call c.angularAxis.setLabels(labels)
// Color the sector between label index = 5.5 to 7.5 as red (ff3333) zone
c.angularAxis.addZone(5.5, 7.5, &hff3333)
// Color the sector between label index = 4.5 to 5.5, and also between 7.5 to
// 8.5, as yellow (ff3333) zones
c.angularAxis.addZone(4.5, 5.5, &hffff00)
c.angularAxis.addZone(7.5, 8.5, &hffff00)
// Set the grid style to circular grid
c.setGridStyle(false)
// Use semi-transparent (40ffffff) label background so as not to block the data
c.radialAxis.setLabelStyle.setBackground(&h40ffffff, &h40000000)
// Add a legend box at (200, 30) top center aligned, using 9 pts Arial Bold font.
// with a black border.
dim LegendBox as CDLegendBoxMBS
legendBox = c.addLegend(200, 30, false, "arialbd.ttf", 9)
legendBox.setAlignment(CDPolarChartMBS.kTopCenter)
// Add legend keys to represent the red/yellow/green zones
call legendBox.addKey("Very Dry", &hff3333)
call legendBox.addKey("Critical", &hffff00)
call legendBox.addKey("Moderate", &h33ff33)
// Add a blue (&h80) line layer with line width set to 3 pixels and use purple
// (ff00ff) cross symbols for the data points
dim layer as CDPolarLineLayerMBS
layer = c.addLineLayer(data, &h000080)
layer.setLineWidth(3)
layer.setDataSymbol(CDPolarChartMBS.Cross2Shape, 15, &hff00ff)
// 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.