Java Excel中的彩色图表导出
我需要导出Excel中的PieChart。到目前为止,导出工作正常,但图表的某些颜色是相同的。 我想不出这个问题 代码如下:Java Excel中的彩色图表导出,java,excel,colors,export,Java,Excel,Colors,Export,我需要导出Excel中的PieChart。到目前为止,导出工作正常,但图表的某些颜色是相同的。 我想不出这个问题 代码如下: Color[] c = this.createRainbow(100); int n = chart.getDataPointCount(0); //number of Pies ArrayList<Integer> compare = new ArrayList<Integer>(); for (int j = 0; j < n &
Color[] c = this.createRainbow(100);
int n = chart.getDataPointCount(0); //number of Pies
ArrayList<Integer> compare = new ArrayList<Integer>();
for (int j = 0; j < n && !ValueWatcherServer.canceled_id.contains(connectionid); j++) {
int rePos = (int)(((double)j / (double)n * (double)c.length));
ChartFormat format = chart.getDataPointFormat(0, j);
format.setSolid();
if(!compare.contains(rePos)){
compare.add(rePos);
format.setForeColor(c[rePos].getRGB());
}
else{
format.setForeColor(3);
}
chart.setDataPointFormat(0, j, format);
}
结果是: