The C1.Web.Mvc.Olap assembly contains controls that allow you to add Excel-like pivot table and pivot chart features to your ASP.NET MVC applications.
Steps for getting started with the Olap module in MVC applications are as follows:
- Create a new MVC project using the C1 ASP.NET MVC application template, in Visual Studio IDE.
- Add a controller and a corresponding view to the project.
- Initialize the PivotEngine control in the view using razor syntax.
- Use the Bind method to bind an array containing the raw data that you want to analyze.
- Initialize a PivotPanel control and set its ItemsSourceId property to the PivotEngine control if you want to customize the view definition
- Add one or more PivotGrid and PivotChart controls to the page, and connect them to the PivotEngine by setting their ItemsSourceId property to the PivotEngine control or the PivotPanel control.
This will display a list of available fields in the PivotPanel, and users will be able to drag fields between summary areas to generate data summaries (also known as "views"). Users can also configure the fields by setting their headers, summary functions, filters, and formats.
Users can analyze the data and print the results, export them to XLSX or PDF, and save the view definitions to be re-used later.
Here is a simple example.
Adding a PivotEngine, a PivotPanel and a PivotGrid to the page
The PivotPanel control is similar to Microsoft Excel's "Field List" window, which is associated with pivot tables and charts.
Add fields to the view by dragging or using checkboxes.
Remove fields from the view by dragging them back to the top area, or by using their context menu.
Configure the fields by using their context menu. You can modify their header, summary function, and format. Note that the format is used while grouping the data. For instance, you can group the data by day, month, quarter or year by changing the format of the date fields .
The PivotGrid control extends the FlexGrid control to support pivoting features. These include custom cell merging, hierarchical row and column groups, and a custom context menu, which allows users to configure the pivot fields and to drill-down into the data items that were used in the computation of specific summary cells.