javaaspose.words

Creating clustered bar chart using Aspose.Words


Is there any way to draw clustered bar chart in word document using Aspose.Words in java? Please find the below image for clustered bar chart.

Clustered bar chart


Solution

  • You can use DocumentBuilder.insertChart method to create chart using Aspose.Words. Also see Aspose.Words documentation to learn more about creating charts. In your case you should use ChartType.BAR.

    Document doc = new Document();
    DocumentBuilder builder = new DocumentBuilder(doc);
    
    Shape chartShape = builder.insertChart(ChartType.BAR, 200, 300);
    
    // Chart is created with default data
    // here you can modify the chart data
    // .....
    
    doc.save("C:\\Temp\\out.docx");