Data Compression in ASP.NET CORE Pivot Table component

19 Mar 20242 minutes to read

NOTE

This property is applicable only for relational data source.

When binding one million raw data, the pivot table processes all raw data to generate aggregated data during initial rendering and report manipulation. However, with data compression, the input raw data is compressed based on the uniqueness of the raw data, and the final compressed raw data are utilized by the pivot table. The compressed raw data is then used for further operations at all times, reducing the looping complexity and improving the performance of the pivot table. For example, if the pivot table is connected to one million raw data compressed to 1,000 unique raw data, it will render within 3 seconds rather than 10 seconds. You can enable this option by using the allowDataCompression property along with the enableVirtualization property.

NOTE

This options will only function when the virtual scrolling is enabled.

<ejs-pivotview id="PivotView" height="300" width="800" allowDataCompression="true" enableVirtualization="true">
    <e-datasourcesettings dataSource="@ViewBag.DataSource" expandAll="true">        
        <e-rows>
            <e-field name="Country"></e-field>
            <e-field name="Products"></e-field>
        </e-rows>
        <e-columns>
            <e-field name="Year" caption="Year"></e-field>
            <e-field name="Quarter"></e-field>
        </e-columns>
        <e-values>
            <e-field name="Sold" caption="Units Sold"></e-field>
            <e-field name="Amount" caption="Sold Amount"></e-field>
        </e-values>
    </e-datasourcesettings>
</ejs-pivotview>
public ActionResult Index()
{
    var data = GetPivotData();
    ViewBag.DataSource = data;
    return View();
}

Limitations during data compression:

  • The following aggregation types will not be supported:
    • Average
    • Populationstdev
    • Samplestdev
    • Populationvar
    • Samplevar
  • If you use any of the above aggregations, they will result in the aggregation type “Sum”.
  • “DistinctCount” will act as “Count” aggregation type.
  • In the calculated field, an existing field can be inserted without altering its default aggregation type. Even if changed, it would revert to the default aggregation type for calculation.