How can i add the line ?

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

copilot90
Posts: 13
Joined: Mon Aug 22, 2016 2:46 am

How can i add the line ?

Post by copilot90 » Mon Aug 22, 2016 2:56 am

Hello

I 'm Making the software for thread-fed multi-channel data chart

I want to add the line when mouse clicked

Is it possible ?

If the task is possible , How can I add the line in source code

Please Help me

and Have a nice day!

thank you !
Attachments
image 4.jpg
image 4.jpg (220.54 KiB) Viewed 6209 times

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

Re: How can i add the line ?

Post by ArctionPasi » Mon Aug 22, 2016 1:12 pm

Hi Copilot,

You can add it like this:

Code: Select all


m_chart.MouseDoubleClick += m_chart_MouseDoubleClick;


void m_chart_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            LineSeriesCursor cursorLine = new LineSeriesCursor(m_chart.ViewXY, m_chart.ViewXY.XAxes[0]);
            cursorLine.LineStyle.Color = System.Windows.Media.Colors.Gray; 

            double x;

            m_chart.ViewXY.XAxes[0].CoordToValue((int) e.GetPosition(m_chart).X, out x,false);
            cursorLine.ValueAtXAxis = x;

            m_chart.ViewXY.LineSeriesCursors.Add(cursorLine); 
        }
LightningChart Support Team, PT