Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/splineline


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/splineline

This example is the version from Thu, 6th Apr 2016.

Project "splineline.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 data0(-1) as double = array(32, 39, 23, 28, 41, 38, 26, 35, 29.0) dim data1(-1) as double = array(50, 55, 47, 34, 47, 53, 38, 40, 51.0) // The labels for the chart dim labels(-1) as string = array("0", "1", "2", "3", "4", "5", "6", "7", "8") // Create a XYChart object of size 600 x 300 pixels, with a pale red (ffdddd) // background, black border, 1 pixel 3D border effect and rounded corners. dim c as new CDXYChartMBS(600, 300, &hffdddd, &h000000, 1) c.setRoundedFrame // Set the plotarea at (55, 58) and of size 520 x 195 pixels, with white (ffffff) // background. Set horizontal and vertical grid lines to grey (cccccc). call c.setPlotArea(55, 58, 520, 195, &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 title is // in CDML and includes embedded images for highlight. The text is white (ffffff) // on a dark red (880000) background, with soft lighting effect from the right // side. dim path as string =c.GetPath(FindFile("star.png")) call c.addTitle("<*block,valign=absmiddle*><*img="+path+"*><*img="+path+"*> Performance Enhancer <*img="+path+"*><*img="+path+"*><*/*>", "timesbi.ttf", 15, &hffffff).setBackground(&h880000, -1, c.softLighting(c.kRight)) // Add a title to the y axis call c.yAxis.setTitle("Energy Concentration (KJ per liter)") // Set the labels on the x axis call c.xAxis.setLabels(labels) // Add a title to the x axis using CMDL path=c.GetPath(FindFile("clock.png")) call c.xAxis.setTitle("<*block,valign=absmiddle*><*img="+path+"*> Elapsed Time (hour)<*/*>") // Set the axes width to 2 pixels c.xAxis.setWidth(2) c.yAxis.setWidth(2) // Add a spline layer to the chart dim layer as CDSplineLayerMBS layer = c.addSplineLayer // Set the default line width to 2 pixels layer.setLineWidth(2) // Add a data set to the spline layer, using blue (0000c0) as the line color, // with yellow (ffff00) circle symbols. layer.addDataSet(data1, &h0000c0, "Target Group").setDataSymbol(c.kCircleSymbol, 9, &hffff00) // Add a data set to the spline layer, using brown (982810) as the line color, // with pink (f040f0) diamond symbols. layer.addDataSet(data0, &h982810, "Control Group").setDataSymbol(c.kDiamondSymbol, 11, &hf040f0) // Add a custom CDML text at the bottom right of the plot area as the logo path=c.GetPath(FindFile("small_molecule.png")) c.addText(575, 250, "<*block,valign=absmiddle*><*img="+path+"*> <*block*><*font=timesbi.ttf,size=10,color=804040*>Molecular"+EndOfLine.unix+"Engineering<*/*>").setAlignment(c.kBottomRight) // 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

The items on this page are in the following plugins: MBS ChartDirector Plugin.


The biggest plugin in space...