News Category

Spire.XLS for Java 5.3.1 supports creating Excel 2016 Charts

2022-03-11 01:13:28

We are happy to announce the release of Spire.XLS for Java 5.3.1. This version supports creating Waterfall Chart, Pareto Chart, Histogram Chart, BoxAndWhisker Chart, TreeMap Chart, SunBurst Chart, and Funnel Chart. Also, it enhances the conversions from Excel to PDF and Excel to Image. In addition, it fixes some known issues such as the obtained signature information is not correct. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature - Supports creating the Waterfall Chart.
Workbookworkbook=newWorkbook();
workbook.loadFromFile("input.xlsx");
Worksheetsheet=workbook.getWorksheets().get(0);
ChartofficeChart=sheet.getCharts().add();
//Setcharttypeaswaterfall
officeChart.setChartType(ExcelChartType.WaterFall);
//Setdatarangetothechartfromtheworksheet
officeChart.setDataRange(sheet.getRange().get("A2:B8"));
//Datapointsettingsastotalinchart
officeChart.getSeries().get(0).getDataPoints().get(3).setAsTotal(true);
officeChart.getSeries().get(0).getDataPoints().get(6).setAsTotal(true);
//Showingtheconnectorlinesbetweendatapoints
officeChart.getSeries().get(0).getFormat().showConnectorLines(true);
//Setthecharttitle
officeChart.setChartTitle("CompanyProfit(inUSD)");
//Formattingdatalabelandlegendoption
officeChart.getSeries().get(0).getDataPoints().getDefaultDataPoint().getDataLabels().hasValue(true);
officeChart.getSeries().get(0).getDataPoints().getDefaultDataPoint().getDataLabels().setSize(8);
officeChart.getLegend().setPosition(LegendPositionType.Right);
workbook.saveToFile("output.xlsx",FileFormat.Version2016);
New feature - Supports creating the Pareto Chart.
Workbookworkbook=newWorkbook();
workbook.loadFromFile("input.xlsx");
Worksheetsheet=workbook.getWorksheets().get(0);
ChartofficeChart=sheet.getCharts().add();
//SetcharttypeasPareto
officeChart.setChartType(ExcelChartType.Pareto);
//Setdatarangeintheworksheet
officeChart.setDataRange(sheet.getRange().get("A2:B8"));
//Setcategoryvaluesasbinvalues
officeChart.getPrimaryCategoryAxis().isBinningByCategory(true);
officeChart.getPrimaryCategoryAxis().setOverflowBinValue(5);
officeChart.getPrimaryCategoryAxis().setUnderflowBinValue(1);;
//FormattingParetoline
officeChart.getSeries().get(0).getParetoLineFormat().getLineProperties().setColor(Color.blue);
//Gapwidthsettings
officeChart.getSeries().get(0).getDataFormat().getOptions().setGapWidth(6);
//Setthecharttitle
officeChart.setChartTitle("Expenses");
//Hidingthelegend
officeChart.hasLegend(false);
workbook.saveToFile("output.xlsx",FileFormat.Version2016);
New feature - Supports creating the Histogram Chart.
Workbookworkbook=newWorkbook();
workbook.loadFromFile("input.xlsx");
Worksheetsheet=workbook.getWorksheets().get(0);
ChartofficeChart=sheet.getCharts().add();
//Setcharttypeashistogram
officeChart.setChartType(ExcelChartType.Histogram);
//Setdatarangeintheworksheet
officeChart.setDataRange(sheet.getRange().get("A1:A15"));
//Categoryaxisbinsettings
officeChart.getPrimaryCategoryAxis().setBinWidth(8);
//Gapwidthsettings
officeChart.getSeries().get(0).getDataFormat().getOptions().setGapWidth(6);
//Setthecharttitleandaxistitle
officeChart.setChartTitle("HeightData");
officeChart.getPrimaryValueAxis().setTitle("Numberofstudents");
officeChart.getPrimaryCategoryAxis().setTitle("Height");
//Hidingthelegend
officeChart.hasLegend(false);
workbook.saveToFile("output.xlsx",FileFormat.Version2016);
New feature - Supports creating the BoxAndWhisker Chart.
Workbookworkbook=newWorkbook();
workbook.loadFromFile("input.xlsx");
Worksheetsheet=workbook.getWorksheets().get(0);
ChartofficeChart=sheet.getCharts().add();
//Setthecharttitle
officeChart.setChartTitle("YearlyVehicleSales");
//SetcharttypeasBoxandWhisker
officeChart.setChartType(ExcelChartType.BoxAndWhisker);
//Setdatarangeintheworksheet
officeChart.setDataRange(sheet.getRange().get("A1:E17"));
//BoxandWhiskersettingsonfirstseries
ChartSerieseriesA=officeChart.getSeries().get(0);
seriesA.getDataFormat().showInnerPoints(false);
seriesA.getDataFormat().showConnectorLines(true);
seriesA.getDataFormat().showMeanMarkers(true);
seriesA.getDataFormat().showMeanLine(false);
seriesA.getDataFormat().setQuartileCalculationType(ExcelQuartileCalculation.ExclusiveMedian);
//BoxandWhiskersettingsonsecondseries
ChartSerieseriesB=officeChart.getSeries().get(1);
seriesB.getDataFormat().showInnerPoints(false);
seriesB.getDataFormat().showConnectorLines(true);
seriesB.getDataFormat().showMeanMarkers(true);
seriesB.getDataFormat().showMeanLine(false);
seriesB.getDataFormat().setQuartileCalculationType(ExcelQuartileCalculation.InclusiveMedian);
//BoxandWhiskersettingsonthirdseries
ChartSerieseriesC=officeChart.getSeries().get(2);
seriesC.getDataFormat().showInnerPoints(false);
seriesC.getDataFormat().showConnectorLines(true);
seriesC.getDataFormat().showMeanMarkers(true);
seriesC.getDataFormat().showMeanLine(false);
seriesC.getDataFormat().setQuartileCalculationType(ExcelQuartileCalculation.ExclusiveMedian);
workbook.saveToFile("output.xlsx",FileFormat.Version2016);
New feature - Supports creating the TreeMap Chart.
Workbookworkbook=newWorkbook();
workbook.loadFromFile("input.xlsx");
Worksheetsheet=workbook.getWorksheets().get(0);
ChartofficeChart=sheet.getCharts().add();
//SetcharttypeasTreeMap
officeChart.setChartType(ExcelChartType.TreeMap);
//Setdatarangeintheworksheet
officeChart.setDataRange(sheet.getRange().get("A1:C11"));
//Setthecharttitle
officeChart.setChartTitle("Areabycountries");
//SettheTreemaplabeloption
officeChart.getSeries().get(0).getDataFormat().setTreeMapLabelOption(ExcelTreeMapLabelOption.Banner);
//Formattingdatalabels
officeChart.getSeries().get(0).getDataPoints().getDefaultDataPoint().getDataLabels().setSize(8);
workbook.saveToFile("output.xlsx",FileFormat.Version2016);
New feature - Supports creating the SunBurst Chart.
Workbookworkbook=newWorkbook();
workbook.loadFromFile("input.xlsx");
Worksheetsheet=workbook.getWorksheets().get(0);
ChartofficeChart=sheet.getCharts().add();
//SetcharttypeasSunburst
officeChart.setChartType(ExcelChartType.SunBurst);
//Setdatarangeintheworksheet
officeChart.setDataRange(sheet.getRange().get("A1:D16"));
//Setthecharttitle
officeChart.setChartTitle("Salesbyannual");
//Formattingdatalabels
officeChart.getSeries().get(0).getDataPoints().getDefaultDataPoint().getDataLabels().setSize(8);
//Hidingthelegend
officeChart.hasLegend(false);
workbook.saveToFile("output.xlsx",FileFormat.Version2016);
New feature - Supports creating the Funnel Chart.
Workbook workbook = new Workbook();
workbook.loadFromFile("input.xlsx");
Worksheet sheet = workbook.getWorksheets().get(0);
Chart officeChart = sheet.getCharts().add();
//Set chart type as Funnel
officeChart.setChartType(ExcelChartType.Funnel);
//Set data range in the worksheet
officeChart.setDataRange(sheet.getRange().get("A1:B6"));
//Set the chart title
officeChart.setChartTitle("Funnel");
//Formatting the legend and data label option
officeChart.hasLegend(false);
officeChart.getSeries().get(0).getDataPoints().getDefaultDataPoint().getDataLabels().hasValue(true);
officeChart.getSeries().get(0).getDataPoints().getDefaultDataPoint().getDataLabels().setSize(8);
workbook.saveToFile("output.xlsx", FileFormat.Version2016);
Bug SPIREXLS-3443
SPIREXLS-3575
SPIREXLS-3620
Fixes the issue that the content was incorrect after converting Excel to PDF.
Bug SPIREXLS-3612 Fixes the issue that the content was incorrect after converting Excel to image.
Bug SPIREXLS-3642 Fixes the issue that the obtained signature information were not correct.
Bug SPIREXLS-3653 Fixes the issue that the application threw "OutOfMemoryError" when saving an excel file.
Bug SPIREXLS-3664 Fixes the issue that the obtained formula values were incorrect.
Click the link to download Spire.XLS for Java 5.3.1: