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
410
How to draw primitives on a NumericTimeSeries Chart
posted

I want to draw an Elipse primitive on a ScatterChart with a datetime X axis.

How do i convert my date value on the x axis into something that is in the correct cooridnate for the Point object?

In reality i have an array of XY pairs (Doubles, DataTimes). If a value pair meets a certain condition i want to paint a red circle around its marker. 

Here is my example (not working).

Dim x As Integer = CInt(System.DateTime.Parse("24-May-06").ToOADate())
Dim y As Integer = 11117.32

Dim p As Point = New Point(x, y)

Dim xb As Ellipse = New Ellipse(p, 10)

xb.PE.Fill = Color.Empty
xb.PE.Stroke = Color.Red

e.SceneGraph.Add(xb)

Parents
No Data
Reply
  • 410
    posted

    Ok, something new but still not perfect:

    The following code works but what about the conversion between double and integer on the Y axis. We loose precision. I am not worried about the xaxis because all my dates will be in days so conversion always results in a wholer number.

    Is there a better way?

    Dim axisY As IAdvanceAxis = TryCast(e.Grid("Y"), IAdvanceAxis)
    Dim axisX As IAdvanceAxis = TryCast(e.Grid("X"), IAdvanceAxis)

    Dim x As Integer = CInt(axisX.Map(System.DateTime.Parse("30-May-06")))
    Dim y As Integer = CInt(axisY.Map(11117.32))

    Dim p As Point = New Point(x, y)

    Dim xb As Ellipse = New Ellipse(p, 10)

    xb.PE.Fill = Color.Empty
    xb.PE.Stroke = Color.Red

    e.SceneGraph.Add(xb)

Children