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/paramcurve
This example is the version from Sun, 17th Mar 2012.
Project "paramcurve.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 XY data of the first data series
dim dataX0(-1) as double = array(10.0, 35, 17, 4, 22, 29, 45, 52, 63, 39)
dim dataY0(-1) as double = array(2.0, 3.2, 2.7, 1.2, 2.8, 2.9, 3.1, 3.0, 2.3, 3.3)
// The XY data of the second data series
dim dataX1(-1) as double = array(30.0, 35, 17, 4, 22, 59, 43, 52, 63, 39)
dim dataY1(-1) as double = array(1.0, 1.3, 0.7, 0.6, 0.8, 3.0, 1.8, 2.3, 3.4, 1.5)
// The XY data of the third data series
dim dataX2(-1) as double = array(28.0, 35, 15, 10, 22, 60, 46, 64, 39)
dim dataY2(-1) as double = array(2.0, 2.2, 1.2, 0.4, 1.8, 2.7, 2.4, 2.8, 2.4)
// Create a XYChart object of size 540 x 480 pixels
dim c as new CDXYChartMBS(540, 480)
// Set the plotarea at (70, 65) and of size 400 x 350 pixels, with white
// background and a light grey border (&hc0c0c0). Turn on both horizontal and
// vertical grid lines with light grey color (&hc0c0c0)
call c.setPlotArea(70, 65, 400, 350, &hffffff, -1, &hc0c0c0, &hc0c0c0, -1)
// Add a legend box with the top center point anchored at (270, 30). Use
// horizontal layout. Use 10 pts Arial Bold Italic font. Set the background and
// border color to Transparent.
dim legendBox as CDLegendBoxMBS = c.addLegend(270, 30, false, "arialbi.ttf", 10)
legendBox.setAlignment(c.kTopCenter)
legendBox.setBackground(c.kTransparent, c.kTransparent)
// Add a title to the chart using 18 point Times Bold Itatic font.
call c.addTitle("Parametric Curve Fitting", "timesbi.ttf", 18)
// Add titles to the axes using 12 pts Arial Bold Italic font
call c.yAxis.setTitle("Axis Title Placeholder", "arialbi.ttf", 12)
call c.xAxis.setTitle("Axis Title Placeholder", "arialbi.ttf", 12)
// Set the axes line width to 3 pixels
c.yAxis.setWidth(3)
c.xAxis.setWidth(3)
// Add a scatter layer using (dataX0, dataY0)
call c.addScatterLayer(dataX0, dataY0, "Polynomial", c.kGlassSphere2Shape, 11, &hff0000)
// Add a degree 2 polynomial trend line layer for (dataX0, dataY0)
dim trend0 as CDTrendLayerMBS = c.addTrendLayer(dataX0,dataY0, &hff0000)
trend0.setLineWidth(3)
trend0.setRegressionType(c.PolynomialRegression(2))
// Add a scatter layer for (dataX1, dataY1)
call c.addScatterLayer(dataX1, dataY1, "Exponential", c.kGlassSphere2Shape, 11, &h00aa00)
// Add an exponential trend line layer for (dataX1, dataY1)
dim trend1 as CDTrendLayerMBS = c.addTrendLayer(dataX1, dataY1, &h00aa00)
trend1.setLineWidth(3)
trend1.setRegressionType(c.kExponentialRegression)
// Add a scatter layer using (dataX2, dataY2)
call c.addScatterLayer(dataX2, dataY2, "Logarithmic", c.kGlassSphere2Shape, 11, &h0000ff)
// Add a logarithmic trend line layer for (dataX2, dataY2)
dim trend2 as CDTrendLayerMBS = c.addTrendLayer(dataX2,dataY2,&h0000ff)
trend2.setLineWidth(3)
trend2.setRegressionType(c.kLogarithmicRegression)
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.