Hi Bruce,
Attached is some VB code that will hopefully solve your problem.
Best Regards,
Milen
----------------------------------------------------------------------------
Imports Nevron.GraphicsCore
Imports Nevron.Chart
Imports Nevron.Chart.WinForm
Public Class Form1
Dim rand As New Random
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim chart As NChart = NChartControl1.Charts(0)
chart.Axis(StandardAxis.Depth).Visible = True
chart.Enable3D = True
chart.BoundsMode = BoundsMode.Fit
chart.Width = 60
chart.Height = 60
chart.Depth = 60
chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective)
chart.Wall(ChartWallType.Left).Visible = False
chart.Wall(ChartWallType.Back).Visible = False
NChartControl1.Controller.Selection.Add(chart)
NChartControl1.Controller.Tools.Add(New NTrackballTool())
Dim axisX As NAxis = chart.Axis(StandardAxis.PrimaryX)
Dim axisY As NAxis = chart.Axis(StandardAxis.PrimaryY)
Dim axisZ As NAxis = chart.Axis(StandardAxis.Depth)
axisX.View = New NRangeAxisView(New NRange1DD(-10, 50), True, True)
axisY.View = New NRangeAxisView(New NRange1DD(-10, 50), True, True)
axisZ.View = New NRangeAxisView(New NRange1DD(-10, 50), True, True)
Dim scaleX As NLinearScaleConfigurator = New NLinearScaleConfigurator()
scaleX.RoundToTickMin = False
scaleX.RoundToTickMax = False
axisX.ScaleConfigurator = scaleX
Dim scaleY As NLinearScaleConfigurator = New NLinearScaleConfigurator()
scaleY.RoundToTickMin = False
scaleY.RoundToTickMax = False
axisY.ScaleConfigurator = scaleY
Dim scaleZ As NLinearScaleConfigurator = New NLinearScaleConfigurator()
scaleZ.RoundToTickMin = False
scaleZ.RoundToTickMax = False
axisZ.ScaleConfigurator = scaleZ
CreateBaseLine(0, 0, 0, 40, 20, 35)
End Sub
Private Sub CreateBaseLine(ByVal x1 As Double, ByVal y1 As Double, ByVal z1 As Double, ByVal x2 As Double, ByVal y2 As Double, ByVal z2 As Double)
Dim chart As NChart = NChartControl1.Charts(0)
Dim line As New NLineSeries
chart.Series.Clear()
chart.Series.Add(line)
line.LineSegmentShape = LineSegmentShape.Line
line.DataLabelStyle.Visible = False
line.Legend.Mode = SeriesLegendMode.None
line.InflateMargins = False
line.UseXValues = True
line.UseZValues = True
line.FillStyle = New NColorFillStyle(Color.Crimson)
line.BorderStyle.Color = Color.Crimson
line.MarkerStyle.Visible = False
line.LineSegmentShape = LineSegmentShape.Tube
line.LineSize = New NLength(3, NRelativeUnit.ParentPercentage)
Dim marker As New NMarkerStyle
marker.Visible = True
marker.Width = New NLength(4, NRelativeUnit.ParentPercentage)
marker.Height = New NLength(4, NRelativeUnit.ParentPercentage)
marker.Depth = New NLength(4, NRelativeUnit.ParentPercentage)
marker.AutoDepth = False
marker.PointShape = PointShape.Sphere
line.MarkerStyles(0) = marker
line.XValues.Add(x1)
line.Values.Add(y1)
line.ZValues.Add(z1)
line.XValues.Add(x2)
line.Values.Add(y2)
line.ZValues.Add(z2)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim chart As NChart = NChartControl1.Charts(0)
Dim line As NLineSeries = CType(chart.Series(0), NLineSeries)
Dim ring As New NLineSeries
chart.Series.Add(ring)
ring.DataLabelStyle.Visible = False
ring.MarkerStyle.Visible = False
ring.Legend.Mode = SeriesLegendMode.None
ring.InflateMargins = False
ring.BorderStyle = New NStrokeStyle(New NLength(1), Color.Blue)
ring.UseXValues = True
ring.UseZValues = True
Dim pointCount As Integer = 25
Dim segmentCount = pointCount - 1
Dim angleStep As Double = (2 * Math.PI) / segmentCount
' calculate unit vector
Dim xA As Double = line.XValues(0)
Dim yA As Double = line.Values(0)
Dim zA As Double = line.ZValues(0)
Dim xN As Double = line.XValues(1) - xA
Dim yN As Double = line.Values(1) - yA
Dim zN As Double = line.ZValues(1) - zA
Dim length As Double = Math.Sqrt(xN * xN + yN * yN + zN * zN)
xN = xN / length
yN = yN / length
zN = zN / length
Dim dist As Double = rand.NextDouble() * length
Dim radius As Double = 2.6
Dim cosB As Double = Math.Sqrt(xN * xN + zN * zN)
Dim sinB As Double = yN
Dim gamma As Double = Math.Atan2(zN, xN)
Dim cosG As Double = Math.Cos(gamma)
Dim sinG As Double = Math.Sin(gamma)
For i = 0 To pointCount - 1 Step 1
Dim alpha As Double = i * angleStep
Dim x As Double = 0
Dim y As Double = Radius * Math.Sin(alpha)
Dim z As Double = Radius * Math.Cos(alpha)
Dim x1 As Double = cosB * x - sinB * y
Dim y1 As Double = sinB * x + cosB * y
Dim z1 As Double = z
Dim x2 As Double = cosG * x1 - sinG * z1
Dim y2 As Double = y1
Dim z2 As Double = sinG * x1 + cosG * z1
ring.XValues.Add(xA + xN * dist + x2)
ring.Values.Add(yA + yN * dist + y2)
ring.ZValues.Add(zA + zN * dist + z2)
Next i
NChartControl1.Refresh()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim x1 As Double = rand.NextDouble() * 40
Dim y1 As Double = rand.NextDouble() * 40
Dim z1 As Double = rand.NextDouble() * 40
Dim x2 As Double = rand.NextDouble() * 40
Dim y2 As Double = rand.NextDouble() * 40
Dim z2 As Double = rand.NextDouble() * 40
CreateBaseLine(x1, y1, z1, x2, y2, z2)
NChartControl1.Refresh()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
NChartControl1.ShowEditor()
End Sub
End Class