Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/ChartDirector/High Resolution Chart Examples/surfaceshading
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/High Resolution Chart Examples/surfaceshading
This example is the version from Sun, 17th Mar 2012.

Screenshot for this example project.

Project "surfaceshading.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open() createChart(0, "surfaceshading") End EventHandler
Protected Sub CreateChart(img as integer, filename as string) const f=4 // scale factor, 1 for screen and 4 or more for printing dim w as new PicWindow w.Title=filename // The x and y coordinates of the grid dim dataX(-1) as double = array(-10.0, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10) dim dataY(-1) as double = array(-10.0, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10) // The values at the grid points. In this example, we will compute the values // using the formula z = x * sin(y) + y * sin(x). dim dataZ(120) as Double for yIndex as integer = 0 to UBound(datay) dim y as double = dataY(yIndex) for xIndex as integer = 0 to UBound(datax) dim x as double = dataX(xIndex) dataZ(yIndex * 11 + xIndex) = x * sin(y) + y * sin(x) next next // Create a SurfaceChart object of size 380 x 400 pixels, with white (ffffff) // background and grey (888888) border. dim c as new CDSurfaceChartMBS(f*380, f*400, &hffffff, &h888888) // Demonstrate various shading methods call c.addTitle("11 x 11 Points - Spline Fitted to 50 x 50"+EndOfLine.unix+"Smooth Shading","",12*f) c.setInterpolation(50, 50) // Set the center of the plot region at (175, 200), and set width x depth x // height to 200 x 200 x 160 pixels c.setPlotRegion(f*175, f*200, f*200, f*200, f*160) // Set the plot region wall thichness to 5 pixels c.setWallThickness(f*5) c.yAxis.setLinearScale -10,10,5 c.xAxis.setLinearScale -10,10,5 c.zAxis.setLinearScale -20,20,5 cALL c.xAxis.setLabelStyle "",8*f cALL c.yAxis.setLabelStyle "",8*f cALL c.zAxis.setLabelStyle "",8*f // Set the elevation and rotation angles to 45 and 60 degrees c.setViewAngle(45, 60) // Set the perspective level to 35 c.setPerspective(35) // Set the data to use to plot the chart c.setData(dataX, dataY,dataZ) // Set contour lines to semi-transparent black (c0000000) c.setContourColor(&hc0000000) // Output the chart w.Backdrop=c.makeChartPicture w.top=50 w.left=50 w.show w.Width=c.getWidth w.Height=c.getHeight End Sub
End Class
Class PicWindow Inherits Window
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:

Feedback, Comments & Corrections

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

The biggest plugin in space...

MBS Xojo Plugins