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/polarzones
This example is the version from Sun, 17th Mar 2012.
Project "polarzones.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(51, 15, 51, 40, 17, 87, 94, 21, 35, 88, 50, 60.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
dim c as new CDPolarChartMBS(400, 420)
// Set background color to a 2 pixel pattern color, with a black border and 1
// pixel 3D border effect
dim pattern1(1) as integer
pattern1(0)=&hffffff
pattern1(1)=&he0e0e0
c.setBackground(c.patternColor(pattern1, 2), 0, 1)
// Add a title to the chart using 16 pts Arial Bold Italic font. The title text
// is white (&hffffff) on 2 pixel pattern background
dim pattern2(1) as integer
pattern2(0)=&h000000
pattern2(1)=&h000080
c.addTitle("Chemical Concentration", "arialbi.ttf", 16, &hffffff).setBackground(c.patternColor(pattern2, 2))
// Set center of plot area at (200, 240) with radius 145 pixels. Set background
// color to blue (9999ff)
c.setPlotArea(200, 240, 145, &h9999ff)
// Color the region between radius = 40 to 80 as green (99ff99)
c.radialAxis.addZone(40, 80, &h99ff99)
// Color the region with radius > 80 as red (ff9999)
c.radialAxis.addZone(80, 999, &hff9999)
// Set the grid style to circular grid
c.setGridStyle(false)
// Set the radial axis label format
c.radialAxis.setLabelFormat("{value} ppm")
// 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/green/blue zones
legendBox.addKey("Under-Absorp", &h9999ff)
legendBox.addKey("Normal", &h99ff99)
legendBox.addKey("Over-Absorp", &hff9999)
// Add a blue (000080) spline line layer with line width set to 3 pixels and
// using yellow (ffff00) circles to represent the data points
dim layer as CDPolarSplineLineLayerMBS
layer = c.addSplineLineLayer(data, &h000080)
layer.setLineWidth(3)
layer.setDataSymbol(CDPolarChartMBS.kCircleShape, 11, &hffff00)
// Set the labels to the angular axis as spokes.
call c.angularAxis.setLabels(labels)
// 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
See also:
The items on this page are in the following plugins: MBS ChartDirector Plugin.