Change Chart Position and Size
Contents
[
Hide
]
Aspose.Cells - Change Chart Position and Size
To change the chart’s position (X, Y coordinates) and size (height, width), use these properties using Aspose.Cells:
- Chart.getChartObject().get/setWidth()
- Chart.getChartObject().get/setHeight()
- Chart.getChartObject().get/setX()
- Chart.getChartObject().get/setY()
Java
Workbook workbook = new Workbook(dataDir + "AsposeChart.xls");
Worksheet worksheet = workbook.getWorksheets().get(0);
//Load the chart from source worksheet
Chart chart = worksheet.getCharts().get(0);
//Resize the chart
chart.getChartObject().setWidth(400);
chart.getChartObject().setHeight(300);
//Reposition the chart
chart.getChartObject().setX(250);
chart.getChartObject().setY(150);
Download Running Code
Download Sample Code
For more details, visit Change the Chart Position and Size.