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/dualyaxis
This example is the version from Sun, 17th Mar 2012.
Project "dualyaxis.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 data0(-1) as double = array( 0.05, 0.06, 0.48, 0.1, 0.01, 0.05)
dim data1(-1) as double = array( 100, 125, 265, 147, 67, 105.0)
dim labels(-1) as string = array("Jan", "Feb", "Mar", "Apr", "May", "Jun")
// Create a XYChart object of size 300 x 180 pixels
dim c as new CDXYChartMBS(300, 180)
// Set the plot area at (50, 20) and of size 200 x 130 pixels
call c.setPlotArea(50, 20, 200, 130)
// Add a title to the chart using 8 pts Arial Bold font
call c.addTitle("Independent Y-Axis Demo", "arialbd.ttf", 8)
// Set the labels on the x axis.
call c.xAxis.setLabels(labels)
// Add a title to the primary (left) y axis
call c.yAxis.setTitle("Packet Drop Rate (pps)")
// Set the axis, label and title colors for the primary y axis to red (&hc00000)
// to match the first data set
c.yAxis.setColors(&hc00000, &hc00000, &hc00000)
// Add a title to the secondary (right) y axis
call c.yAxis2.setTitle("Throughtput (MBytes)")
// set the axis, label and title colors for the primary y axis to green
// (&h008000) to match the second data set
c.yAxis2.setColors(&h008000, &h008000, &h008000)
// Add a line layer to for the first data set using red (&hc00000) color with a
// line width to 3 pixels
c.addLineLayer(data0, &hc00000).setLineWidth(3)
// Add a bar layer to for the second data set using green (&h00C000) color. Bind
// the second data set to the secondary (right) y axis
c.addBarLayer(data1, &h00c000).setUseYAxis2
// 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.