小唯快跑啊
新XDDF代码缺少and 中的axIds设置。lineChartscatterChart在/xl/charts/chart1.xml这看起来像:<c:lineChart> ... <c:axId val="0"/> <c:axId val="1"/></c:lineChart>对于折线图..做添加:... XDDFChartData data = chart.createData(ChartTypes.LINE, bottomAxis, leftAxis); data.addSeries(xs, ys1); data.addSeries(xs, ys2); chart.plot(data); //setting the axis Ids to the LineChart chart.getCTChart().getPlotArea().getLineChartArray(0).addNewAxId().setVal(bottomAxis.getId()); chart.getCTChart().getPlotArea().getLineChartArray(0).addNewAxId().setVal(leftAxis.getId()); // Write the output to a file try (FileOutputStream fileOut = new FileOutputStream("ooxml-line-chart.xlsx")) { wb.write(fileOut); }...在 LineChart.java和... XDDFChartData data = chart.createData(ChartTypes.SCATTER, bottomAxis, leftAxis); data.addSeries(xs, ys1); data.addSeries(xs, ys2); chart.plot(data); //setting the axis Ids to the ScatterChart chart.getCTChart().getPlotArea().getScatterChartArray(0).addNewAxId().setVal(bottomAxis.getId()); chart.getCTChart().getPlotArea().getScatterChartArray(0).addNewAxId().setVal(leftAxis.getId()); // Write the output to a file try (FileOutputStream fileOut = new FileOutputStream("ooxml-scatter-chart.xlsx")) { wb.write(fileOut); }...在 ScatterChart.java它会起作用。