احصل على نص معادلة خط اتجاه المخطط
Contents
[
Hide
]
يمكنك استرداد نص المعادلة لخط اتجاه المخطط باستخدام Aspose.Cells. يوفر Aspose.CellsTrendline.DataLabels.Text الخاصية التي تُرجع نص المعادلة لخط اتجاه المخطط. للاستفادة من هذه الخاصية ، سيتعين عليك الاتصال أولاًرسم بياني. احسب () طريقة.
تُظهر لقطة الشاشة التالية المخطط الذي يحتوي على خط اتجاه ويظهر نص المعادلة باللون الأحمر. سنقوم باسترداد هذا النص باستخدامTrendline.DataLabels.Textالخاصية في نموذج التعليمات البرمجية التالي.
كود C# للحصول على نص معادلة خط اتجاه المخطط
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Create workbook object from source Excel file | |
Workbook workbook = new Workbook(dataDir + "source.xlsx"); | |
// Access the first worksheet | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Access the first chart inside the worksheet | |
Chart chart = worksheet.Charts[0]; | |
// Calculate the Chart first to get the Equation Text of Trendline | |
chart.Calculate(); | |
// Access the Trendline | |
Trendline trendLine = chart.NSeries[0].TrendLines[0]; | |
// Read the Equation Text of Trendline | |
Console.WriteLine("Equation Text: " + trendLine.DataLabels.Text); |
الناتج الناتج عن نموذج التعليمات البرمجية
هذا هو إخراج وحدة التحكم لعينة التعليمات البرمجية أعلاه.
Equation Text: y = 8.1333x + 5