Closed BigdataSurvey closed 2 months ago
@BigdataSurvey
Stroke.Color
设置折线图中线条的颜色。 例如看下面的代码:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Add chart with default data. You can specify different chart types and sizes. Shape shape = builder.insertChart(ChartType.LINE, 432, 252);
// Chart property of Shape contains all chart related options. Chart chart = shape.getChart();
// Get chart series collection. ChartSeriesCollection seriesColl = chart.getSeries();
// Delete default generated series. seriesColl.clear();
// Create category names array, in this example we have two categories. String[] categories = new String[] { "AW Category 1", "AW Category 2" };
// Adding new series. Please note, data arrays must not be empty and arrays must be the same size. ChartSeries s1 = seriesColl.add("AW Series 1", categories, new double[] { 1, 2 }); ChartSeries s2 = seriesColl.add("AW Series 2", categories, new double[] { 3, 4 }); ChartSeries s3 = seriesColl.add("AW Series 3", categories, new double[] { 5, 6 }); ChartSeries s4 = seriesColl.add("AW Series 4", categories, new double[] { 7, 8 });
// Set color of the lines s1.getFormat().getStroke().setColor(Color.red); s2.getFormat().getStroke().setColor(Color.black); s3.getFormat().getStroke().setColor(Color.blue); s4.getFormat().getStroke().setColor(Color.yellow);
doc.save("C:\Temp\out.docx");
2. 恐怕目前还没有办法以编程方式显示图表数据表。 此功能请求记录为 **WORDSNET-15898**,我们将随时向您通报最新情况,并在此功能实施后通知您。
PS: 获得支持的主要场所是 Aspose.Words 支持论坛。 请在那里发布您的进一步问题。
<https://forum.aspose.com/c/words/8>
The issues you have found earlier (filed as WORDSNET-15898) have been fixed in this Aspose.Words for Java 24.3 update.
环境:Aspose.Words For Java 23.7.jar、JAVA1.8 原型图如下: 代码运行效果如下: 目前问题1:我在代码中设置了循环设置每个系列的颜色,但是没有生效。 问题2:请问在形状中如何插入像原型中一样的数据表格。 目前我用的是23.7版本。 代码如下: