// 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(ShowCellRangeAsTheDataLabels.class);
// Create workbook from the source Excel file
Workbook workbook = new Workbook(dataDir + "sample.xlsx");

// Access the first worksheet
Worksheet worksheet = workbook.getWorksheets().get(0);

// Access the chart inside the worksheet
Chart chart = worksheet.getCharts().get(0);

// Check the "Label Contains - Value From Cells"
DataLabels dataLabels = chart.getNSeries().get(0).getDataLabels();
dataLabels.setShowCellRange(true);

// Save the workbook
workbook.save(dataDir + "output.xlsx");