Grafik Eğilim Çizgisinin Denklem Metnini Alın

Örnek vermek

Aşağıdaki ekran görüntüsü Trend Çizgili Grafiği gösterir ve Denklem Metni Kırmızı renkte gösterilir. Bu metni kullanarak geri alacağız.Trendline.getDataLabels().getText()özelliği aşağıdaki örnek kodda.

yapılacaklar:resim_alternatif_metin

Grafik eğilim çizgisinin denklem metnini almak için Java kodu

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getDataDir(GetWorksheetOfChart.class);
// Create workbook object from source Excel file
Workbook workbook = new Workbook(dataDir + "source.xlsx");
// Access the first worksheet
Worksheet worksheet = workbook.getWorksheets().get(0);
// Access the first chart inside the worksheet
Chart chart = worksheet.getCharts().get(0);
// Calculate the Chart first to get the Equation Text of Trendline
chart.calculate();
// Access the Trendline
Trendline trendLine = chart.getNSeries().get(0).getTrendLines().get(0);
// Read the Equation Text of Trendline
System.out.println("Equation Text: " + trendLine.getDataLabels().getText());

Örnek kod tarafından oluşturulan çıktı

Bu, yukarıdaki örnek kodun konsol çıktısıdır.

Equation Text: y = 8.1333x + 5