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
90
Line Chart Glowing Points
posted
Hey.  I'm working with the WinChart's line chart feature and I need a little help. 

Our data source is set up as a DataTable.  We're using the chart to give a live view of how our data is changing.  Updating the graph was easy as all you need to do is update the entries in the DataTable.  As a little bonus feature, we wanted to have points glow green or red depending if their value went up or down.  I should mention that we're also using a Column Chart and I have already gotten the bars to glow green/red depending on the change.   

The way I accomplished this with the Column Chart was by using one of the examples given in one of your documents.  Mainly the function


private void UltraChart1_Column_ChartDrawItem(object sender, Infragistics.UltraChart.Shared.Events.ChartDrawItemEventArgs e)

I then followed the example you guys have posted and changed the stroke and strokewidth on the PE object to change the border color and to make it glow a green/red.

My question is, is there anyway to get each specific point in a line chart?  For the column chart I have this

if (e.Primitive is Box){
Box b = e.Primitive as Box;
if(b != null && b.Row >= 0 && b.Column >= 0 ){ 

And from here I know that b is a bar I want.

With the line charts I was fooling around a little bit and found that "Polyline" seems to be the primative I need here.  The thing is, if I change the b.PE.Stroke, it changes the entire line and all the points.  I just want one specific point to change.  Also I saw that there was a "b.Points" and a "b.Points[0].Highlight".  Are these things I could use to do what we need?

Thanks for the help. 
  • 190
    Verified Answer
    posted

    I recently had to do something similar and not sure if it will give the same results as you are expecting but here goes...

    My understanding (someone correct me if I'm wrong) is that once you have bound your data every DataPoint, PolyLine, PointSet etc is "in" the chart and can be accessed from the FillSceneGraph event of the UltraChart (windows not sure about web). Using this I added a local variable to hold the X/Y positions of the points and itterated through then and painted a new ellipse and added it to the chart scene. VB Code afriad - but if you are working in c# it is easy enough to translate :)

    HTH
    Brendon

     'Local Variable
    Private m_PaintPoints As New Generic.List(Of System.Drawing.Point

    Private Sub UltraChart1_FillSceneGraph(ByVal sender As Object, ByVal e As Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs) Handles UltraChart1.FillSceneGraph
            For Each p As Primitive In e.SceneGraph
                If (TypeOf p Is Polyline) Then
                    For Each pt As Infragistics.UltraChart.Core.Primitives.DataPoint In CType(p, Infragistics.UltraChart.Core.Primitives.Polyline).points
                        If pt.Value IsNot Nothing Then
                            'Points to paint in case there is only 1 point for the series
                            Dim newPT As New System.Drawing.Point(pt.point.X, pt.point.Y)
                            If Not m_PaintPoints.Contains(newPT) Then
                                m_PaintPoints.Add(newPT)
                            End If
                        End If
                    Next pt
                End If
            Next p

                For Each paintPt As System.Drawing.Point In m_PaintPoints
                    Dim myCircleRight As New Ellipse(paintPt, 3)
                    myCircleRight.PE = New PaintElement(System.Drawing.Color.CornflowerBlue, System.Drawing.Color.OrangeRed, GradientStyle.Elliptical)
                    e.SceneGraph.Add(myCircleRight)
                Next
    End Sub