// Create a new workbook Workbook workbook = new Workbook(); //Load template file Monthly business budget.xlsx from resource InputStream fileStream = this.getResourceStream("xlsx\\Monthly business budget.xlsx"); workbook.open(fileStream); IWorksheet worksheet = workbook.getActiveSheet(); // change chart type to column stacked IChart chart = worksheet.getShapes().get(0).getChart(); chart.setChartType(ChartType.ColumnStacked); chart.getColumnGroups().get(0).setOverlap(100); // set font size for chart title chart.getChartTitle().setText("ESTIMATED v/s ACTUAL BUDGET"); chart.getChartTitle().getFont().setSize(14); chart.getChartTitle().getFont().setName("Calibri"); // config chart area line, font and color chart.getChartArea().getFormat().getFill().getColor().setRGB(Color.GetWhite()); chart.getChartArea().getFont().getColor().setRGB(Color.FromArgb(89, 89, 89)); chart.getChartArea().getFormat().getLine().setVisible(true); chart.getChartArea().getFormat().getLine().getColor().setRGB(Color.FromArgb(217, 217, 217)); // make fill of plot area transparant chart.getPlotArea().getFormat().getFill().setTransparency(1); // config series1 of chart ISeries series1 = chart.getSeriesCollection().get(0); series1.setHasDataLabels(true); series1.getFormat().getLine().setVisible(false); series1.getFormat().getFill().getColor().setRGB(Color.FromArgb(98, 121, 158)); series1.getDataLabels().getFont().getColor().setRGB(Color.FromArgb(64, 64, 64)); // config series2 of chart ISeries series2 = chart.getSeriesCollection().get(1); series2.setHasDataLabels(true); series2.getFormat().getLine().setVisible(false); series2.getFormat().getFill().getColor().setRGB(Color.FromArgb(179, 192, 53)); series2.getDataLabels().getFont().getColor().setRGB(Color.FromArgb(64, 64, 64)); // get the value axis IAxis value_axis = chart.getAxes().item(AxisType.Value, AxisGroup.Primary); // config value_axis of chart value_axis.setHasTitle(true); value_axis.setHasDisplayUnitLabel(false); value_axis.getAxisTitle().setText("AMOUNT (in thousands)"); value_axis.setDisplayUnit(DisplayUnit.Thousands); value_axis.getMajorGridlines().getFormat().getLine().getColor().setRGB(Color.FromArgb(217, 217, 217)); value_axis.setMajorTickMark(TickMark.None); value_axis.getFormat().getLine().setVisible(false); chart.getAxes().item(AxisType.Category).getFormat().getLine().setVisible(false); // Save to an excel file workbook.save("MonthlyBusinessBudget.xlsx");