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/stepline
This example is the version from Sun, 17th Mar 2012.
Project "stepline.xojo_binary_project"
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 dataY0(-1) as double = array(4, 4.5, 5, 5.25, 5.75, 5.25, 5, 4.5, 4, 3, 2.5, 2.5)
dim dataX0(-1) as double = array(CDXYChartMBS.chartTime(1997, 1, 1), CDXYChartMBS.chartTime(1998, 6, 25), CDXYChartMBS.chartTime(1999, 9, 6), CDXYChartMBS.chartTime(2000, 2, 6), CDXYChartMBS.chartTime(2000, 9, 21), CDXYChartMBS.chartTime(2001, 3, 4), CDXYChartMBS.chartTime(2001, 6, 8), CDXYChartMBS.chartTime(2002, 2, 4), CDXYChartMBS.chartTime(2002, 5, 19), CDXYChartMBS.chartTime(2002, 8, 16), CDXYChartMBS.chartTime(2002, 12, 1), CDXYChartMBS.chartTime(2003, 1, 1))
dim dataY1(-1) as double = array(7, 6.5, 6, 5, 6.5, 7, 6, 5.5, 5, 4, 3.5, 3.5)
dim dataX1(-1) as double = array(CDXYChartMBS.chartTime(1997, 1, 1), CDXYChartMBS.chartTime(1997, 7, 1), CDXYChartMBS.chartTime(1997, 12, 1), CDXYChartMBS.chartTime(1999, 1, 15), CDXYChartMBS.chartTime(1999, 6, 9), CDXYChartMBS.chartTime(2000, 3, 3), CDXYChartMBS.chartTime(2000, 8, 13), CDXYChartMBS.chartTime(2001, 5, 5), CDXYChartMBS.chartTime(2001, 9, 16), CDXYChartMBS.chartTime(2002, 3, 16), CDXYChartMBS.chartTime(2002, 6, 1), CDXYChartMBS.chartTime(2003, 1, 1))
// Create a XYChart object of size 500 x 270 pixels, with a pale blue (e0e0ff)
// background, black border, 1 pixel 3D border effect and rounded corners
dim c as new CDXYChartMBS(600, 300, &he0e0ff, &h000000, 1)
c.setRoundedFrame
// Set the plotarea at (55, 60) and of size 520 x 200 pixels, with white (ffffff)
// background. Set horizontal and vertical grid lines to grey (cccccc).
call c.setPlotArea(50, 60, 525, 200, &hffffff, -1, -1, &hcccccc, &hcccccc)
// Add a legend box at (55, 32) (top of the chart) with horizontal layout. Use 9
// pts Arial Bold font. Set the background and border color to Transparent.
call c.addLegend(55, 32, false, "arialbd.ttf", 9).setBackground(c.kTransparent)
// Add a title box to the chart using 15 pts Times Bold Italic font. The text is
// white (ffffff) on a deep blue (000088) background, with soft lighting effect
// from the right side.
c.addTitle("Long Term Interest Rates", "timesbi.ttf", 15, &hffffff).setBackground(&h000088, -1, c.softLighting(c.kRight))
// Set the y axis label format to display a percentage sign
c.yAxis.setLabelFormat("{value}%")
// Add a red (ff0000) step line layer to the chart and set the line width to 2
// pixels
dim layer0 as CDStepLineLayerMBS
layer0 = c.addStepLineLayer(dataY0, &hff0000, "Country AAA")
layer0.setXData(dataX0)
layer0.setLineWidth(2)
// Add a blue (0000ff) step line layer to the chart and set the line width to 2
// pixels
dim layer1 as CDStepLineLayerMBS
layer1 = c.addStepLineLayer(dataY1, &h0000ff, "Country BBB")
layer1.setXData(dataX1)
layer1.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
The items on this page are in the following plugins: MBS ChartDirector Plugin.