Profile Picture

WPF Trend Line from Custom Tool Class?

Posted By 3 Years Ago
Author
Message
Posted 3 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 2 Years Ago
Posts: 0, Visits: 78
I am writing a WPF app and using the WPF Chart control. I have a custom tool class derived from NDragTool. In the MouseUp() handler, I'm trying to add a trend line to a chart control already populated with a data set. My code looks like this:

    var tradingChart = chartControl.Charts[0] as NCartesianChart;
    var newFreeTrendLine = new NTrendLine();
    newFreeTrendLine.BeginPoint = new NPointD(0.0f, 0.0f);
    newFreeTrendLine.EndPoint = new NPointD(100.0f, 100.0f);
    var trendLineStrokeStyle = new NStrokeStyle(10.0f, NColor.FromString("Blue"), LinePattern.Solid, 0, 1);
    newFreeTrendLine.StrokeStyle = trendLineStrokeStyle;
   if (tradingChart.Series.Count > 1)
    {
      tradingChart.Series.RemoveAt(0);
    }
    tradingChart.Series.Insert(0, newFreeTrendLine);
chartControl.Refresh();

I'm not seeing a trend line when I refresh. Can you tell me what I am doing wrong?




Similar Topics


Reading This Topic