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.
LineSeriesCursor & Annotation showing its value
Moderator: Queue Moderators
Re: LineSeriesCursor & Annotation showing its value
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.
Paul T.
Re: LineSeriesCursor & Annotation showing its value
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.
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.
Re: LineSeriesCursor & Annotation showing its value
File attached.
- Attachments
-
- CursorAndAnnotationOutOfSync
- CursorAndAnnotationOutOfSync.png (57.38 KiB) Viewed 19411 times
- ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
- Contact:
Re: LineSeriesCursor & Annotation showing its value
Hi Paul,
can you post a VS project we could run to reproduce the problem?
can you post a VS project we could run to reproduce the problem?
LightningChart Support Team, PT
Re: LineSeriesCursor & Annotation showing its value
Pasi,
I figured out the source of the problem. Missing InvalidateVisual() call after y-axis range change.
Thanks,
Paul T.
I figured out the source of the problem. Missing InvalidateVisual() call after y-axis range change.
Thanks,
Paul T.