Handle Automatic Units of Chart Axis like Microsoft Excel
Possible Usage Scenarios
Early versions of Aspose.Cells were not able to handle automatic units of chart axis properly when the chart was rendered to image or PDF. Now, Aspose.Cells supports the handling of automatic units of chart axis. There is no code change. Just convert your chart into image or PDF and it will render the chart axis just like Microsoft Excel renders it.
Handle Automatic Units of Chart Axis like Microsoft Excel
The following sample code loads the sample Excel file and generates the output PDF chart. The screenshot shows the automatic units of chart axis in red rectangles and also compares the sample Excel file chart with output PDF chart. Both are exactly similar.
Sample Code
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
//Load the sample Excel file | |
Workbook wb = new Workbook("sampleHandleAutomaticUnitsOfChartAxisLikeMicrosoftExcel.xlsx"); | |
//Access first worksheet | |
Worksheet ws = wb.getWorksheets().get(0); | |
//Access first chart | |
Chart ch = ws.getCharts().get(0); | |
//Render chart to pdf | |
ch.toPdf("outputHandleAutomaticUnitsOfChartAxisLikeMicrosoftExcel.pdf"); |