Help on coding 3d surface mesh chart


Author
Message
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,
Yes - you can use:
xScale.InflateContentRange = false;


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
https://www.nevron.com/forum/uploads/images/ddf36aa9-ad9a-40a3-bc10-2c0.jpeg
By any chance, is there any way to remove the white spaces around the chart ?
Blagovest Milanov
Blagovest Milanov
Supreme Being (148 reputation)Supreme Being (148 reputation)Supreme Being (148 reputation)Supreme Being (148 reputation)Supreme Being (148 reputation)Supreme Being (148 reputation)Supreme Being (148 reputation)Supreme Being (148 reputation)Supreme Being (148 reputation)
Group: Forum Members
Posts: 154, Visits: 15
Hi,
The grid surface series does not support data labels directly for performance reasons. However you can mix the grid surface series with several invisible bar series that are used to show those labels - for example the following code shows how to create several invisible bar series that show up only value labels:

NChart chart = nChartControl1.Charts[0];
chart.Enable3D = true;
chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
chart.Width = chart.Height = chart.Depth = 50;

NOrdinalScaleConfigurator xScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;
xScale.AutoLabels = false;
xScale.Labels.Add("A");
xScale.Labels.Add("B");
xScale.Labels.Add("C");

NOrdinalScaleConfigurator yScale = chart.Axis(StandardAxis.Depth).ScaleConfigurator as NOrdinalScaleConfigurator;
yScale.AutoLabels = false;
yScale.Labels.Add("X");
yScale.Labels.Add("Y");
yScale.Labels.Add("Z");

NBarSeries bar1 = new NBarSeries();
bar1.Values.Add(10);
bar1.Values.Add(20);
bar1.Values.Add(30);
bar1.FillStyle = new NColorFillStyle(Color.Transparent);
bar1.BorderStyle.Width = new NLength(0);
chart.Series.Add(bar1);

NBarSeries bar2 = new NBarSeries();
bar2.Values.Add(12);
bar2.Values.Add(22);
bar2.Values.Add(32);
bar2.FillStyle = new NColorFillStyle(Color.Transparent);
bar2.BorderStyle.Width = new NLength(0);
chart.Series.Add(bar2);

NBarSeries bar3 = new NBarSeries();
bar3.Values.Add(15);
bar3.Values.Add(25);
bar3.Values.Add(35);
bar3.FillStyle = new NColorFillStyle(Color.Transparent);
bar3.BorderStyle.Width = new NLength(0);
chart.Series.Add(bar3);

Hope this helps - let us know if you meet any problems or have any questions.
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
I would like the Z-values to show up above each data point in the surface chart like how the value shows up in the bar chart in my previous reply.
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,
Yes it applies to surface charts - in fact the code applies to any type of chart which uses an ordinal axis. By default the x and depth axes are configured as ordinal so the code is the same.

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 if i like to label the z value of a surface chart like the one i did in the previous replies? Does the chart control provide the same label functionality for surface chart? Thank you.
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 Lian,
Yes sure - the following code shows how to display a chart similar to the one you attached:

   NChart chart = nChartControl1.Charts[0];
   chart.Enable3D = true;
   chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
   chart.Width = chart.Height = chart.Depth = 50;

   NOrdinalScaleConfigurator xScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;
   xScale.AutoLabels = false;
   xScale.Labels.Add("A");
   xScale.Labels.Add("B");
   xScale.Labels.Add("C");

   NOrdinalScaleConfigurator yScale = chart.Axis(StandardAxis.Depth).ScaleConfigurator as NOrdinalScaleConfigurator;
   yScale.AutoLabels = false;
   yScale.Labels.Add("X");
   yScale.Labels.Add("Y");
   yScale.Labels.Add("Z");

   NBarSeries bar1 = new NBarSeries();
   bar1.Values.Add(10);
   bar1.Values.Add(20);
   bar1.Values.Add(30);
   chart.Series.Add(bar1);

   NBarSeries bar2 = new NBarSeries();
   bar2.Values.Add(12);
   bar2.Values.Add(22);
   bar2.Values.Add(32);
   chart.Series.Add(bar2);

   NBarSeries bar3 = new NBarSeries();
   bar3.Values.Add(15);
   bar3.Values.Add(25);
   bar3.Values.Add(35);
   chart.Series.Add(bar3);

   NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Bright).Apply(nChartControl1.Document);

Hope this helps - let us know if you 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
Is there any way to create a label to show the z value of each sensor like the picture below as I want to see the changing value over time. Thank you.
https://www.nevron.com/forum/uploads/images/2864d6b4-7395-4656-9e43-ce7c.png


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,
Currently the code will add a new surface series to each timer tick - what you need to ensure is that the chart contains only one surface series and then clear / update the data - for example:

   NGridSurfaceSeries surface = null;

   if (chart.Series.Count > 0)
   {
    surface = chart.Series[0] as NGridSurfaceSeries;
   }
   
   if (surface == null)
   {
     surface = (NGridSurfaceSeries)chart.Series.Add(SeriesType.GridSurface);
   }

then after you're done updating the data you need to call:
nChartControl.Refresh();

There is no need to call refresh on a separate timer. 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
I did put the surface.data.clear() as below to clear the surface series. Somehow , the chart is still replicating. 


For refreshing the chart, I have a timer for counting the refresh interval.


So far from my understanding, the chart is created once more every time it refreshes. The surface.data.clear command doesn't seem to be working.

File attached is the codes i have for my project. Hope you can give some guidances on fixing this issue. Thank you.






Attachments
code.txt (402 views, 59.00 KB)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search