ASP.NET MVC Controls
PivotEngine Class
File
wijmo.olap.js
Module
wijmo.olap

Provides a user interface for interactively transforming regular data tables into Olap pivot tables.

Tabulates data in the itemsSource collection according to lists of fields and creates the pivotView collection containing the aggregated data.

Pivot tables group data into one or more dimensions. The dimensions are represented by rows and columns on a grid, and the data is stored in the grid cells.

Constructor

Properties

Methods

Events

Constructor

constructor

constructor(options?: any): PivotEngine

Initializes a new instance of the PivotEngine class.

Parameters
Returns
PivotEngine

Properties

allowFieldEditing

Gets or sets a value that determines whether users should be allowed to edit the properties of the PivotField objects owned by this PivotEngine.

Type
boolean

async

Gets or sets a value that determines whether view updates should be generated asynchronously.

This property is set to true by default, so summaries over large data sets are performed asynchronously to prevent stopping the UI thread.

Type
boolean

autoGenerateFields

Gets or sets a value that determines whether the engine should generate fields automatically based on the itemsSource.

Type
boolean

collectionView

Gets the ICollectionView that contains the raw data.

Type
ICollectionView

columnFields

Gets the list of PivotField objects that define the fields shown as columns in the output table.

Type
PivotFieldCollection

defaultFilterType

Gets or sets the default filter type (by value or by condition).

Type
FilterType

fields

Gets the list of PivotField objects exposed by the data source.

This list is created automatically whenever the itemsSource property is set.

Pivot views are defined by copying fields from this list to the lists that define the view: valueFields, rowFields, columnFields, and filterFields.

For example, the code below assigns a data source to the PivotEngine and then defines a view by adding fields to the rowFields, columnFields, and valueFields lists.

// create pivot engine
var pe = new wijmo.olap.PivotEngine();

// set data source (populates fields list)
pe.itemsSource = this.getRawData();

// prevent updates while building Olap view
pe.beginUpdate();

// show countries in rows
pe.rowFields.push('Country');

// show categories and products in columns
pe.columnFields.push('Category');
pe.columnFields.push('Product');

// show total sales in cells
pe.valueFields.push('Sales');

// done defining the view
pe.endUpdate();
Type
PivotFieldCollection

filterFields

Gets the list of PivotField objects that define the fields used as filters.

Fields on this list do not appear in the output table, but are still used for filtering the input data.

Type
PivotFieldCollection

isUpdating

Gets a value that indicates whether the engine is currently being updated.

Type
boolean

isViewDefined

Gets a value that determines whether a pivot view is currently defined.

A pivot view is defined if the valueFields list is not empty and either the rowFields or columnFields lists are not empty.

Type
boolean

itemsSource

Gets or sets the array or ICollectionView that contains the data to be analyzed, or a string containing the URL for a ComponentOne DataEngine service.

ComponentOne DataEngine services allow you to analyze large datasets on a server without downloading the raw data to the client. You can use our high-performance FlexPivot services or interface with Microsoft's SQL Server Analysis Services OLAP Cubes.

The PivotEngine sends view definitions to the server, where summaries are calculated and returned to the client.

For more information about the ComponentOne DataEngine services please refer to the online documentation.

Type
any

pivotView

Gets the ICollectionView containing the output pivot view.

Type
ICollectionView

rowFields

Gets the list of PivotField objects that define the fields shown as rows in the output table.

Type
PivotFieldCollection

showColumnTotals

Gets or sets a value that determines whether the output pivotView should include columns containing subtotals or grand totals.

Type
ShowTotals

showRowTotals

Gets or sets a value that determines whether the output pivotView should include rows containing subtotals or grand totals.

Type
ShowTotals

showZeros

Gets or sets a value that determines whether the Olap output table should use zeros to indicate the missing values.

Type
boolean

totalsBeforeData

Gets or sets a value that determines whether row and column totals should be displayed before or after regular data rows and columns.

If this value is set to true, total rows appear above data rows and total columns appear on the left of regular data columns.

Type
boolean

valueFields

Gets the list of PivotField objects that define the fields summarized in the output table.

Type
PivotFieldCollection

viewDefinition

