// Create a new workbook Workbook workbook = new Workbook(); IWorksheet worksheet = workbook.getWorksheets().get(0); IShape shape = worksheet.getShapes().addChart(ChartType.XYScatterLines, 350, 20, 360, 230); worksheet.getRange("A1:B8").setValue(new Object[][]{ {75, 250}, {50, 125}, {25, 375}, {75, 250}, {50, 875}, {25, 625}, {75, 750}, {125, 500}, }); shape.getChart().getSeriesCollection().add(worksheet.getRange("A1:B8"), RowCol.Columns); shape.getChart().getChartTitle().setText("Scatter with Straight Lines and Markers Chart"); // Save to an excel file workbook.save("XYScatterLinesChart.xlsx");