Help on coding 3d surface mesh chart


Author
Message
lian jia jie
lian jia jie
Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)
Group: Forum Members
Posts: 8, Visits: 89
Doing a project of a 3d surface chart to show the changing temperature from several sensors. The temperature data is retrieved from MySql database.  

I need help on manually assign the sensor data on certain coordinate. Eg. [x1,y1] - sensor1 , [x2,y1] -sensor 2, [x1,y2] - sensor3, [x2,y2]-sensor 4 , etc...
Any sample coding or guidance is appreciated.
Replies
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

Hi,
We think that in this case it will be more appropriate to use the grid surface (as the distance on the x/z plane are always equal and the cells form a grid). The following code shows how to configure a grid surface chart and pass some sample data:

using Nevron.Chart;
using Nevron.Chart.Windows;
using Nevron.GraphicsCore;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace GridSurface
{
 public partial class Form1 : Form
 {
  public Form1()
  {
   InitializeComponent();
  }

  private void Form1_Load(object sender, EventArgs e)
  {
   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("Surface Chart");
   title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
   title.TextStyle.FillStyle = new NColorFillStyle(Color.Gray);

   // setup chart
   NChart chart = nChartControl1.Charts[0];
   chart.Enable3D = true;
   chart.Width = 60.0f;
   chart.Depth = 60.0f;
   chart.Height = 25.0f;
   chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
   chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft);

   // setup axes
   NOrdinalScaleConfigurator ordinalScale = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;
   ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
   ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
   ordinalScale.DisplayDataPointsBetweenTicks = false;

   ordinalScale = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.Depth).ScaleConfigurator;
   ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
   ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true);
   ordinalScale.DisplayDataPointsBetweenTicks = false;

   // add the surface series
   NGridSurfaceSeries surface = (NGridSurfaceSeries)chart.Series.Add(SeriesType.GridSurface);
   surface.Name = "Surface";
   surface.Legend.Mode = SeriesLegendMode.SeriesLogic;
   surface.SyncPaletteWithAxisScale = false;
   surface.PaletteSteps = 8;
   surface.ValueFormatter.FormatSpecifier = "0.00";

   surface.Data.SetGridSize(3, 3);
   surface.Data.SetValue(0, 0, 0);
   surface.Data.SetValue(0, 1, 0);
   surface.Data.SetValue(0, 2, 0);

   surface.Data.SetValue(1, 0, 0);
   surface.Data.SetValue(1, 1, 10);
   surface.Data.SetValue(1, 2, 0);

   surface.Data.SetValue(2, 0, 0);
   surface.Data.SetValue(2, 1, 0);
   surface.Data.SetValue(2, 2, 0);

  }
 }
}


You can also take a look at the examples shipped with the control. Take a look at the following examples -
All Examples \ Chart Gallery \ Grid Surface
All Examples \ Chart Gallery \ Mesh Surface
All Examples \ Chart Gallery \ Triangulated Surface

Hope this helps - let us know if you meet any problems or have any questions.



Best Regards,
Nevron Support Team


lian jia jie
lian jia jie
Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)
Group: Forum Members
Posts: 8, Visits: 89
What code to be added so that the chart will clear the series and refresh the data?
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi,
You need to call the Clear method of the surface data, update the values and then refresh the control - for example:

 // sets all values to 0
   surface.Data.Clear();

   // update data
   surface.Data.SetGridSize(3, 3);
   surface.Data.SetValue(1, 1, 11);
  
// refresh image
   nChartControl1.Refresh();

Let us know if you meet any problems.

Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
lian jia jie - 8 Years Ago
Nevron Support - 8 Years Ago
lian jia jie - 8 Years Ago
Nevron Support - 8 Years Ago
lian jia jie - 8 Years Ago
                         Hi, You need to call the Clear method of the surface data, update the...
Nevron Support - 8 Years Ago
lian jia jie - 8 Years Ago
Nevron Support - 8 Years Ago
lian jia jie - 8 Years Ago
Nevron Support - 8 Years Ago
lian jia jie - 8 Years Ago
Nevron Support - 8 Years Ago
lian jia jie - 8 Years Ago
Blagovest Milanov 1 - 8 Years Ago
lian jia jie - 7 Years Ago
Nevron Support - 7 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search