Path: C:\
<%@ language="vbscript" %>
<%
Set cd = CreateObject("ChartDirector.API")
' The x and y coordinates of the grid
dataX = Array(-2, -1, 0, 1, 2)
dataY = Array(-2, -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).
ReDim dataZ((UBound(dataX) + 1) * (UBound(dataY) + 1) - 1)
For yIndex = 0 To UBound(dataY)
y = dataY(yIndex)
For xIndex = 0 To UBound(dataX)
x = dataX(xIndex)
dataZ(yIndex * (UBound(dataX) + 1) + xIndex) = Sqr(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.
Set c = cd.SurfaceChart(380, 340, &Hffffff, &H888888)
' Demonstrate various wireframes with and without interpolation
If Request("img") = "0" Then
' Original data without interpolation
Call c.addTitle("5 x 5 Data Points<*br*>Standard Shading", "arialbd.ttf", 12)
Call c.setContourColor(&H80ffffff)
ElseIf Request("img") = "1" Then
' Original data, spline interpolated to 40 x 40 for smoothness
Call c.addTitle( _
"5 x 5 Points - Spline Fitted to 40 x 40<*br*>Standard Shading", _
"arialbd.ttf", 12)
Call c.setContourColor(&H80ffffff)
Call c.setInterpolation(40, 40)
ElseIf Request("img") = "2" Then
' Rectangular wireframe of original data
Call c.addTitle("5 x 5 Data Points<*br*>Rectangular Wireframe")
Call c.setShadingMode(cd.RectangularFrame)
ElseIf Request("img") = "3" Then
' Rectangular wireframe of original data spline interpolated to 40 x 40
Call c.addTitle( _
"5 x 5 Points - Spline Fitted to 40 x 40<*br*>Rectangular Wireframe")
Call c.setShadingMode(cd.RectangularFrame)
Call c.setInterpolation(40, 40)
ElseIf Request("img") = "4" Then
' Triangular wireframe of original data
Call c.addTitle("5 x 5 Data Points<*br*>Triangular Wireframe")
Call c.setShadingMode(cd.TriangularFrame)
Else
' Triangular wireframe of original data spline interpolated to 40 x 40
Call c.addTitle( _
"5 x 5 Points - Spline Fitted to 40 x 40<*br*>Triangular Wireframe")
Call c.setShadingMode(cd.TriangularFrame)
Call c.setInterpolation(40, 40)
End If
' Set the center of the plot region at (200, 170), and set width x depth x height to
' 200 x 200 x 150 pixels
Call c.setPlotRegion(200, 170, 200, 200, 150)
' Set the plot region wall thichness to 5 pixels
Call c.setWallThickness(5)
' Set the elevation and rotation angles to 20 and 30 degrees
Call c.setViewAngle(20, 30)
' Set the data to use to plot the chart
Call c.setData(dataX, dataY, dataZ)
' Output the chart
Response.ContentType = "image/jpeg"
Response.BinaryWrite c.makeChart2(cd.JPG)
Response.End
%>