Spread Windows Forms 12.0 Product Documentation
XYZSurfaceSeries Constructor()
Example 


FarPoint.Win.Chart Assembly > FarPoint.Win.Chart Namespace > XYZSurfaceSeries Class > XYZSurfaceSeries Constructor : XYZSurfaceSeries Constructor()
Creates a new series.
Syntax
'Declaration
 
Public Function New()
'Usage
 
Dim instance As New XYZSurfaceSeries()
public XYZSurfaceSeries()
Example
This example creates a chart control.
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.Win.Chart.XYZSurfaceSeries series = new FarPoint.Win.Chart.XYZSurfaceSeries();
series.SeriesName = "Series 0";
for (int i = 0; i < values.GetLength(0); i++)
 {
   series.Values.Add(new FarPoint.Win.Chart.DoubleCollection());
   for (int j = 0; j < values.GetLength(1); j++)
 {
    series.Values[i].Add(values[i,j]);
  }
}

FarPoint.Win.Chart.XYZPlotArea plotArea = new FarPoint.Win.Chart.XYZPlotArea();
plotArea.Location = new PointF(0.2f, 0.2f);
plotArea.Size = new SizeF(0.6f, 0.6f);
plotArea.Series.Add(series);

FarPoint.Win.Chart.LabelArea label = new FarPoint.Win.Chart.LabelArea();
label.Text = "Surface Chart";
label.Location = new PointF(0.5f, 0.02f);
label.AlignmentX = 0.5f;
label.AlignmentY = 0.0f;
FarPoint.Win.Chart.LegendArea legend = new FarPoint.Win.Chart.LegendArea();
legend.Location = new PointF(0.98f, 0.5f);
legend.AlignmentX = 1.0f;
legend.AlignmentY = 0.5f;

FarPoint.Win.Chart.ChartModel model = new FarPoint.Win.Chart.ChartModel();
model.LabelAreas.Add(label);
model.LegendAreas.Add(legend);
model.PlotAreas.Add(plotArea);            
FarPoint.Win.Spread.Chart.SpreadChart chart = new FarPoint.Win.Spread.Chart.SpreadChart();
chart.Model = model;
chart.Size = new Size(200, 200);
chart.Location = new Point(100, 100);
chart.ViewType = FarPoint.Win.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.Win.Chart.XYZSurfaceSeries()
series.SeriesName = "Series 0"

For i = 0 To values.GetLength(0) - 1
    series.Values.Add(New FarPoint.Win.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.Win.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.Win.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.Win.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.Win.Chart.ChartModel()
model.LabelAreas.Add(label)
model.LegendAreas.Add(legend)
model.PlotAreas.Add(plotArea)
Dim chart As New FarPoint.Win.Spread.Chart.SpreadChart()
chart.Model = model
chart.ViewType = FarPoint.Win.Chart.ChartViewType.View3D
FpSpread1.Sheets(0).Charts.Add(chart)
See Also

Reference

XYZSurfaceSeries Class
XYZSurfaceSeries Members
Overload List