感谢Etienne提供了将空白设置为空白的代码。我从POI开发人员那里得到了帮助,这是解决原始问题中提到的两个问题的解决方案。
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 lengths CTDispBlanksAs 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 above CTPlotArea 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); } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)