Xojo Conferences

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/customsymbolline
This example is the version from Thu, 6th Apr 2016.
Project "customsymbolline.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 chart dim data0(-1) as double = array(600, 800, 1200, 1500, 1800, 1900, 2000, 1950.0) dim data1(-1) as double = array(300, 450, 500, 1000, 1500, 1600, 1650, 1600.0) // The labels for the chart dim labels(-1) as string = array("1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002") // Create a XYChart object of size 450 x 250 pixels, with a pale yellow // (0xffffc0) background, a black border, and 1 pixel 3D border effect. dim c as new CDXYChartMBS(450, 250, &hffffc0, 0, 1) // Set the plotarea at (60, 45) and of size 360 x 170 pixels, using white // (0xffffff) as the plot area background color. Turn on both horizontal and // vertical grid lines with light grey color (0xc0c0c0) call c.setPlotArea(60, 45, 360, 170, &hffffff, -1, -1, &hc0c0c0, -1) // Add a legend box at (60, 20) (top of the chart) with horizontal layout. Use 8 // pts Arial Bold font. Set the background and border color to Transparent. c.addLegend(60, 20, false, "arialbd.ttf", 8).setBackground(c.kTransparent) // Add a title to the chart using 12 pts Arial Bold/white font. Use a 1 x 2 // bitmap pattern as the background. dim pattern1(-1) as integer pattern1.append &h000040 pattern1.append &h000080 call c.addTitle("Information Resource Usage", "arialbd.ttf", 12, &hffffff).setBackground(c.patternColor(pattern1, 2)) // Set the labels on the x axis call c.xAxis.setLabels(labels) // Reserve 8 pixels margins at both side of the x axis to avoid the first and // last symbols drawing outside of the plot area c.xAxis.setMargin(8, 8) // Add a title to the y axis call c.yAxis.setTitle("Population") // Add a line layer to the chart dim layer as CDLineLayerMBS layer = c.addLineLayer // Add the first line using small_user.png as the symbol. layer.addDataSet(data0, &hcf4040,"Users").setDataSymbol(FindFile("small_user.png")) // Add the first line using small_computer.png as the symbol. layer.addDataSet(data1, &h40cf40,"Computers").setDataSymbol(FindFile("small_computer.png")) // Set the line width to 3 pixels layer.setLineWidth(3) // Output the chart Backdrop=c.makeChartPicture End EventHandler
Function FindFile(name as string) As FolderItem // Look for file in parent folders from executable on dim parent as FolderItem = app.ExecutableFile.Parent while parent<>Nil dim file as FolderItem = parent.Child(name) if file<>Nil and file.Exists then Return file end if parent = parent.Parent wend End Function
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.

MBS FileMaker tutorial videos