Get Equation Text of Chart Trendline

The following screenshot shows a chart with a trendline, and its equation text is shown in red. We will retrieve this text using the Trendline.DataLabels.Text property in the following sample code.

todo:image_alt_text

C# code to get equation text of chart trendline

Output generated by the sample code

This is the console output of the above sample code.

Equation Text: y = 8.1333x + 5