Adding Trend Line to Report Chart
C# Script
private void chart1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
Series aSeries = ((XRChart)sender).Series[0];
TrendLine aTredLine = ((LineSeriesView)aSeries.View).FinancialIndicators.TrendLines[0];
aTredLine.Point1.Argument = aSeries.Points[0].Argument;
aTredLine.Point2.Argument = aSeries.Points[aSeries.Points.Count - 1].Argument;
}
If your chart is a bar chart change ‘LineSeriesView’ to ‘BarSeriesView’ in the second line of code
Click on Chart Line you want to add trendline for in the designer
In the property grid for the line go to the elements section, expand View. Select Indicators and a pop up box will appear.
Select Add and another pop up will appear.
Select Trend Line and hit ok
It will then give you a trend line property grid. Make appropriate changes such as changing the trend line color and hit close.
Save and run your report.
Example: