Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/overlapbar
Function:
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/overlapbar
This example is the version from Sun, 17th Mar 2012.
Project "overlapbar.rbp"
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 bar chart dim data0(-1) as double = array( 100, 125, 156, 147, 87, 124, 178, 109, 140, 106, 192, 122.0) dim data1(-1) as double = array(122, 156, 179, 211, 198, 177, 160, 220, 190, 188, 220, 270.0) dim data2(-1) as double = array(167, 190, 213, 267, 250, 320, 212, 199, 245, 267, 240, 310.0) dim labels(-1) as string = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec") // Create a XYChart object of size 580 x 280 pixels dim c as new CDXYChartMBS(580, 280) // Add a title to the chart using 14 pts Arial Bold Italic font call c.addTitle("Product Revenue For Last 3 Years", "arialbi.ttf", 14) // Set the plot area at (50, 50) and of size 500 x 200. Use two alternative // background colors (f8f8f8 and ffffff) call c.setPlotArea(50, 50, 500, 200, &hf8f8f8, &hffffff) // Add a legend box at (50, 25) using horizontal layout. Use 8pts Arial as font, // with transparent background. dim l as CDLegendBoxMBS l=c.addLegend(50, 25, false, "arial.ttf", 8) l.setBackground(c.kTransparent) // Set the x axis labels call c.xAxis.setLabels labels // Draw the ticks between label positions (instead of at label positions) c.xAxis.setTickOffset(0.5) // Add a multi-bar layer with 3 data sets dim layer as CDBarLayerMBS layer = c.addBarLayer(c.kSide) call layer.addDataSet(data0, &hff8080, "Year 2003") call layer.addDataSet(data1, &h80ff80, "Year 2004") call layer.addDataSet(data2, &h8080ff, "Year 2005") // Set 50% overlap between bars layer.setOverlapRatio(0.5) // Add a title to the y-axis call c.yAxis.setTitle("Revenue (USD in millions)") 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

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS ChartDirector Plugin.




Links
MBS FileMaker tutorial videos