Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
875
Polyline won't show up on scatter chart
posted

I have a Scatter Chart that I am using an algorithm to find a linear regression.  In the FillSceneGraph, I can create a Line and add it to the SceneGraph without a problem.

When I do the same with a Polyline, it does not show up on the chart.  It is there, because if it crosses a point in the scatter, the part of the point that the Polyline crosses seems to have an invalidated region.  I am using the same end points for the Polyline as I used for the Line.

I am using v9.1 of the chart.  Here is some sample code.  Just drop a chart on a form and then put in the following code.  In UltraChart1_FillSceneGraph, you can comment out the Polyline logic and uncomment the Line logic.  You will see the Line at this point. 

 Am I missing something?  I've tried setting color, thickness, opacity, etc. on the Polyline with no effect.

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

         Dim series As New XYSeries()

        series.Label = "My Points"

        series.Points.Add(New XYDataPoint(1, 10, "Pt 1", False))

        series.Points.Add(New XYDataPoint(2, 20, "Pt 2", False))

        series.Points.Add(New XYDataPoint(3, 50, "Pt 3", False))

        series.Points.Add(New XYDataPoint(4, 55, "Pt 4", False))

        series.Points.Add(New XYDataPoint(5, 75, "Pt 5", False))

         UltraChart1.ChartType = ChartType.ScatterChart

        UltraChart1.Series.Add(series)

     End Sub

     Private Sub UltraChart1_FillSceneGraph(ByVal sender As System.Object, ByVal e As Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs) Handles UltraChart1.FillSceneGraph

        Dim xAxis As IAdvanceAxis = CType(e.Grid("X"), IAdvanceAxis)

        Dim yAxis As IAdvanceAxis = CType(e.Grid("Y"), IAdvanceAxis)

         If ((xAxis IsNot Nothing) AndAlso (yAxis IsNot Nothing)) Then

            Dim p1 As New Point(Convert.ToInt32(xAxis.Map(1)), Convert.ToInt32(yAxis.Map(10)))

            Dim p2 As New Point(Convert.ToInt32(xAxis.Map(4)), Convert.ToInt32(yAxis.Map(65)))

            Dim p3 As New Point(Convert.ToInt32(xAxis.Map(3)), Convert.ToInt32(yAxis.Map(50)))

             'Dim line As New Line(p1, p2, New LineStyle(LineCapStyle.NoAnchor, LineCapStyle.NoAnchor, LineDrawStyle.Solid))

            'e.SceneGraph.Add(line)

 

            Dim linePoints(2) As DataPoint

            linePoints(0) = New DataPoint(p1)  'p1 is an end-point

            linePoints(1) = New DataPoint(p3)  'p3 is in the middle

            linePoints(2) = New DataPoint(p2) ' p2 is an end-point

             Dim myPolyline As Polyline = New Polyline(linePoints, New LineStyle(LineCapStyle.NoAnchor, LineCapStyle.NoAnchor, LineDrawStyle.Solid))

            e.SceneGraph.Add(myPolyline)

        End If

    End Sub