Column Chart in Spreadsheet Document
Leave feedback
NoteIn this article, we will use GroupDocs.Assembly to generate a Column Chart Report with Filtered, Ordered and Grouped Data in Spreadsheet Document format.
NoteThe code uses some of the objects defined in The Business Layer.
Following below steps, you can create column chart in MS Excel 2013:
- Create a new Workbook.
- Click the “Insert” tab, and then click “Insert Column Chart” icon in the Charts group to view the drop-down list.
- Select the “100% Stacked Column” and press “OK” to insert the chart and Worksheet template to your Worksheet.
- Edit the Worksheet with your data to update the chart. See Chart Data.
- Save your Document.
As a report developer, you are required to share orders quantity of the customers dynamically with the following key requirements:
- Report must show total Contract Prices by Quarters
- Report must be generated in the Spreadsheet Document.
Total Contract Prices by Quarters<<foreach [in getContracts()
.where(c => c.getDate().getYear() + 1900 == 2015)
.groupBy(c => c.getManager())
.orderBy(g => g.key.getName())]>><<x [key.getName()]>>
Legend Entries
="1st Quarter<<y [where(c => c.getDate().getMonth() >= 0 && c.getDate().getMonth() <= 2).sum(c => c.getPrice())]>>"
="2nd Quarter<<y [where(c => c.getDate().getMonth() >= 3 && c.getDate().getMonth() <= 5).sum(c => c.getPrice())]>>"
="3rd Quarter<<y [where(c => c.getDate().getMonth() >= 6 && c.getDate().getMonth() <= 8).sum(c => c.getPrice())]>>"
="4th Quarter<<y [where(c => c.getDate().getMonth() >= 9 && c.getDate().getMonth() <= 11).sum(c => c.getPrice())]>>"
Please download the sample Chart with Filtering, Grouping, and Ordering document we created in this article:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-assembly/GroupDocs.Assembly-for-Java | |
String srcDocument = "/Spreadsheet Templates/Chart with Filtering, Grouping, and Ordering.xlsx"; | |
String docReport = "/Spreadsheet Reports/Chart with Filtering, Grouping, and Ordering_report.xlsx"; | |
try { | |
DocumentAssembler assembler = new DocumentAssembler(); | |
assembler.assembleDocument(CommonUtilities.getTestDataPath(srcDocument), | |
CommonUtilities.getTestOutPath(docReport), new DataSourceInfo(new DataStorage(), null)); | |
} catch (Exception exp) { | |
System.out.println("Exception: " + exp.getMessage()); | |
} |
To be investigated.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.