// Create a new workbook Workbook workbook = new Workbook(); IWorksheet worksheet = workbook.getWorksheets().get(0); worksheet.getRange("A2:A6").setNumberFormat("m/d/yyyy"); worksheet.getRange("A1:D6").setValue(new Object[][] { {null, "S1", "S2", "S3"}, {new GregorianCalendar(2015, 9, 7), 10, 25, 25}, {new GregorianCalendar(2015, 9, 24), 51, 36, 27}, {new GregorianCalendar(2015, 10, 8), 52, 85, 30}, {new GregorianCalendar(2015, 10, 25), 22, 65, 65}, {new GregorianCalendar(2015, 11, 10), 23, 69, 69} }); worksheet.getColumns().get(0).autoFit(); IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, 250, 20, 360, 230); shape.getChart().getSeriesCollection().add(worksheet.getRange("A1:D6"), RowCol.Columns, true, true); IAxis category_axis = shape.getChart().getAxes().item(AxisType.Category); // DateTime(2015, 12, 20) category_axis.setMaximumScale(DateInfo.ToOADate(new GregorianCalendar(2015, 11, 20))); // DateTime(2015, 10, 1) category_axis.setMinimumScale(DateInfo.ToOADate(new GregorianCalendar(2015, 9, 1))); category_axis.setBaseUnit(TimeUnit.Months); category_axis.setMajorUnitScale(TimeUnit.Months); category_axis.setMajorUnit(1); category_axis.setMinorUnitScale(TimeUnit.Days); category_axis.setMinorUnit(15); // Save to an excel file workbook.save("ConfigCategoryAxisUnits.xlsx");