Gets or sets the current pivot view definition as a JSON string.

This property is typically used to persist the current view as an application setting.

For example, the code below implements two functions that save and load view definitions using local storage:

// save/load views
function saveView() {
  localStorage.viewDefinition = pivotEngine.viewDefinition;
}
function loadView() {
  pivotEngine.viewDefinition = localStorage.viewDefinition;
}
Type
string

Methods

beginUpdate

beginUpdate(): void

Suspends the refresh processes until next call to the endUpdate.

Returns
void

cancelPendingUpdates

cancelPendingUpdates(): void

Cancels any pending asynchronous view updates.

Returns
void

deferUpdate

deferUpdate(fn: Function): void

Executes a function within a beginUpdate/endUpdate block.

The control will not be updated until the function has been executed. This method ensures endUpdate is called even if the function throws an exception.

Parameters
Returns
void

editField

editField(field: PivotField): void

Shows a settings dialog where users can edit a field's settings.

Parameters
Returns
void

endUpdate

endUpdate(): void

Resumes refresh processes suspended by calls to beginUpdate.

Returns
void

getDetail

getDetail(item: any, binding: string): any[]

Gets an array containing the records summarized by a property in the pivotView list.

If the engine is connected to a PivotEngine server, the value returned is an ObservableArray that is populated asynchronously.

Parameters
  • item: any

    Data item in the pivotView list.

  • binding: string

    Name of the property being summarized.

Returns
any[]

getDetailView

getDetailView(item: any, binding: string): ICollectionView

Gets an ICollectionView containing the records summarized by a property in the pivotView list.

Parameters
  • item: any

    Data item in the pivotView list.

  • binding: string

    Name of the property being summarized.

Returns
ICollectionView

getKeys

getKeys(item: any, binding: string): any

Gets an object with information about a property in the pivotView list.

The object returned has two properties, 'rowKey' and 'colKey'. Each of these contains two arrays, 'fields' and 'values'. Together, this information uniquely identifies a value summarized by the PivotEngine.

For example, calling getKeys against a pivot view with two row fields 'Product' and 'Country', and a single column field 'Active' would return an object such as this one:

{
    rowKey: {
        fields: [ 'Product', 'Country'],
        values: [ 'Aoba', 'Japan' ]
    },
    colKey: {
        fields: [ 'Active' ],
        values: [ true ]
    }
}

The object identifies the subset of data used to obtain one summary value. In this case, this value represents all data items for product 'Aoba' sold in Japan with active state set to true.

Parameters
  • item: any

    Data item in the pivotView list.

  • binding: string

    Name of the property being summarized.

Returns
any

invalidate

invalidate(): void

Invalidates the view causing an asynchronous refresh.

Returns
void

onError

onError(e: RequestErrorEventArgs): boolean

Raises the error event.

Parameters
Returns
boolean

onItemsSourceChanged

onItemsSourceChanged(e?: EventArgs): void

Raises the itemsSourceChanged event.

Parameters
Returns
void

onUpdatedView

onUpdatedView(e?: EventArgs): void

Raises the updatedView event.

Parameters
Returns
void

onUpdatingView

onUpdatingView(e: ProgressEventArgs): void

Raises the updatingView event.

Parameters
Returns
void

onViewDefinitionChanged

onViewDefinitionChanged(e?: EventArgs): void

Raises the viewDefinitionChanged event.

Parameters
Returns
void

refresh

refresh(force?: boolean): void

Summarizes the data and updates the output pivotView.

Parameters
Returns
void

removeField

removeField(field: PivotField): void

Removes a field from the current view.

Parameters
Returns
void

Events

error

Occurs when there is an error getting data from the server.

Arguments
RequestErrorEventArgs

itemsSourceChanged

Occurs after the value of the itemsSource property changes.

Arguments
EventArgs

updatedView

Occurs after the engine has finished updating the pivotView list.

Arguments
EventArgs

updatingView

Occurs when the engine starts updating the pivotView list.

Arguments
ProgressEventArgs

viewDefinitionChanged

Occurs after the view definition changes.

Arguments
EventArgs

 

 


Copyright © GrapeCity, inc. All rights reserved.

Product Support Forum |  Documentation Feedback