Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

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/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() // 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(760, 500) // Add a title to the chart using 18 points Arial font call c.addTitle("Surface Chart Axis Types", "Arial", 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(385, 240, 480, 240, 240) // 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) // 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(95, 100, c.kTopRight, 160, c.kLeft) // Add a bounding box with light grey (eeeeee) background and grey (888888) // border. cAxis.setBoundingBox(&heeeeee, &h888888) // Set label style to Arial bold for all axes call c.xAxis.setLabelStyle("arialbd.ttf") call c.yAxis.setLabelStyle("arialbd.ttf") call c.zAxis.setLabelStyle("arialbd.ttf") call c.colorAxis.setLabelStyle("arialbd.ttf") // 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", 15, &h000088) call c.yAxis.setTitle("Label"+EndOfLine.unix+"Based"+EndOfLine.unix+"Axis", "ariali.ttf", 15, &h000088) call c.zAxis.setTitle("Numeric Axis", "ariali.ttf", 15, &h000088) // 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

See also:

Feedback, Comments & Corrections

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

MBS Xojo blog