LineSeriesCursor & Annotation showing its value

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
paultobey
Posts: 21
Joined: Mon Dec 09, 2013 7:27 pm

LineSeriesCursor & Annotation showing its value

Post by paultobey » Fri Jan 24, 2014 12:32 am

This seems to be my day to find problems.

I have a LineSeriesCursor set up as follows:

LineSeriesCursor cursor = new LineSeriesCursor(Chart1.ViewXY, Chart1.ViewXY.XAxes[0]);
cursor.HairCrossColorMixing = true;
cursor.Style = CursorStyle.PointTracking;
cursor.Visible = true;
cursor.FullHeight = true;
cursor.SnapToPoints = true;
cursor.LineStyle.Color = Colors.Red;
cursor.LineStyle.Pattern = LinePattern.Solid;
cursor.LineStyle.Width = 3.0F;
cursor.TrackPoint.Shape = Arction.WPF.LightningChartUltimate.Shape.Cross;
cursor.ValueAtXAxis = Chart1.ViewXY.XAxes[0].Minimum; // Set to the left edge of the chart.
cursor.PositionChanged += new LineSeriesCursor.PositionChangedHandler(cursor_PositionChanged);

In cursor_positionChanged, I move and update annotation text to indicate the location of the cursor (the annotation moves around as the cursor moves).

The problem is that while I'm dragging the cursor, it jumps from data point location to location (as expected for SnapToPoints), but cursor_PositionChanged does NOT send those values but the mouse location, so my annotation can be out of sync with the actual cursor location (clearly wrong for what I'm doing). I've logged the cursor_PositionChanged parameter values and they are the mouse location not the cursor location. I think this is a bug in the cursor's PositionChanged event, don't you?

Paul T.

paultobey
Posts: 21
Joined: Mon Dec 09, 2013 7:27 pm

Re: LineSeriesCursor & Annotation showing its value

Post by paultobey » Fri Jan 24, 2014 12:55 am

Now I'm just confused. I made a minor change to the RenderComplete handler and the cursor position now tracks correctly. Ignore for now while I try to localize what happened.

Paul T.

paultobey
Posts: 21
Joined: Mon Dec 09, 2013 7:27 pm

Re: LineSeriesCursor & Annotation showing its value

Post by paultobey » Tue Jan 28, 2014 11:52 pm

I've addressed the issue of normal cursor movement sync with the cursor's annotation.

However, I'm running into another issue. As mentioned the cursor is set for SnapToPoints. However, I don't seem to get notified of a position change event when a snap occurs during operations other than mouse moves. For example, I have several charts "stacked up" on separate tab pages so only the top-most seems to be actually rendered. If I create my charts, then change X-axis scaling and then display a different "tab", the chart looks like the attached picture, CursorAndAnnotationOutOfSync.

I've logged all calls to PositionChanged event handler and the cursor is not firing that event. Further, the ValueAtXAxis returned by the cursor matches the value where the annotation is located! It's like the visual element on the screen (which is draggable by the way), doesn't correspond to the LineSeriesCursor object.

Paul T.

paultobey
Posts: 21
Joined: Mon Dec 09, 2013 7:27 pm

Re: LineSeriesCursor & Annotation showing its value

Post by paultobey » Tue Jan 28, 2014 11:53 pm

File attached.
Attachments
CursorAndAnnotationOutOfSync
CursorAndAnnotationOutOfSync
CursorAndAnnotationOutOfSync.png (57.38 KiB) Viewed 19411 times

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: LineSeriesCursor & Annotation showing its value

Post by ArctionPasi » Sat Feb 01, 2014 12:27 pm

Hi Paul,

can you post a VS project we could run to reproduce the problem?
LightningChart Support Team, PT

paultobey
Posts: 21
Joined: Mon Dec 09, 2013 7:27 pm

Re: LineSeriesCursor & Annotation showing its value

Post by paultobey » Fri Feb 14, 2014 12:19 am

Pasi,

I figured out the source of the problem. Missing InvalidateVisual() call after y-axis range change.

Thanks,
Paul T.

Post Reply