Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/hbar
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/hbar
This example is the version from Sun, 17th Mar 2012.
Project "hbar.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 data(-1) as double = array(3.9, 8.1, 10.9, 14.2, 18.1, 19.0, 21.2, 23.2, 25.7, 36) // The labels for the bar chart dim labels(-1) as string = array("Bastic Group", "Simpa", "YG Super", "CID", "Giga Tech", "Indo Digital", "Supreme", "Electech", "THP Thunder", "Flash Light") // Create a XYChart object of size 600 x 250 pixels dim c as new CDXYChartMBS(600, 250) // Add a title to the chart using Arial Bold Italic font call c.addTitle("Revenue Estimation - Year 2002", "arialbi.ttf") // Set the plotarea at (100, 30) and of size 400 x 200 pixels. Set the plotarea // border, background and grid lines to Transparent call c.setPlotArea(100, 30, 400, 200, c.kTransparent, c.kTransparent, c.kTransparent, c.kTransparent, c.kTransparent) // Add a bar chart layer using the given data. Use a gradient color for the bars, // where the gradient is from dark green (0x008000) to white (0xffffff) dim layer as CDBarLayerMBS layer = c.addBarLayer(data,c.gradientColor(100, 0, 500, 0, &h008000, &hffffff)) // Swap the axis so that the bars are drawn horizontally c.swapXY(true) // Set the bar gap to 10% layer.setBarGap(0.1,c.knovalue) // Use the format "US$ xxx millions" as the bar label layer.setAggregateLabelFormat("US$ {value} millions") // Set the bar label font to 10 pts Times Bold Italic/dark red (0x663300) call layer.setAggregateLabelStyle("timesbi.ttf", 10, &h663300) // Set the labels on the x axis dim textbox as CDTextBoxMBS textbox = c.xAxis.setLabels(labels) // Set the x axis label font to 10pt Arial Bold Italic textbox.setFontStyle("arialbi.ttf") textbox.setFontSize(10) // Set the x axis to Transparent, with labels in dark red (0x663300) c.xAxis.setColors(c.kTransparent, &h663300) // Set the y axis and labels to Transparent c.yAxis.setColors(c.kTransparent, c.kTransparent) // 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

Feedback, Comments & Corrections

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




Links
MBS Xojo Plugins