ClipArea Issues with LineSeriesCursor and MouseOver

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

Posts: 1
Joined: Tue Dec 03, 2019 7:56 pm

ClipArea Issues with LineSeriesCursor and MouseOver

Post by KWilliams » Tue Dec 03, 2019 9:43 pm

In my application when historical data is loaded I'm using multiple PointLineSeries to show all the names a given input channel had at different points in history. I'm using clip areas to show only a single PointLineSeries for a given input channel at a given time. For example input channel 5 could be called "CH 5" and later be changed to "Oil", and then back to "CH 5". If a user was to query this time range 2 PointLineSeries would be made: "CH 5 (5)" and "Oil (5)". Clip areas are then placed on "Oil (5)" wherever "CH 5 (5)" was active and vice versa.

The above functionality is working with two bugs. One is that a LineSeriesCursor will put a TrackPoint on both PointLineSeries, even if the LineSeriesCursor is within a ClipArea of the PointLineSeries.
supportPic1.png (8.4 KiB) Viewed 1222 times
supportPic2.png (9.28 KiB) Viewed 1222 times
The second issue is that the PointLineSeries seem to still have hit detection inside the ClipAreas. This leads to issues with logic that's showing values on mouseover.
supportPic3.png (9.03 KiB) Viewed 1222 times
Is there any way to get this behavior on the current version of Lightning Chart or will this require a functionality change?

Posts: 77
Joined: Wed Mar 27, 2019 1:05 pm

Re: ClipArea Issues with LineSeriesCursor and MouseOver

Post by Arction_LasseP » Wed Dec 04, 2019 9:18 am


The function of ClipAreas is to prevent parts of the data to be rendered. However, in most cases they do only that and not stop the other functions such as mouse interactions.

The first issue about the LineSeriesCursor can be solved by changing CursorTrackEnabled -property for individual PointLineSeries. By default cursor tracks all series belonging to the X-axis the cursor is assigned to. This is why a TrackPoint is placed on both series. If you want to hide the TrackPoint, disable CursorTrackEnabled. This can be done for example inside cursor's PositionChanged -event.

Code: Select all

cursor.PositionChanged += Cursor_PositionChanged;

private void Cursor_PositionChanged(object sender, PositionChangedEventArgs e)
            foreach (PointLineSeries pls in _chart.ViewXY.PointLineSeries)
                if (e.NewValue > pls.GetXValues().Max() || e.NewValue < pls.GetXValues().Min())
                    pls.CursorTrackEnabled = false;
                    pls.CursorTrackEnabled = true;
The code above hides the TrackPoint if the cursor is no longer above the PointLineSeries.

The second issue about the hit detection above the ClipArea, is a bit trickier as currently there is no property that can be directly used to stop this behaviour. However, there are some workarounds. Firstly, is the ClipArea actually necessary here if you are using two separate PointLineSeries anyway? If you want to hide a series, its Visible -property could be disabled.

If the ClipArea is needed, you can manually switch off the MouseHighlight when the mouse cursor is above the ClipArea. There are multiple ways to do this, for example chart's MouseMove -event or HighlightStateChanged -event for the series.
Here is one way to do this with MouseMove -event:

Code: Select all

_chart.MouseMove += _chart_MouseMove;

private void _chart_MouseMove(object sender, MouseEventArgs e)
            var mousePos = e.GetPosition(_chart);
            double xPos;
            _chart.ViewXY.XAxes[0].CoordToValue((int)mousePos.X, out xPos, false); //Gets the axis value of the mouse coordinate

            if (xPos > clipAreaBegin && xPos < clipAreaEnd)
                _chart.ViewXY.PointLineSeries[0].MouseHighlight = MouseOverHighlight.None;
                _chart.ViewXY.PointLineSeries[0].MouseHighlight = MouseOverHighlight.Simple;
Hope this helps.
Best regards,