Pasta Grafiklerinde veya Barlı Pasta veya Pasta Grafiğindeki İkinci Pastada veya Bar da Veri Noktalarını Bulma

Olası Kullanım Senaryoları

Aspose.Cells kullanarak Pasta of Pasta grafiğindeki veri serilerinin veri noktalarının ikinci pasta içinde veya Pasta of Bar grafikteki çubuk içinde olduğunu bulabilirsiniz. Lütfen ChartPoint.IsInSecondaryPlot özelliğini belirlemek için kullanın.

Lütfen aşağıdaki örnek kodunda kullanılan örnek excel dosyasını indirin ve konsol çıktısını görün. Eğer örnek excel dosyasını açarsanız, tüm 10’dan küçük olan veri noktalarını çubuk içinde Pasta of Bar grafik olarak da konsol çıktısı tarafından gösterildiği gibi bulacaksınız.

Bir Pasta-grafik veya Çubuk-grafikte Veri Noktalarının İkinci Pasta’nın veya Pasta’nın Çubuğu’nun Üzerinde Olup Olmadığını Bulma

Aşağıdaki örnek kod, veri noktalarının Pasta Grafiği veya Barlı Pasta grafiklerinde ikinci pastada veya bar’da olup olmadığını nasıl bulacağınızı gösterir.

// 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.getSharedDataDir(FindDataPoints.class) + "articles/";
// Load source excel file containing Bar of Pie chart
Workbook wb = new Workbook(dataDir + "PieBars.xlsx");
// Access first worksheet
Worksheet ws = wb.getWorksheets().get(0);
// Access first chart which is Bar of Pie chart and calculate it
Chart ch = ws.getCharts().get(0);
ch.calculate();
// Access the chart series
Series srs = ch.getNSeries().get(0);
// Print the data points of the chart series and check
// its IsInSecondaryPlot property to determine if data point is inside
// the bar or pie
for (int i = 0; i < srs.getPoints().getCount(); i++) {
// Access chart point
ChartPoint cp = srs.getPoints().get(i);
// Skip null values
if (cp.getYValue() == null)
continue;
// Print the chart point value and see if it is inside bar or pie
// If the IsInSecondaryPlot is true, then the data point is inside
// bar
// otherwise it is inside the pie
System.out.println("Value: " + cp.getYValue());
System.out.println("IsInSecondaryPlot: " + cp.isInSecondaryPlot());
System.out.println();

Konsol Çıktısı

Lütfen yukarıdaki örnek kodun yürütülmesinden sonra oluşturulan konsol çıktısını aşağıda bulunan örnek excel dosyası ile kontrol edin. Eğer IsInSecondaryPlot false ise, veri noktası Pasta’nın içindedir, eğer true ise, o zaman veri noktası Bar’ın içindedir.

 Value: 15

IsInSecondaryPlot: false

Value: 9

IsInSecondaryPlot: true

Value: 2

IsInSecondaryPlot: true

Value: 40

IsInSecondaryPlot: false

Value: 5

IsInSecondaryPlot: true

Value: 4

IsInSecondaryPlot: true

Value: 25

IsInSecondaryPlot: false