LineSeriesCursor and AnnotationXY displaying unwanted text

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

UniChart
Posts: 2
Joined: Wed Jul 18, 2018 1:51 pm

LineSeriesCursor and AnnotationXY displaying unwanted text

Post by UniChart » Wed Jul 18, 2018 2:14 pm

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
Attachments
Arction_Red_Labels.png
Arction_Red_Labels.png (185.14 KiB) Viewed 4146 times

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: LineSeriesCursor and AnnotationXY displaying unwanted te

Post by ArctionKestutis » Thu Jul 19, 2018 6:56 am

Hi Daniel,

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

Hope this helps.

UniChart
Posts: 2
Joined: Wed Jul 18, 2018 1:51 pm

Re: LineSeriesCursor and AnnotationXY displaying unwanted te

Post by UniChart » Thu Jul 19, 2018 9:26 am

Hello Kestutis

thanks for the hint. It works fine now.

Kind regards
Daniel