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/symbolline
This example is the version from Sun, 17th Mar 2012.
Project "symbolline.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Open()
// The data for the line chart
dim data0(-1) as double = array(60.2, 51.7, 81.3, 48.6, 56.2, 68.9, 52.8)
dim data1(-1) as double = array(30.0, 32.7, 33.9, 29.5, 32.2, 28.4, 29.8)
dim labels(-1) as string = array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat")
// Create a XYChart object of size 300 x 180 pixels, with a pale yellow
// (0xffffc0) background, a black border, and 1 pixel 3D border effect.
dim c as new CDXYChartMBS(300, 180, &hffffc0, &h000000, 1)
// Set the plotarea at (45, 35) and of size 240 x 120 pixels, with white
// background. Turn on both horizontal and vertical grid lines with light grey
// color (0xc0c0c0)
call c.setPlotArea(45, 35, 240, 120, &hffffff, -1, -1, &hc0c0c0, -1)
// Add a legend box at (45, 12) (top of the chart) using horizontal layout and 8
// pts Arial font Set the background and border color to Transparent.
c.addLegend(45, 12, false, "", 8).setBackground(c.kTransparent)
// Add a title to the chart using 9 pts Arial Bold/white font. Use a 1 x 2 bitmap
// pattern as the background.
dim pattern1(1) as integer
pattern1(0)=&h004000
pattern1(1)=&h008000
call c.addTitle("Server Load (Jun 01 - Jun 07)", "arialbd.ttf", 9, &hffffff).setBackground(c.patternColor(pattern1, 2))
// Set the y axis label format to nn%
c.yAxis.setLabelFormat("{value}%")
// Set the labels on the x axis
call c.xAxis.setLabels(labels)
// Add a line layer to the chart
dim layer as CDLineLayerMBS
layer = c.addLineLayer
// Add the first line. Plot the points with a 7 pixel square symbol
layer.addDataSet(data0, &hcf4040, "Peak").setDataSymbol(c.kSquareSymbol, 7)
// Add the second line. Plot the points with a 9 pixel dismond symbol
layer.addDataSet(data1, &h40cf40, "Average").setDataSymbol(c.kDiamondSymbol, 9)
// Enable data label on the data points. Set the label format to nn%.
layer.setDataLabelFormat("{value|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
See also:
The items on this page are in the following plugins: MBS ChartDirector Plugin.