Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

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

Screenshot for this example project.

Project "surfaceaxis.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Open() const f=2 // scale factor, 1 for screen and 4 or more for printing // The x and y coordinates of the grid dim dataX(-1) as double dataX.Append CDBaseChartMBS.chartTime(2008, 9, 1) dataX.Append CDBaseChartMBS.chartTime(2008, 9, 2) dataX.Append CDBaseChartMBS.chartTime(2008, 9, 3) dataX.Append CDBaseChartMBS.chartTime(2008, 9, 4) dataX.Append CDBaseChartMBS.chartTime(2008, 9, 5) dataX.Append CDBaseChartMBS.chartTime(2008, 9, 6) dim dataY(-1) as string = array("Low", "Medium", "High") // The data series dim lowData(-1) as double = array(24.0, 38, 33, 25, 28, 36) dim mediumData(-1) as double = array(49.0, 42, 34, 47, 53, 50) dim highData(-1) as double = array(44.0, 51, 38, 33, 47, 42) // Create a SurfaceChart object of size 760 x 500 pixels dim c as new CDSurfaceChartMBS(f*760, f*500) // Add a title to the chart using 18 points Arial font call c.addTitle("Surface Chart Axis Types", "Arial", f*18) // Set the center of the plot region at (385, 240), and set width x depth x // height to 480 x 240 x 240 pixels c.setPlotRegion(f*385,f*240, f*480, f*240, f*240) c.xAxis.setTickWidth f c.yAxis.setTickWidth f c.zAxis.setTickWidth f // Set the elevation and rotation angles to 30 and -10 degrees c.setViewAngle(30, -10) dim dataz(-1) as double dim count as integer count=UBound(lowData) for i as integer=0 to count dataz.Append lowData(i) next count=UBound(mediumData) for i as integer=0 to count dataz.Append mediumData(i) next count=UBound(highData) for i as integer=0 to count dataz.Append highData(i) next dim data2(-1) as double // Set the data to use to plot the chart. As the y-data are text strings // (enumerated), we will use an empty array for the y-coordinates. For the z data // series, they are just the concatenation of the individual data series. c.setData(dataX,data2,dataz) // Set the y-axis labels call c.yAxis.setLabels(dataY) // Set x-axis tick density to 75 pixels. ChartDirector auto-scaling will use this // as the guideline when putting ticks on the x-axis. c.xAxis.setTickDensity(75) c.zAxis.setLinearScale 20,55,5 // Spline interpolate data to a 80 x 40 grid for a smooth surface c.setInterpolation(80, 40) // Set surface grid lines to semi-transparent black (cc000000). c.setSurfaceAxisGrid(&hcc000000) // Set contour lines to the same color as the fill color at the contour level call c.setContourColor(c.kSameAsMainColor) // Add a color axis (the legend) in which the top right corner is anchored at // (95, 100). Set the length to 160 pixels and the labels on the left side. dim cAxis as CDColorAxisMBS = c.setColorAxis(f*95, f*100, c.kTopRight, f*160, c.kLeft) caxis.setWidth(10*f) caxis.setTickWidth f // Add a bounding box with light grey (eeeeee) background and grey (888888) // border. cAxis.setBoundingBox(&heeeeee, &h888888,f) // Set label style to Arial bold for all axes call c.xAxis.setLabelStyle("arialbd.ttf",f*8) call c.yAxis.setLabelStyle("arialbd.ttf",f*8) call c.zAxis.setLabelStyle("arialbd.ttf",f*8) call c.colorAxis.setLabelStyle("arialbd.ttf",f*8) // Set the x, y and z axis titles using deep blue (000088) 15 points Arial font call c.xAxis.setTitle("Date/Time Axis", "ariali.ttf", f*15, &h000088) call c.yAxis.setTitle("Label"+EndOfLine.unix+"Based"+EndOfLine.unix+"Axis", "ariali.ttf", f*15, &h000088) call c.zAxis.setTitle("Numeric Axis", "ariali.ttf", f*15, &h000088) // Output the chart Backdrop=c.makechartPicture Width=c.getWidth Height=c.getHeight 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

See also:

Feedback, Comments & Corrections

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





Links
MBS Xojo PDF Plugins