Page 1 of 1

How can i add the line ?

Posted: Mon Aug 22, 2016 2:56 am
by copilot90
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 !

Re: How can i add the line ?

Posted: Mon Aug 22, 2016 1:12 pm
by ArctionPasi
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); 
        }