Just as the title says: I can draw trendlines no problem, but when I try to access the Slope and Intercept properties, they're always zero.
My code produces the attached graph, and the following Debug.WriteLine() output:
Reference: Slope = 0, Intercept = 0
Measurement: Slope = 0, Intercept = 0
Here's the relevant code to add the trendlines and get to Slope and Intercept:
ReferenceScatterSeries.Trendlines.Clear();
MeasurementScatterSeries.Trendlines.Clear();
Trendline Trendline_R = new Trendline()
{
Label = "Reference Cell",
IsTrendlineVisible = true,
Type = TrendlineType.Linear
};
Trendline Trendline_M = new Trendline()
{
Label = "Measurement Cell",
IsTrendlineVisible = true,
Type = TrendlineType.Linear
};
ReferenceScatterSeries.Trendlines.Add(Trendline_R);
MeasurementScatterSeries.Trendlines.Add(Trendline_M);
Debug.WriteLine("Reference: Slope = " + Trendline_R.Slope.ToString() + ", Intercept = " + Trendline_R.Intercept.ToString());
Debug.WriteLine("Measurement: Slope = " + Trendline_M.Slope.ToString() + ", Intercept = " + Trendline_M.Intercept.ToString());
Attachment:
Capture_3db2fd00.zip