Platforms to show: All Mac Windows Linux Cross-Platform
/ChartDirector/High Resolution Chart Examples/surfacewireframe
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/surfacewireframe
This example is the version from Sun, 17th Mar 2012.
Project "surfacewireframe.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
createChart(0, "surfacewireframe")
End EventHandler
Protected Sub CreateChart(img as integer, filename as string)
const f=3 // 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(-2.0, -1, 0, 1, 2)
dim dataY(-1) as double = array(-2.0, -1, 0, 1, 2)
// The values at the grid points. In this example, we will compute the values
// using the formula z = square_root(15 - x * x - y * y).
dim dataZ(24) 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 * 5 + xIndex) = sqrt(15 - x * x - y * y)
next
next
// Create a SurfaceChart object of size 380 x 340 pixels, with white (ffffff)
// background and grey (888888) border.
dim c as new CDSurfaceChartMBS(f*380, f*340, &hffffff, &h888888)
// Demonstrate various wireframes with and without interpolation
// Triangular wireframe of original data spline interpolated to 40 x 40
call c.addTitle("5 x 5 Points - Spline Fitted to 40 x 40"+EndOfLine.unix+"Triangular Wireframe","",f*12)
c.setShadingMode(CDSurfaceChartMBS.kTriangularFrame)
c.setInterpolation(40, 40)
// Set the center of the plot region at (200, 170), and set width x depth x
// height to 200 x 200 x 150 pixels
c.setPlotRegion(f*200, f*170, f*200, f*200, f*150)
// Set the plot region wall thichness to 5 pixels
c.setWallThickness(f*5)
c.xAxis.setLinearScale -2,2,1
c.yAxis.setLinearScale -2,2,1
c.zAxis.setLinearScale 2.6,4.0,0.2
call c.xAxis.setLabelStyle "",f*8
call c.yAxis.setLabelStyle "",f*8
call c.zAxis.setLabelStyle "",f*8
c.xAxis.setTickWidth f
c.yAxis.setTickWidth f
c.zAxis.setTickWidth f
// Set the elevation and rotation angles to 20 and 30 degrees
c.setViewAngle(20, 30)
// Set the data to use to plot the chart
c.setData(dataX, dataY, dataZ)
// 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:
- /ChartDirector/High Resolution Chart Examples/cone
- /ChartDirector/High Resolution Chart Examples/contour
- /ChartDirector/High Resolution Chart Examples/legendpie2
- /ChartDirector/High Resolution Chart Examples/multivmeter
- /ChartDirector/High Resolution Chart Examples/polarbubble
- /ChartDirector/High Resolution Chart Examples/polarzones
- /ChartDirector/High Resolution Chart Examples/smallsectorpie
- /ChartDirector/High Resolution Chart Examples/surfaceaxis
- /ChartDirector/High Resolution Chart Examples/surfaceshading
- /ChartDirector/High Resolution Chart Examples/threeddonutshading
The items on this page are in the following plugins: MBS ChartDirector Plugin.