Page 1 of 1

LineSeriesCursor and AnnotationXY displaying unwanted text

Posted: Wed Jul 18, 2018 2:14 pm
by UniChart
Hi,

I am currently evaluating LightningChart trial version at my work. We are looking for a fast realtime chart. Seems this is perfectly what we are looking for.

I did a demo application where I read data from the serial port and display it with a XY-Chart, using 40 PointLineSeries. So far that works great. But when adding an AnnotationXY I have a problem. Not only is there an Annotation display shown, but a copy of the text in the display is also shown. I added a screenshot to show what it looks like. Please have a look at the text on the left side. There are 40 labels that contain the same text that is also in the annotation. The values also are displayed correctly. All labels are on top of each other and can be replaced with the mouse. When I remove the LineSeriesCursor and the AnnotationXY from the chart, these red labels remain on the screen.

The code for the AnnotationXY and the LineSeriesCursor is pretty much a copy paste from the Arction example 'ExampleCursorTrackingXY'. The major difference it that my Xaxis is DateTime.

Code: Select all

            //Add an annotation to show the cursor values
            AnnotationXY cursorValueDisplay = new AnnotationXY(_chart.ViewXY, _chart.ViewXY.XAxes[0], _chart.ViewXY.YAxes[0]);
            cursorValueDisplay.Style = AnnotationStyle.RoundedCallout;
            cursorValueDisplay.LocationCoordinateSystem = CoordinateSystem.RelativeCoordinatesToTarget;
            cursorValueDisplay.LocationRelativeOffset.X = 150;
            cursorValueDisplay.LocationRelativeOffset.Y = -330;
            cursorValueDisplay.TextStyle.Font = new Font("Lucida console", 10f, FontStyle.Regular);
            cursorValueDisplay.TextStyle.Color = Color.Black;
            cursorValueDisplay.Text = "";
            cursorValueDisplay.Fill.Color = Color.White;
            cursorValueDisplay.Fill.GradientColor = Color.FromArgb(120, Color.Cyan);
            cursorValueDisplay.BorderVisible = false;
            cursorValueDisplay.TargetMoveByMouse = false;
            cursorValueDisplay.Visible = true;
            _chart.ViewXY.Annotations.Add(cursorValueDisplay);

            //Add cursor
            LineSeriesCursor cursor = new LineSeriesCursor(_chart.ViewXY, _chart.ViewXY.XAxes[0]);
            _chart.ViewXY.LineSeriesCursors.Add(cursor);
            cursor.PositionChanged += cursor_PositionChanged;
            cursor.ValueAtXAxis = _chart.ViewXY.XAxes[0].DateTimeToAxisValue(DateTime.Now);
            cursor.LineStyle.Color = Color.FromArgb(150, Color.Yellow);
            cursor.SnapToPoints = true;
            cursor.TrackPoint.Color1 = Color.White;
Any ideas what I may be doing wrong?

Kind regards, Daniel

Re: LineSeriesCursor and AnnotationXY displaying unwanted te

Posted: Thu Jul 19, 2018 6:56 am
by ArctionKestutis
Hi Daniel,

Most likely it is Series.Title. Please disable title's visibility, i.e. Series.Title.Visible = false.

Hope this helps.

Re: LineSeriesCursor and AnnotationXY displaying unwanted te

Posted: Thu Jul 19, 2018 9:26 am
by UniChart
Hello Kestutis

thanks for the hint. It works fine now.

Kind regards
Daniel