int count0 = 30;
int count1 = 30;
double y, x, z;
double[,] values = new double[count0, count1];
const double interval0 = 30.0;
const double interval1 = 30.0;
double increment0 = (interval0 / count0);
double increment1 = (interval1 / count1);
z = -(interval0 / 2);
for(int i = 0; i < count0; i++, z += increment0)
{
x = -(interval1 / 2);
for(int j = 0; j < count1; j++, x += increment1)
{
y = (x * x) - (z * z);
y += 200 * Math.Sin(x / 4.0) * Math.Cos(z / 4.0);
values[i, j] = y;
}
}
FarPoint.Web.Chart.XYZSurfaceSeries series = new FarPoint.Web.Chart.XYZSurfaceSeries();
series.SeriesName = "Series 0";
for (int i = 0; i < values.GetLength(0); i++)
{
series.Values.Add(new FarPoint.Web.Chart.DoubleCollection());
for (int j = 0; j < values.GetLength(1); j++)
{
series.Values[i].Add(values[i,j]);
}
}
FarPoint.Web.Chart.XYZPlotArea plotArea = new FarPoint.Web.Chart.XYZPlotArea();
plotArea.Location = new PointF(0.2f, 0.2f);
plotArea.Size = new SizeF(0.6f, 0.6f);
plotArea.Series.Add(series);
FarPoint.Web.Chart.LabelArea label = new FarPoint.Web.Chart.LabelArea();
label.Text = "Surface Chart";
label.Location = new PointF(0.5f, 0.02f);
label.AlignmentX = 0.5f;
label.AlignmentY = 0.0f;
FarPoint.Web.Chart.LegendArea legend = new FarPoint.Web.Chart.LegendArea();
legend.Location = new PointF(0.98f, 0.5f);
legend.AlignmentX = 1.0f;
legend.AlignmentY = 0.5f;
FarPoint.Web.Chart.ChartModel model = new FarPoint.Web.Chart.ChartModel();
model.LabelAreas.Add(label);
model.LegendAreas.Add(legend);
model.PlotAreas.Add(plotArea);
FarPoint.Web.Spread.Chart.SpreadChart chart = new FarPoint.Web.Spread.Chart.SpreadChart();
chart.Model = model;
chart.ViewType = FarPoint.Web.Chart.ChartViewType.View3D;
fpSpread1.Sheets[0].Charts.Add(chart);
Dim count0 As Integer = 30
Dim count1 As Integer = 30
Dim y As Double, x As Double, z As Double
Dim values As Double(,) = New Double(count0 - 1, count1 - 1) {}
Const interval0 As Double = 30.0R
Const interval1 As Double = 30.0R
Dim increment0 As Double = (interval0 / count0)
Dim increment1 As Double = (interval1 / count1)
z = -(interval0 / 2)
Dim i As Integer = 0
While i < count0
x = -(interval1 / 2)
Dim j As Integer = 0
While j < count1
y = (x * x) - (z * z)
y += 200 * Math.Sin(x / 4.0R) * Math.Cos(z / 4.0R)
values(i, j) = y
j += 1
x += increment1
End While
i += 1
z += increment0
End While
Dim series As New FarPoint.Web.Chart.XYZSurfaceSeries()
series.SeriesName = "Series 0"
For i = 0 To values.GetLength(0) - 1
series.Values.Add(New FarPoint.Web.Chart.DoubleCollection())
For j As Integer = 0 To values.GetLength(1) - 1
series.Values(i).Add(values(i, j))
Next
Next
Dim plotArea As New FarPoint.Web.Chart.XYZPlotArea()
plotArea.Location = New System.Drawing.PointF(0.2F, 0.2F)
plotArea.Size = New System.Drawing.SizeF(0.6F, 0.6F)
plotArea.Series.Add(series)
Dim label As New FarPoint.Web.Chart.LabelArea()
label.Text = "Surface Chart"
label.Location = New System.Drawing.PointF(0.5F, 0.02F)
label.AlignmentX = 0.5F
label.AlignmentY = 0.0F
Dim legend As New FarPoint.Web.Chart.LegendArea()
legend.Location = New System.Drawing.PointF(0.98F, 0.5F)
legend.AlignmentX = 1.0F
legend.AlignmentY = 0.5F
Dim model As New FarPoint.Web.Chart.ChartModel()
model.LabelAreas.Add(label)
model.LegendAreas.Add(legend)
model.PlotAreas.Add(plotArea)
Dim chart As New FarPoint.Web.Spread.Chart.SpreadChart()
chart.Model = model
chart.ViewType = FarPoint.Web.Chart.ChartViewType.View3D
FpSpread1.Sheets(0).Charts.Add(chart)