Example: /ChartDirector/dualxaxis

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/dualxaxis


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/dualxaxis

This example is the version from Sun, 17th Mar 2012.

Project "dualxaxis.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(42, 49, 33, 38, 51, 46, 29, 41, 44, 57, 59, 52, 37, 34, 51, 56, 56, 60, 70, 76, 63, 67, 75, 64, 51.0) dim Data1(-1) as double = array(50, 55, 47, 34, 42, 49, 63, 62, 73, 59, 56, 50, 64, 60, 67, 67, 58, 59, 73, 77, 84, 82, 80, 84, 98.0) // The labels for the bottom x axis. Note the "-" means a minor tick. dim labels0(-1) as string = array("0"+endofline.unix+"Jun 4", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "0"+endofline.unix+"Jun 5") // The labels for the top x axis. Note that "-" means a minor tick. dim labels1(-1) as string = array("Jun 3"+endofline.unix+"12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "Jun 4"+endofline.unix+"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12") // Create a XYChart object of size 310 x 310 pixels dim c as new CDXYChartMBS(310, 310) // Set the plotarea at (50, 50) and of size 200 x 200 pixels call c.setPlotArea(50, 50, 200, 200) // Add a title to the primary (left) y axis call c.yAxis.setTitle("US Dollars") // Set the tick length to -4 pixels (-ve means ticks inside the plot area) c.yAxis.setTickLength(-4) // Add a title to the secondary (right) y axis call c.yAxis2.setTitle("HK Dollars (1 USD = 7.8 HKD)") // Set the tick length to -4 pixels (-ve means ticks inside the plot area) c.yAxis2.setTickLength(-4) // Synchronize the y-axis such that y2 = 7.8 x y1 c.syncYAxis(7.8) // Add a title to the bottom x axis call c.xAxis.setTitle("Hong Kong Time") // Set the labels on the x axis. call c.xAxis.setLabels(labels0) // Display 1 out of 3 labels on the x-axis. Show minor ticks for remaining // labels. c.xAxis.setLabelStep(3, 1) // Set the major tick length to -4 pixels and minor tick length to -2 pixels (-ve // means ticks inside the plot area) c.xAxis.setTickLength(-4, -2) // Set the distance between the axis labels and the axis to 6 pixels c.xAxis.setLabelGap(6) // Add a title to the top x-axis call c.xAxis2.setTitle("New York Time") // Set the labels on the x axis. call c.xAxis2.setLabels(labels1) // Display 1 out of 3 labels on the x-axis. Show minor ticks for remaining // labels. c.xAxis2.setLabelStep(3, 1) // Set the major tick length to -4 pixels and minor tick length to -2 pixels (-ve // means ticks inside the plot area) c.xAxis2.setTickLength(-4, -2) // Set the distance between the axis labels and the axis to 6 pixels c.xAxis2.setLabelGap(6) // Add a line layer to the chart with a line width of 2 pixels call c.addLineLayer(data0, -1, "Red Transactions").setLineWidth(2) // Add an area layer to the chart with no area boundary line call c.addAreaLayer(data1, -1, "Green Transactions").setLineWidth(0) // 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.


💬 Ask a question or report a problem