Profile Picture

Grid surface 2D

Posted By David Semenysin 13 Years Ago
Author
Message
David Semenysin
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 1, Visits: 1
Hello;

I would like to display an image similiar to the one in the attachment ('required 2D graph') on a 2D grid surface. The data is coming from a datagridview component

Oddly enough, I am able to display the requested graph in 3D (following one of your examples; please see image '3D graph' below). I know how to enable the draw flat feature, but not how to draw it 2D since beginning

I believe it will be trivial; just not sure where the problem is

Please see my code in the .doc document (I was trying to disable the 3D mode and play with the PredefinedProjection setting, but didn't get anywhere)

Thank you in advance for your help (I use VB.NET)

My code is below

Best Regards

David

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Private Sub _3Dluminance_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim zRange As Integer = CInt(Form1.xVal.Text)
Dim xrange As Integer = CInt(Form1.zVal.Text)

' obtain a reference to the Cartesian chart that is created by default
Dim chart As NChart = NChartControl1.Charts(0)
chart.Enable3D = True

' set aspect 1:1:1
chart.Width = 60
chart.Height = 60
chart.Depth = 60
' set projection
chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted)

' create a surface series
Dim surface As New NGridSurfaceSeries
chart.Series.Add(surface)
surface.FrameMode = SurfaceFrameMode.None

surface.Name = "Grid Surface"
surface.DrawFlat = True
surface.SmoothPalette = True

' add some data
surface.Data.SetGridSize(zRange, xrange)

Dim x As Integer
Dim y As Integer

For y = 0 To zRange
For x = 0 To xrange - 1

If y = zRange Then
x = x + 1
End If

Dim Lum As Double = Form1.CombinedBlackGridView.Rows(y).Cells(x).Value
surface.Data.SetValue(y, x, Lum)
Next
Next

End Sub

Attachments
required 2D graph.PNG (52 views, 261.00 KB)
3D graph.PNG (51 views, 209.00 KB)

Threaded View



Similar Topics


Reading This Topic