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/fourq
This example is the version from Sun, 17th Mar 2012.
Project "fourq.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()
// XY points for the scatter chart
dim DataX0(-1) as double = array(10, 15, 6, -12, 14, -8, 13, -13, 16, 12, 10.5)
dim DataY0(-1) as double = array(130, 150, 80, 110, -110, -105, -130, 115, -170, 125, 125.0)
dim DataX1(-1) as double = array(6, 7, -4, 3.5, 7, 8, -9, -10, -12, 11, 8.0)
dim DataY1(-1) as double = array(65, -40, -40, 45, -70, -80, 80, 10, -100, 105, 60.0)
dim DataX2(-1) as double = array(-10, -12, 11, 8, 6, 12, -4, 3.5, 7, 8, -9.0)
dim DataY2(-1) as double = array(65, -80, -40, 45, -70, -80, 80, 90, -100, 105, 60.0)
// Create a XYChart object of size 600 x 300 pixels, with a light blue (ccccff)
// background, a black border, and 1 pixel 3D border effect
dim c as new CDXYChartMBS(600, 480, &hccccff, &h000000, 1)
// Add a title box to the chart using 16 pts Arial Bold Italic font, with white
// text on deep blue background
c.addTitle("Four Quadrant Chart Demonstration", "arialbi.ttf", 16, &hffffff).setBackground(&h000080)
// Set the plotarea at (20, 60) and of size 560 x 360 pixels, with grey (808080)
// border, and light grey (c0c0c0) horizontal and vertical grid lines. Set 4
// quadrant coloring, where the colors of the quadrants alternate between lighter
// and deeper grey (dddddd/eeeeee)
c.setPlotArea(20, 60, 560, 360, -1, -1, &h808080, &hc0c0c0, &hc0c0c0).set4QBgColor(&hdddddd, &heeeeee, &hdddddd, &heeeeee)
// Set 4 quadrant mode, with both x and y axes symetrical around the origin
c.setAxisAtOrigin(CDXYChartMBS.kXYAxisAtOrigin, CDXYChartMBS.kXAxisSymmetric + CDXYChartMBS.kYAxisSymmetric)
// Add a legend box at (300, 460) (bottom center of the chart) with horizontal
// layout. Use 8 pts Arial Bold font.
dim LegendBox as CDLegendBoxMBS
legendBox = c.addLegend(300, 460, false, "arialbd.ttf", 8)
legendBox.setAlignment(CDXYChartMBS.kBottomCenter)
// Set legend box background to light grey (dddddd) with a black border
legendBox.setBackground(&hdddddd, 0)
// Set left/right margin to 20 pixels and top/bottom margin to 5 pixels
legendBox.setMargin(20, 20, 5, 5)
// Add a titles to axes
call c.xAxis.setTitle("Alpha Index")
call c.yAxis.setTitle("Beta Index")
// Set axes width to 2 pixels
c.xAxis.setWidth(2)
c.yAxis.setWidth(2)
// Add scatter layer, using 15 pixels red (ff33333) X shape symbols
call c.addScatterLayer(dataX0, dataY0, "Group A", CDXYChartMBS.Cross2Shape, 15, &hff3333)
// Add scatter layer, using 15 pixels green (33ff33) 6-sided polygon symbols
call c.addScatterLayer(dataX1, dataY1, "Group B", CDXYChartMBS.PolygonShape(6), 15, &h33ff33)
// Add scatter layer, using 15 pixels blue (3333ff) triangle symbols
call c.addScatterLayer(dataX2, dataY2, "Group C", CDXYChartMBS.kTriangleSymbol, 15, &h3333ff)
// 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.