Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/trendline
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/trendline
This example is the version from Sun, 17th Mar 2012.
Project "trendline.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 line chart dim data(-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, 91.0) // The labels for the line chart dim labels(-1) as string = array("Jan 2000", "Feb 2000", "Mar 2000", "Apr 2000", "May 2000", "Jun 2000", "Jul 2000", "Aug 2000", "Sep 2000", "Oct 2000", "Nov 2000", "Dec 2000", "Jan 2001", "Feb 2001", "Mar 2001", "Apr 2001", "May 2001", "Jun 2001", "Jul 2001", "Aug 2001", "Sep 2001", "Oct 2001", "Nov 2001", "Dec 2001") // Create a XYChart object of size 500 x 320 pixels, with a pale purpule // (&hffccff) background, a black border, and 1 pixel 3D border effect. dim c as new CDXYChartMBS(500, 320, &hffccff, &h000000, 1) // Set the plotarea at (55, 45) and of size 420 x 210 pixels, with white // background. Turn on both horizontal and vertical grid lines with light grey // color (&hc0c0c0) call c.setPlotArea(55, 45, 420, 210, &hffffff, -1, -1, &hc0c0c0, -1) // Add a legend box at (55, 25) (top of the chart) with horizontal layout. Use 8 // pts Arial font. Set the background and border color to Transparent. c.addLegend(55, 22, false, "", 8).setBackground(c.kTransparent) // Add a title box to the chart using 13 pts Times Bold Italic font. The text is // white (&hffffff) on a purple (&h800080) background, with a 1 pixel 3D border. c.addTitle("Long Term Server Load", "timesbi.ttf", 13, &hffffff).setBackground(&h800080, -1, 1) // Add a title to the y axis call c.yAxis.setTitle("MBytes") // Set the labels on the x axis. Rotate the font by 90 degrees. c.xAxis.setLabels(labels).setFontAngle(90) // Add a line layer to the chart dim linelayer as CDLineLayerMBS lineLayer = c.addLineLayer // Add the data to the line layer using light brown color (&hcc9966) with a 7 // pixel square symbol lineLayer.addDataSet(data, &hcc9966, "Server Utilization").setDataSymbol(c.kSquareSymbol, 7) // Set the line width to 2 pixels lineLayer.setLineWidth(2) // Add a trend line layer using the same data with a dark green (&h008000) color. // Set the line width to 2 pixels call c.addTrendLayer(data, &h008000, "Trend Line").setLineWidth(2) // 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 FileMaker blog