How can I help you?
Data Compression in ASP.NET MVC PivotView component
26 Feb 20262 minutes to read
This property is applicable only for the relational data source.
When binding large volumes of raw data, the pivot table processes all raw data to generate aggregated data during initial rendering and report manipulation. However, with data compression enabled, the input raw data is compressed based on the uniqueness of the raw data, and the final compressed raw data is utilized by the pivot table. The compressed raw data is then used for all subsequent operations, reducing the looping complexity and improving the performance of the pivot table. For example, if the pivot table connects to one million raw data records that compress to 1,000 unique raw data records, it will render significantly faster—potentially within 3 seconds rather than 10 seconds, depending on the data complexity and system specifications. Enable this option by using the AllowDataCompression property along with the EnableVirtualization property.
@using Syncfusion.EJ2.PivotView
@Html.EJS().PivotView("PivotView").Height(300).Width(800).DataSourceSettings(dataSource => dataSource.DataSource((IEnumerable<object>)ViewBag.DataSource).ExpandAll(true)
.Rows(rows =>
{
rows.Name("Country").Add(); rows.Name("Products").Add();
}).Columns(columns =>
{
columns.Name("Year").Caption("Year").Add(); columns.Name("Quarter").Add();
}).Values(values =>
{
values.Name("Sold").Caption("Units Sold").Add(); values.Name("Amount").Caption("Sold Amount").Add();
})).EnableVirtualization(true).AllowDataCompression(true).Render()public ActionResult Index()
{
var data = GetPivotData();
ViewBag.DataSource = data;
return View();
}Limitations during data compression:
- The following aggregation types are not supported:
- Average
- PopulationStDev
- SampleStDev
- PopulationVar
- SampleVar
- If any of the above aggregation types are used, they will be automatically converted to “Sum” aggregation.
- “DistinctCount” will function as “Count” aggregation type.
- In a calculated field, existing fields can be inserted without changing their default aggregation type. Even if the aggregation type is changed, it will revert to the default aggregation type for calculation purposes.