الحصول على نص المعادلة لخط اتجاه الرسم البياني
Contents
[
Hide
]
يمكنك استرداد نص معادلة خط الاتجاه باستخدام Aspose.Cells for Python via .NET. توفر Aspose.Cells for Python via .NET خاصية ترجع نص معادلة خط الاتجاه للمخطط. لاستخدام هذه الخاصية، عليك أولاً استدعاء الدالة Chart.calculate().
تظهر اللقطة المتصورة التالية الرسم البياني مع خط اتجاه ونص المعادلة له باللون الأحمر. سوف نسترجع هذا النص باستخدام الواجهة البرمجية Trendline.data_labels.text في رمز العينة التالي.
رمز C# للحصول على نص معادلة خط اتجاه الرسم البياني
This file contains hidden or 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
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Create workbook object from source Excel file | |
workbook = Workbook(dataDir + "source.xlsx") | |
# Access the first worksheet | |
worksheet = workbook.worksheets[0] | |
# Access the first chart inside the worksheet | |
chart = worksheet.charts[0] | |
# Calculate the Chart first to get the Equation Text of Trendline | |
chart.calculate() | |
# Access the Trendline | |
trendLine = chart.n_series[0].trend_lines[0] | |
# Read the Equation Text of Trendline | |
print("Equation Text: " + trendLine.data_labels.text) |
الإخراج الذي تم توليده بواسطة رمز العينة
هذا هو إنتاج الكونسول للكود العيني أعلاه.
Equation Text: y = 8.1333x + 5