Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/confidenceband


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

This example is the version from Sun, 17th Mar 2012.

Project "confidenceband.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 dataX(-1) as double = array(50, 55, 37, 24, 42, 49, 63, 72, 83, 59.0) dim dataY(-1) as double = array(3.6, 2.8, 2.5, 2.3, 3.8, 3.0, 3.8, 5.0, 6.0, 3.3) // Create a XYChart object of size 450 x 420 pixels Dim c as new CDXYChartMBS(450, 420) // Set the plotarea at (55, 65) and of size 350 x 300 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(55, 65, 350, 300, &hffffff, -1, &hc0c0c0, &hc0c0c0, -1) // Add a title to the chart using 18 point Times Bold Itatic font. call c.addTitle("Server Performance", "timesbi.ttf", 18) // Add a title to the y axis using 12 pts Arial Bold Italic font call c.yAxis.setTitle("Response Time (sec)", "arialbi.ttf", 12) // Set the y axis line width to 3 pixels c.yAxis.setWidth(3) // Set the y axis label format to show 1 decimal point c.yAxis.setLabelFormat("{value|1}") // Add a title to the x axis using 12 pts Arial Bold Italic font call c.xAxis.setTitle("Server Load (TPS)", "arialbi.ttf", 12) // Set the x axis line width to 3 pixels c.xAxis.setWidth(3) // Add a scatter layer using (dataX, dataY) call c.addScatterLayer(dataX, dataY, "", c.kDiamondSymbol,11, &h008000) // Add a trend line layer for (dataX, dataY) dim trendLayer as CDTrendLayerMBS TrendLayer = c.addTrendLayer(dataX, dataY, &h008000) // Set the line width to 3 pixels trendLayer.setLineWidth(3) // Add a 95% confidence band for the line trendLayer.addConfidenceBand(0.95, &h806666FF) // Add a 95% confidence band (prediction band) for the points trendLayer.addPredictionBand(0.95, &h8066FF66) // Add a legend box at (50, 30) (top of the chart) with horizontal layout. Use 10 // pts Arial Bold Italic font. Set the background and border color to // Transparent. dim legendBox as CDLegendBoxMBS legendBox = c.addLegend(50, 30, false, "arialbi.ttf", 10) legendBox.setBackground(c.kTransparent) // Add entries to the legend box legendBox.addKey("95% Line Confidence", &h806666FF) legendBox.addKey("95% Point Confidence", &h8066FF66) // Display the trend line parameters as a text table formatted using CDML dim buffer as string buffer="<*block*>Slope"+EndOfLine.UNIX+"Intercept"+EndOfLine.UNIX+"Correlation"+EndOfLine.UNIX+_ "Std Error<*/*> <*block*>"+str(trendLayer.getSlope)+" sec/tps"+EndOfLine.UNIX+str(trendLayer.getIntercept)+" sec"+EndOfLine.UNIX+str(trendLayer.getCorrelation)+EndOfLine.UNIX+str(trendLayer.getStdError)+" sec<*/*>" dim textbox as CDTextBoxMBS textbox = c.addText(56, 65, buffer, "arialbd.ttf", 8) // Set the background of the text box to light grey, with a black border, and 1 // pixel 3D border textbox.setBackground(&hc0c0c0, 0, 1) // 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.


The biggest plugin in space...