円グラフまたは円グラフの棒グラフの 2 番目の円または棒にデータ ポイントがあるかどうかを調べる

考えられる使用シナリオ

系列のデータ ポイントが 2 番目の円にあるかどうかを確認できます。パイのパイチャートまたはバーバー・オブ・パイAspose.Cellsを使用したチャート。ChartPoint.IsInSecondaryPlotそれを決定するプロパティ。

をダウンロードしてくださいサンプルエクセルファイル次のサンプル コードで使用され、そのコンソール出力を参照してください。開くとサンプルエクセルファイル、10未満のすべてのデータポイントがバーの内側にあることがわかりますバー・オブ・パイコンソール出力にも表示されるグラフ。

円グラフまたは円グラフの棒グラフの 2 番目の円または棒にデータ ポイントがあるかどうかを調べる

次のサンプル コードは、データ ポイントがグラフの 2 番目の円グラフまたは棒グラフにあるかどうかを確認する方法を示しています。パイのパイまたバー・オブ・パイチャート。

// 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();

コンソール出力

上記のサンプル コードを実行した後に生成される次のコンソール出力を参照してください。サンプルエクセルファイル.もしもIsInSecondaryPlot間違いの場合、データ ポイントは円の内側にあるか、円の内側にある場合真実の場合、データ ポイントはバーの内側にあります。

 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