private void PositionModeComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; surface.PositionMode = (SurfacePositionMode)PositionModeComboBox.SelectedIndex; nChartControl1.Refresh(); }
private void CustomValueScroll_ValueChanged(object sender, Nevron.UI.WinForm.Controls.ScrollBarEventArgs e) { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; surface.PositionValue = customValueScroll.Value; nChartControl1.Refresh(); }
private void EnableShaderRenderingCheckBox_CheckedChanged(object sender, EventArgs e) { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; surface.EnableShaderRendering = EnableShaderRenderingCheckBox.Checked; nChartControl1.Refresh(); }
private void FillModeComboBox_SelectedIndexChanged(object sender, EventArgs e) { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; surface.FillMode = (SurfaceFillMode)FillModeComboBox.SelectedIndex; nChartControl1.Refresh(); }
private void AddData(NTriangulatedSurfaceSeries surface) { int n = data.Length; for (int i = 0; i < n; i++) { surface.XValues.Add(data[i].X); surface.ZValues.Add(data[i].Y); surface.Values.Add(data[i].H); } }
private void FillData() { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; Stream stream = null; BinaryReader reader = null; try { // fill the XYZ data from a binary resource stream = NResourceHelper.GetResourceStream(GetType().Assembly, "DataXYZ.bin", "Nevron.Examples.Chart.WinForm.Resources"); reader = new BinaryReader(stream); int nDataPointsCount = (int)stream.Length / 12; NTriangulatedSurfaceData surfaceData = surface.Data; surfaceData.SetCount(nDataPointsCount); surfaceData.UseColors = true; // fill Y values and colors for (int i = 0; i < nDataPointsCount; i++) { float y = 300 - reader.ReadSingle(); surfaceData.SetYValue(i, y); surfaceData.SetColor(i, GetColorFromValue(y)); } // fill X values for (int i = 0; i < nDataPointsCount; i++) { surfaceData.SetXValue(i, reader.ReadSingle()); } // fill Z values for (int i = 0; i < nDataPointsCount; i++) { surfaceData.SetZValue(i, reader.ReadSingle()); } } finally { if (reader != null) { reader.Close(); } if (stream != null) { stream.Close(); } } }
private void FillData() { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; Stream stream = null; BinaryReader reader = null; try { // fill the XYZ data from a binary resource stream = NResourceHelper.GetResourceStream(GetType().Assembly, "DataXYZ.bin", "Nevron.Examples.Chart.Wpf.Resources"); reader = new BinaryReader(stream); int nDataPointsCount = (int)stream.Length / 12; //surface.Data.SetCapacity(nDataPointsCount); NVector3DF[] data = new NVector3DF[nDataPointsCount]; // fill Y values for (int i = 0; i < nDataPointsCount; i++) { data[i].Y = reader.ReadSingle(); } // fill X values for (int i = 0; i < nDataPointsCount; i++) { data[i].X = reader.ReadSingle(); } // fill Z values for (int i = 0; i < nDataPointsCount; i++) { data[i].Z = reader.ReadSingle(); } for (int i = 0; i < nDataPointsCount; i++) { surface.Data.AddValue(data[i]); } } finally { if (reader != null) { reader.Close(); } if (stream != null) { stream.Close(); } } }
private void FillData() { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; Stream stream = null; BinaryReader reader = null; try { // fill the XYZ data from a binary resource string path = MapPathSecure(TemplateSourceDirectory) + "\\DataXYZ.bin"; stream = new FileStream(path, FileMode.Open, FileAccess.Read); reader = new BinaryReader(stream); int nDataPointsCount = (int)stream.Length / 12; NTriangulatedSurfaceData surfaceData = surface.Data; surfaceData.SetCount(nDataPointsCount); surfaceData.UseColors = true; // fill Y values and colors for (int i = 0; i < nDataPointsCount; i++) { float y = 300 - reader.ReadSingle(); surfaceData.SetYValue(i, y); surfaceData.SetColor(i, GetColorFromValue(y)); } // fill X values for (int i = 0; i < nDataPointsCount; i++) { surfaceData.SetXValue(i, reader.ReadSingle()); } // fill Z values for (int i = 0; i < nDataPointsCount; i++) { surfaceData.SetZValue(i, reader.ReadSingle()); } } finally { if (reader != null) { reader.Close(); } if (stream != null) { stream.Close(); } } }
private void FillData() { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; Stream stream = null; BinaryReader reader = null; try { // fill the XYZ data from a binary resource string path = MapPathSecure(TemplateSourceDirectory) + "\\DataXYZ.bin"; stream = new FileStream(path, FileMode.Open, FileAccess.Read); reader = new BinaryReader(stream); int nDataPointsCount = (int)stream.Length / 12; //surface.Data.SetCapacity(nDataPointsCount); NVector3DF[] data = new NVector3DF[nDataPointsCount]; // fill Y values for (int i = 0; i < nDataPointsCount; i++) { data[i].Y = reader.ReadSingle(); } // fill X values for (int i = 0; i < nDataPointsCount; i++) { data[i].X = reader.ReadSingle(); } // fill Z values for (int i = 0; i < nDataPointsCount; i++) { data[i].Z = reader.ReadSingle(); } surface.Data.Clear(); surface.Data.AddValues(data); } finally { if (reader != null) { reader.Close(); } if (stream != null) { stream.Close(); } } }
private void FrameModeComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; surface.FrameMode = (SurfaceFrameMode)FrameModeComboBox.SelectedIndex; nChartControl1.Refresh(); // form controls FrameColorModeComboBox.IsEnabled = (surface.FrameMode != SurfaceFrameMode.None); }
private void DrawFlatCheck_CheckedChanged(object sender, System.EventArgs e) { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; surface.DrawFlat = drawFlatCheck.Checked; nChartControl1.Refresh(); // form controls positionModeCombo.Enabled = drawFlatCheck.Checked; customValueScroll.Enabled = drawFlatCheck.Checked; }
private void DrawFlatCheckBox_Checked(object sender, System.Windows.RoutedEventArgs e) { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; surface.DrawFlat = (bool)DrawFlatCheckBox.IsChecked; // form controls PositionModeComboBox.IsEnabled = (bool)DrawFlatCheckBox.IsChecked; CustomValueScrollBar.IsEnabled = (bool)DrawFlatCheckBox.IsChecked; nChartControl1.Refresh(); }
private void PositionModeCombo_SelectedIndexChanged(object sender, System.EventArgs e) { if (nChartControl1 == null) { return; } NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; surface.PositionMode = (SurfacePositionMode)positionModeCombo.SelectedIndex; nChartControl1.Refresh(); }
private void Init() { NCartesianChart chart = (NCartesianChart)nChartControl.Charts[0]; //3d график NTriangulatedSurfaceSeries surface = new NTriangulatedSurfaceSeries(); //создаём треугольную поверхность //подключаем зум NZoomTool zt = new NZoomTool(); zt.BeginDragMouseCommand = new NMouseCommand(MouseAction.Wheel, MouseButton.Middle, 0); zt.ZoomStep = 20; //зум инструмент добавляем в контролу nChartControl.Controller.Tools.Add(zt); //доп. инструменты подключаем для управления (вращения и приближения) nChartControl.Controller.Tools.Add(new NSelectorTool()); nChartControl.Controller.Tools.Add(new NTrackballTool()); //очень важная nChartControl.Settings.JitterMode = JitterMode.Enabled; nChartControl.Settings.JitteringSteps = 1; //настройка 3d график //включаем поддержку 3d chart.Enable3D = true; chart.Width = 50; chart.Height = 50; chart.Depth = 50; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); //добавляем 3d поверхность в 3d график chart.Series.Add(surface); //настройки для поверхности surface.FrameMode = SurfaceFrameMode.Contour; //сетка или контур surface.Name = dataType; //название графика //настройка названия осей chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator.Title.Text = "Высота"; //название оси Y chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator.Title.Text = "Ширина"; //название оси X NStandardScaleConfigurator scale = (NStandardScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; chart.Axis(StandardAxis.Depth).ScaleConfigurator.Title.Text = "Долгота"; //название оси Z NStandardScaleConfigurator scaler = (NStandardScaleConfigurator)chart.Axis(StandardAxis.Depth).ScaleConfigurator; //заливка поверхности surface.FillMode = SurfaceFillMode.Zone; AddData(surface); }
private void FillData() { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; Random rand = new Random(); const int countX = 100; const int countZ = 100; NRange1DD rangeX = new NRange1DD(-10, 10); NRange1DD rangeZ = new NRange1DD(-10, 10); double stepX = rangeX.GetLength() / (countX - 1); double stepZ = rangeZ.GetLength() / (countZ - 1); double cx = -3.0; double cz = -5.0; NVector3DD[] vectorData = new NVector3DD[countZ * countX]; int index = 0; for (int n = 0; n < countZ; n++) { double z = rangeZ.Begin + n * stepZ; for (int m = 0; m < countX; m++) { double x = rangeX.Begin + m * stepX; double dx = cx - x; double dz = cz - z; double distance = Math.Sqrt(dx * dx + dz * dz); vectorData[index] = new NVector3DD(x, Math.Sin(distance) * Math.Exp(-distance * 0.1), z); index++; } } if (SimplifySurfaceCheckBox.Checked) { NPointSetSimplifier3D pointSetSimplifier3D = new NPointSetSimplifier3D(); pointSetSimplifier3D.DistanceFactor = 0.01f; vectorData = pointSetSimplifier3D.Simplify(vectorData); } surface.Data.Clear(); surface.Data.AddValues(vectorData); }
private void SmoothShadingCheck_CheckedChanged(object sender, System.EventArgs e) { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; if (smoothShadingCheck.Checked) { surface.ShadingMode = ShadingMode.Smooth; } else { surface.ShadingMode = ShadingMode.Flat; } nChartControl1.Refresh(); }
private void SmoothShadingCheckBox_Checked(object sender, System.Windows.RoutedEventArgs e) { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; if ((bool)SmoothShadingCheckBox.IsChecked) { surface.ShadingMode = ShadingMode.Smooth; } else { surface.ShadingMode = ShadingMode.Flat; } nChartControl1.Refresh(); }
private void FrameModeCombo_SelectedIndexChanged(object sender, System.EventArgs e) { if (nChartControl1 == null) { return; } NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; surface.FrameMode = (SurfaceFrameMode)frameModeCombo.SelectedIndex; nChartControl1.Refresh(); // form controls frameColorModeCombo.Enabled = (surface.FrameMode != SurfaceFrameMode.None); }
private void FillSurfaceData() { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; Stream stream = null; BinaryReader reader = null; try { // fill the XYZ data from a binary resource stream = NResourceHelper.GetResourceStream(GetType().Assembly, "DataXYZ.bin", "Nevron.Examples.Chart.WinForm.Resources"); reader = new BinaryReader(stream); int nDataPointsCount = (int)stream.Length / 12; // fill Y values for (int i = 0; i < nDataPointsCount; i++) { surface.Values.Add(reader.ReadSingle()); } // fill X values for (int i = 0; i < nDataPointsCount; i++) { surface.XValues.Add(reader.ReadSingle()); } // fill Z values for (int i = 0; i < nDataPointsCount; i++) { surface.ZValues.Add(reader.ReadSingle()); } } finally { if (reader != null) { reader.Close(); } if (stream != null) { stream.Close(); } } }
private void FrameModeCombo_SelectedIndexChanged(object sender, EventArgs e) { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; surface.FrameMode = (SurfaceFrameMode)FrameModeCombo.SelectedIndex; if (surface.FrameMode == SurfaceFrameMode.Dots) { surface.FrameStrokeStyle.Width = new NLength(2); } else { surface.FrameStrokeStyle.Width = new NLength(0.75f); } nChartControl1.Refresh(); }
private void FrameColorModeCombo_SelectedIndexChanged(object sender, System.EventArgs e) { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; switch (frameColorModeCombo.SelectedIndex) { case 0: surface.FrameColorMode = SurfaceFrameColorMode.Uniform; break; case 1: surface.FrameColorMode = SurfaceFrameColorMode.CustomColors; break; } nChartControl1.Refresh(); }
private void FrameColorModeComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; switch (FrameColorModeComboBox.SelectedIndex) { case 0: surface.FrameColorMode = SurfaceFrameColorMode.Uniform; break; case 1: surface.FrameColorMode = SurfaceFrameColorMode.Zone; break; } nChartControl1.Refresh(); }
public void generateSurface() { NCartesianChart chart; //nChartControl1.Clear(); NTriangulatedSurfaceSeries surface; NZoomTool zt = new NZoomTool(); zt.BeginDragMouseCommand = new NMouseCommand(MouseAction.Wheel, MouseButton.Middle, 0); zt.ZoomStep = 20; nChartControl1.Controller.Tools.Add(zt); nChartControl1.Controller.Tools.Add(new NSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.Settings.JitteringSteps = 1; chart = (NCartesianChart)nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = chart.Height = chart.Depth = 50; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); surface = new NTriangulatedSurfaceSeries(); chart.Series.Add(surface); surface.FrameMode = SurfaceFrameMode.Mesh; surface.FillMode = SurfaceFillMode.Zone; for (int i = 0; i < resultX.Count(); i++) { surface.XValues.Add(resultX[i]); surface.ZValues.Add(resultZ[i]); surface.Values.Add(resultY[i]); } }
private void SmoothPaletteCheckBox_Checked(object sender, System.Windows.RoutedEventArgs e) { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; if ((bool)SmoothPaletteCheckBox.IsChecked) { surface.SmoothPalette = true; surface.PaletteSteps = 7; surface.Legend.Format = "<zone_value>"; } else { surface.SmoothPalette = false; surface.PaletteSteps = 8; surface.Legend.Format = "<zone_begin> - <zone_end>"; } nChartControl1.Refresh(); }
public override void Initialize() { base.Initialize(); // Enable GPU acceleration nChartControl1.Settings.RenderSurface = RenderSurface.Window; nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Surface Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.BoundsMode = BoundsMode.Fit; chart.Width = 60.0f; chart.Depth = 60.0f; chart.Height = 10.0f; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.Projection.Elevation = 45; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft); // setup Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.RoundToTickMax = false; scaleY.RoundToTickMin = false; scaleY.MinTickDistance = new NLength(10, NGraphicsUnit.Point); scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Left, ChartWallType.Back }; scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // setup X axis NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.RoundToTickMax = false; scaleX.RoundToTickMin = false; scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back }; scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Z axis NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator(); scaleZ.RoundToTickMax = false; scaleZ.RoundToTickMin = false; scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Left }; scaleZ.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ; // add the surface series NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series.Add(SeriesType.TriangulatedSurface); surface.Name = "Surface"; surface.Legend.Mode = SeriesLegendMode.None; surface.SyncPaletteWithAxisScale = false; surface.ValueFormatter.FormatSpecifier = "0.00"; surface.FillStyle = new NColorFillStyle(Color.YellowGreen); FillData(); // apply layout ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]); // form controls fillModeCombo.SelectedIndex = 2; smoothShadingCheck.Checked = true; frameModeCombo.SelectedIndex = 0; frameColorModeCombo.SelectedIndex = 0; smoothPaletteCheck.Checked = true; positionModeCombo.SelectedIndex = 0; customValueScroll.Value = 100; }
protected void Page_Load(object sender, System.EventArgs e) { if (!nChartControl1.Initialized) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Triangulated Surface Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // hide the legend NLegend legend = nChartControl1.Legends[0]; legend.Visible = false; // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 60.0f; chart.Depth = 60.0f; chart.Height = 30.0f; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft); chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.Projection.Elevation = 30; nChartControl1.Settings.ShapeRenderingMode = ShapeRenderingMode.None; nChartControl1.Settings.EnableJittering = false; nChartControl1.Controller.SetActivePanel(chart); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // setup Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.RoundToTickMax = false; scaleY.RoundToTickMin = false; scaleY.MinTickDistance = new NLength(10, NGraphicsUnit.Point); scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Left, ChartWallType.Back }; scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // setup X axis NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.RoundToTickMax = false; scaleX.RoundToTickMin = false; scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back }; scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Z axis NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator(); scaleZ.RoundToTickMax = false; scaleZ.RoundToTickMin = false; scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Left }; scaleZ.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ; // add the surface series NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series.Add(SeriesType.TriangulatedSurface); surface.Name = "Surface"; surface.Legend.Mode = SeriesLegendMode.SeriesLogic; surface.SyncPaletteWithAxisScale = false; surface.PaletteSteps = 10; surface.ValueFormatter.FormatSpecifier = "0.00"; surface.FillStyle = new NColorFillStyle(Color.YellowGreen); FillData(); } FillData(); }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { nChartControl1.Settings.ShapeRenderingMode = ShapeRenderingMode.None; nChartControl1.Settings.JitterMode = JitterMode.Disabled; nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Triangulated Surface"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.BoundsMode = BoundsMode.Fit; chart.Width = 60.0f; chart.Depth = 60.0f; chart.Height = 10.0f; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.Projection.Elevation = 45; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft); // setup Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.RoundToTickMax = false; scaleY.RoundToTickMin = false; scaleY.MinTickDistance = new NLength(10, NGraphicsUnit.Point); scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Left, ChartWallType.Back }; scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // setup X axis NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.RoundToTickMax = false; scaleX.RoundToTickMin = false; scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back }; scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Z axis NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator(); scaleZ.RoundToTickMax = false; scaleZ.RoundToTickMin = false; scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Left }; scaleZ.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ; // add the surface series NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series.Add(SeriesType.TriangulatedSurface); surface.Name = "Surface"; surface.Legend.Mode = SeriesLegendMode.SeriesLogic; surface.SyncPaletteWithAxisScale = false; surface.ValueFormatter.FormatSpecifier = "0.00"; surface.FillStyle = new NColorFillStyle(Color.YellowGreen); FillData(); // apply layout ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]); SimplifySurfaceCheckBox.IsChecked = true; SimplifySurfaceCheckBox_Click(null, null); }
private void FillData() { if (nChartControl1 == null) { return; } NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; NTriangulatedSurfaceData surfaceData = surface.Data; if (m_SurfaceVectorData == null) { Random rand = new Random(); const int countX = 100; const int countZ = 100; NRange1DD rangeX = new NRange1DD(-10, 10); NRange1DD rangeZ = new NRange1DD(-10, 10); double stepX = rangeX.GetLength() / (countX - 1); double stepZ = rangeZ.GetLength() / (countZ - 1); double cx = -3.0; double cz = -5.0; NVector3DD[] vectorData = new NVector3DD[countZ * countX]; int index = 0; for (int n = 0; n < countZ; n++) { double z = rangeZ.Begin + n * stepZ; for (int m = 0; m < countX; m++) { double x = rangeX.Begin + m * stepX; double dx = cx - x; double dz = cz - z; double distance = Math.Sqrt(dx * dx + dz * dz); vectorData[index++] = new NVector3DD(x, Math.Sin(distance) * Math.Exp(-distance * 0.1), z); } } m_SurfaceVectorData = vectorData; } NVector3DD[] newSurfaceVectorData = m_SurfaceVectorData;; if (SimplifySurfaceCheckBox.IsChecked.Value) { NPointSetSimplifier3D simplifier = new NPointSetSimplifier3D(); simplifier.DistanceFactor = 0.01; newSurfaceVectorData = simplifier.Simplify(newSurfaceVectorData); } surfaceData.Clear(); surfaceData.AddValues(newSurfaceVectorData); nChartControl1.Refresh(); }
public override void Initialize() { base.Initialize(); // Enable GPU acceleration nChartControl1.Settings.RenderSurface = RenderSurface.Window; nChartControl1.Settings.ShapeRenderingMode = ShapeRenderingMode.None; nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Realtime Triangulation"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // remove legends nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 50; chart.Depth = 50; chart.Height = 30; chart.BoundsMode = BoundsMode.Fit; chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalTop); for (int i = 0; i < chart.Walls.Count; i++) { ((NChartWall)chart.Walls[i]).Visible = false; } // setup Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.RoundToTickMax = false; scaleY.RoundToTickMin = false; scaleY.MinTickDistance = new NLength(10, NGraphicsUnit.Point); scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Left, ChartWallType.Back }; scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // setup X axis NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.RoundToTickMax = false; scaleX.RoundToTickMin = false; scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back }; scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Z axis NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator(); scaleZ.RoundToTickMax = false; scaleZ.RoundToTickMin = false; scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Left }; scaleZ.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ; // add the surface series NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series.Add(SeriesType.TriangulatedSurface); m_Surface = surface; surface.Name = "Surface"; surface.SyncPaletteWithAxisScale = false; surface.ValueFormatter.FormatSpecifier = "0.00"; surface.FillStyle = new NColorFillStyle(Color.YellowGreen); surface.PaletteSteps = 8; surface.FillMode = SurfaceFillMode.Zone; surface.FrameMode = SurfaceFrameMode.Mesh; surface.ShadingMode = ShadingMode.Flat; // apply layout ConfigureStandardLayout(chart, title, null); EnableShaderRenderingCheckBox.Checked = true; FillModeComboBox.FillFromEnum(typeof(SurfaceFillMode)); FillModeComboBox.SelectedIndex = (int)SurfaceFillMode.ZoneTexture;; FrameModeCombo.FillFromEnum(typeof(SurfaceFrameMode)); FrameModeCombo.SelectedIndex = (int)SurfaceFrameMode.Mesh; GridSizeComboBox.Items.Add("10x10"); GridSizeComboBox.Items.Add("100x100"); GridSizeComboBox.Items.Add("200x200"); GridSizeComboBox.Items.Add("500x500"); GridSizeComboBox.SelectedIndex = 0; timer1.Start(); }
public override void Initialize() { base.Initialize(); nChartControl1.Settings.RenderSurface = RenderSurface.Window; nChartControl1.Controller.Tools.Clear(); nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Triangulated Surface"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.BoundsMode = BoundsMode.Fit; chart.Width = 60.0f; chart.Depth = 60.0f; chart.Height = 10.0f; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.Projection.Elevation = 45; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft); // setup Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.RoundToTickMax = false; scaleY.RoundToTickMin = false; scaleY.MinTickDistance = new NLength(10, NGraphicsUnit.Point); scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Left, ChartWallType.Back }; scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // setup X axis NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.RoundToTickMax = false; scaleX.RoundToTickMin = false; scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back }; scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Z axis NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator(); scaleZ.RoundToTickMax = false; scaleZ.RoundToTickMin = false; scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Left }; scaleZ.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ; // add the surface series NTriangulatedSurfaceSeries surface = new NTriangulatedSurfaceSeries(); chart.Series.Add(surface); surface.ShadingMode = ShadingMode.Smooth; surface.FillMode = SurfaceFillMode.ZoneTexture; surface.FrameMode = SurfaceFrameMode.None; // define a custom palette surface.Palette.Clear(); surface.Palette.Add(0, DarkOrange); surface.Palette.Add(60, LightOrange); surface.Palette.Add(100, LightGreen); surface.Palette.Add(140, Turqoise); surface.Palette.Add(180, Blue); surface.Palette.Add(220, Purple); surface.Palette.Add(250, BeautifulRed); FillSurfaceData(); // apply layout ConfigureStandardLayout(chart, title, null); // form controls paletteModeCombo.SelectedIndex = 0; paletteStepsCombo.SelectedIndex = 6; smoothPaletteCheck.Checked = false; }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Triangulated Surface Isolines"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.BoundsMode = BoundsMode.Fit; chart.Width = 60.0f; chart.Depth = 60.0f; chart.Height = 10.0f; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.Projection.Elevation = 45; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft); // setup Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.RoundToTickMax = false; scaleY.RoundToTickMin = false; scaleY.MinTickDistance = new NLength(10, NGraphicsUnit.Point); scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Left, ChartWallType.Back }; scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // setup X axis NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.RoundToTickMax = false; scaleX.RoundToTickMin = false; scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back }; scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Z axis NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator(); scaleZ.RoundToTickMax = false; scaleZ.RoundToTickMin = false; scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Left }; scaleZ.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ; // add the surface series NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series.Add(SeriesType.TriangulatedSurface); surface.Name = "Surface"; surface.Legend.Mode = SeriesLegendMode.None; surface.SyncPaletteWithAxisScale = false; surface.ValueFormatter.FormatSpecifier = "0.00"; surface.FrameMode = SurfaceFrameMode.None; surface.Palette.SmoothPalette = true; surface.FillStyle = new NColorFillStyle(Color.YellowGreen); FillData(); // add the isolines NSurfaceIsoline redIsoline = new NSurfaceIsoline(); redIsoline.StrokeStyle = new NStrokeStyle(2.0f, Color.Red); redIsoline.Value = 100; surface.Isolines.Add(redIsoline); NSurfaceIsoline blueIsoline = new NSurfaceIsoline(); blueIsoline.StrokeStyle = new NStrokeStyle(2.0f, Color.Blue); blueIsoline.Value = 50; surface.Isolines.Add(blueIsoline); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { //Setup dropdown lists and check boxes states. fillModeDropDownList.Items.Add("None"); fillModeDropDownList.Items.Add("Uniform"); fillModeDropDownList.Items.Add("Custom Colors"); fillModeDropDownList.SelectedIndex = 2; frameModeDropDownList.Items.Add("None"); frameModeDropDownList.Items.Add("Mesh"); frameModeDropDownList.Items.Add("Contour"); frameModeDropDownList.Items.Add("Mesh-Contour"); frameModeDropDownList.Items.Add("Dots"); frameModeDropDownList.SelectedIndex = 0; frameColorModeDropDownList.Items.Add("Uniform"); frameColorModeDropDownList.Items.Add("Custom Colors"); frameColorModeDropDownList.SelectedIndex = 0; smoothShadingCheck.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Triangulated Surface with Custom Colors"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // remove legends nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 60.0f; chart.Depth = 60.0f; chart.Height = 10.0f; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft); chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.Projection.Elevation = 45; // setup Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.RoundToTickMax = false; scaleY.RoundToTickMin = false; scaleY.MinTickDistance = new NLength(10, NGraphicsUnit.Point); scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Left, ChartWallType.Back }; scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // setup X axis NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.RoundToTickMax = false; scaleX.RoundToTickMin = false; scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back }; scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Z axis NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator(); scaleZ.RoundToTickMax = false; scaleZ.RoundToTickMin = false; scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Left }; scaleZ.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ; // add the surface series NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series.Add(SeriesType.TriangulatedSurface); surface.Name = "Surface"; surface.SyncPaletteWithAxisScale = false; surface.ValueFormatter.FormatSpecifier = "0.00"; surface.FillStyle = new NColorFillStyle(Color.YellowGreen); surface.PaletteSteps = 8; surface.FillMode = SurfaceFillMode.CustomColors; surface.FrameMode = SurfaceFrameMode.None; surface.FrameColorMode = SurfaceFrameColorMode.CustomColors; surface.ShadingMode = ShadingMode.Smooth; FillData(); if (smoothShadingCheck.Checked) { surface.ShadingMode = ShadingMode.Smooth; } else { surface.ShadingMode = ShadingMode.Flat; } switch (fillModeDropDownList.SelectedIndex) { case 0: surface.FillMode = SurfaceFillMode.None; smoothShadingCheck.Enabled = false; break; case 1: surface.FillMode = SurfaceFillMode.Uniform; smoothShadingCheck.Enabled = true; break; case 2: surface.FillMode = SurfaceFillMode.CustomColors; smoothShadingCheck.Enabled = true; break; } surface.FrameMode = (SurfaceFrameMode)frameModeDropDownList.SelectedIndex; frameColorModeDropDownList.Enabled = (surface.FrameMode != SurfaceFrameMode.None); switch (frameColorModeDropDownList.SelectedIndex) { case 0: surface.FrameColorMode = SurfaceFrameColorMode.Uniform; break; case 1: surface.FrameColorMode = SurfaceFrameColorMode.CustomColors; break; } // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
/*Построение 3д графика*/ public void Draw3D(bool exp) { mainForm.nChartControl1.Clear(); mainForm.nChartControl1.Controller.Tools.Add(new NSelectorTool()); mainForm.nChartControl1.Controller.Tools.Add(new NTrackballTool()); mainForm.nChartControl1.Legends[0].Mode = LegendMode.Disabled; var chart = (NCartesianChart)mainForm.nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 60; chart.Depth = 60; chart.Height = 35; chart.Projection.Type = ProjectionType.Perspective; chart.Projection.Elevation = 30; chart.Projection.Rotation = -60; chart.BoundsMode = BoundsMode.Fit; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.None); var scaleConfiguratorY1 = (NStandardScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleConfiguratorY1.Title.Text = mainForm.dgwExperiment.Columns[mainForm.dgwExperiment.ColumnCount - 1].HeaderText; scaleConfiguratorY1.Title.TextStyle = new NTextStyle(new Font("Microsoft Sans Serif", 10, FontStyle.Bold)); scaleConfiguratorY1.LabelStyle.TextStyle = new NTextStyle(new Font("Microsoft Sans Serif", 10, FontStyle.Bold)); var scaleConfiguratorX1 = (NStandardScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; scaleConfiguratorX1.Title.Text = ""; scaleConfiguratorX1.Title.TextStyle = new NTextStyle(new Font("Microsoft Sans Serif", 10, FontStyle.Bold)); scaleConfiguratorX1.LabelStyle.TextStyle = new NTextStyle(new Font("Microsoft Sans Serif", 10, FontStyle.Bold)); var scaleConfiguratorDepth1 = (NStandardScaleConfigurator)chart.Axis(StandardAxis.Depth).ScaleConfigurator; scaleConfiguratorDepth1.Title.Text = ""; scaleConfiguratorDepth1.Title.TextStyle = new NTextStyle(new Font("Microsoft Sans Serif", 10, FontStyle.Bold)); scaleConfiguratorDepth1.LabelStyle.TextStyle = new NTextStyle(new Font("Microsoft Sans Serif", 10, FontStyle.Bold)); var triangulatedSurface = new NTriangulatedSurfaceSeries(); chart.Series.Add(triangulatedSurface); triangulatedSurface.AutomaticPalette = true; triangulatedSurface.SyncPaletteWithAxisScale = false; triangulatedSurface.PaletteSteps = 8; triangulatedSurface.FillMode = SurfaceFillMode.Uniform; triangulatedSurface.FrameMode = SurfaceFrameMode.Mesh; triangulatedSurface.ShadingMode = ShadingMode.Smooth; resultForm.dataGridView1.Rows.Clear(); resultForm.dataGridView1.Columns.Clear(); int factorCount = mainForm.dgwExperiment.ColumnCount - 1; double staticValue = 0; double firstMin = Convert.ToDouble(mainForm.graphSettings.txtFirstParamMin.Text); double firstMax = Convert.ToDouble(mainForm.graphSettings.txtFirstParamMax.Text); double firstStep = Convert.ToDouble(mainForm.graphSettings.txtStepChart.Text); double secondMin = Convert.ToDouble(mainForm.graphSettings.txtSecondParamMin.Text); double secondMax = Convert.ToDouble(mainForm.graphSettings.txtSecondParamMax.Text); double secondStep = Convert.ToDouble(mainForm.graphSettings.txtStepChart2.Text); resultForm.dataGridView1.Columns.Clear(); if (factorCount > 2) { staticValue = Convert.ToDouble(mainForm.graphSettings.staticValue.Text); } int indexFirst = -1; int indexSecond = -1; for (int f = 0; f < factorCount; f++) { if (mainForm.dgwExperiment.Columns[f].HeaderCell.Value.ToString() == mainForm.graphSettings.cmbFirstParam.Text) { indexFirst = f; scaleConfiguratorX1.Title.Text = mainForm.dgwExperiment.Columns[f].HeaderCell.Value.ToString(); } if (mainForm.dgwExperiment.Columns[f].HeaderCell.Value.ToString() == mainForm.graphSettings.cmbSecondParam.Text) { indexSecond = f; scaleConfiguratorDepth1.Title.Text = mainForm.dgwExperiment.Columns[f].HeaderCell.Value.ToString(); } } bool setr = false; int c = 0; int r = 0; for (double i = firstMin; i < firstMax + firstStep; i += firstStep) { if (i > firstMax - firstStep) { i = firstMax; } resultForm.dataGridView1.Columns.Add(i.ToString(), i.ToString()); r = 0; for (double j = secondMin; j < secondMax + secondStep; j += secondStep) { if (j > secondMax - secondStep) { j = secondMax; } double[] data = new double[factorCount]; for (int k = 0; k < data.Length; k++) { if (k == indexFirst) { data[k] = i; } if (k == indexSecond) { data[k] = j; } if (k != indexFirst && k != indexSecond) { data[k] = staticValue; } } double yPoint = Ymath(data); triangulatedSurface.XValues.Add(i); triangulatedSurface.ZValues.Add(j); triangulatedSurface.Values.Add(yPoint); if (!setr) { resultForm.dataGridView1.Rows.Add(); resultForm.dataGridView1.Rows[r].HeaderCell.Value = j.ToString(); } resultForm.dataGridView1.Rows[r].Cells[c].Value = Math.Round(yPoint, numFromPoint).ToString().Replace(".", ","); r++; } setr = true; c++; } if (exp) { mainForm.DrawExpPoints3D(indexFirst, indexSecond); } resultForm.dataGridView1.TopLeftHeaderCell.Value = "x2 \\ x1"; }