We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Equation text of Trendline chart

so, how do I get text of the equation of Trendline chart in Aspose Cells?


int chartIndex = sheet.Charts.Add(ChartType.Scatter, sheet.Cells[“E” + s].Row - 2, sheet.Cells[“E” + s].Column, 15, 5);

Chart chart = sheet.Charts[chartIndex];

chart.ChartObject.Width = 300;
chart.ChartObject.Height = 200;

chart.NSeries.Add(“A” + s + “:B” + pointer, true);
chart.NSeries[0].TrendLines.Add(TrendlineType.Linear, “Linear”);
chart.NSeries[0].TrendLines[0].DisplayEquation = true;
chart.NSeries[0].TrendLines[0].DisplayRSquared = true;


//Code to get equation text here


Thanks for your posting and using Aspose.Cells.

It seems, this feature is not available. I have attached the s.xlsx file containing the trendline and equation and also attached the screenshot for your reference.

Do you want to access the Equation text i.e y = 8.1333x + 5

Let us know your requirement. We may investigate it and add this feature in our upcoming versions.

Yes, that’s it.
But is there any trick to get this done? Can I access it through the “Shape” or something?

I appreciate your quick response. I hope you could help me


Thanks for your posting and using Aspose.Cells.

There is currently no workaround for this feature. This is actually a New Feature, therefore we have logged a New Feature request in our database to support this issue. We will look into it and implement it if possible. Once, the feature is available or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSNET-43112 - Get Text of the Equation of Trendline inside Chart


Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v8.2.2.2 and let us know your feedback.

Please read the equation text with TrendLine.DataLabels.Text.

The issues you have found earlier (filed as CELLSNET-43112) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.


Thanks for using Aspose.Cells.

You need to call Chart.Calculate() method before you could retrieve the Equation Text from TrendLine.DataLabels.Text property.

Please see the following article for your reference.

I’ve done that with INTERCEPT and SLOPE functions.
but thank you for your hardworking, love you Aspose.