java POI excel 折线图 有空值时,跳过空值防止折线数据偏差
poi生成的图表,跳过空值,将空单元显示为间隙
更改空单元格、null (#N/A) 值和隐藏的行与列在图表中的显示方式
错误效果

正确效果

// 下面代码实测有效
XSSFChart chart = (XSSFChart)drawing.createChart(anchor);// this will set blank values as gaps in the chart so you // can accurately plot data series of different lengthsCTDispBlanksAs disp = CTDispBlanksAs.Factory.newInstance();disp.setVal(STDispBlanksAs.GAP);chart.getCTChart().setDispBlanksAs(disp);// setup chart, axes, data series, etc或者chart.plot(data, new ChartAxis[] { bottomAxis, leftAxis });// this must occur after the call to chart.plot aboveCTPlotArea plotArea = chart.getCTChart().getPlotArea();for (CTLineChart ch : plotArea.getLineChartList()) {for (CTLineSer ser : ch.getSerList()) {CTBoolean ctBool = CTBoolean.Factory.newInstance();ctBool.setVal(false);ser.setSmooth(ctBool);}}
在图表中显示空单元格、null (#N/A) 值和隐藏的工作表数据 - Microsoft 支持
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
