Client-Side API Reference > OLAP > wijmo.olap > PivotEngine Class |
constructor(options?: any): PivotEngine
Initializes a new instance of the PivotEngine class.
JavaScript object containing initialization data for the field.
Gets or sets a value that determines whether users should be allowed to edit the properties of the PivotField objects owned by this PivotEngine.
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.
Gets or sets a value that determines whether the engine should generate fields automatically based on the itemsSource.
Gets the list of PivotField objects that define the fields shown as columns in the output table.
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();
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.
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.
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.
Gets the list of PivotField objects that define the fields shown as rows in the output table.
Gets or sets a value that determines whether the output pivotView should include columns containing subtotals or grand totals.
Gets or sets a value that determines whether the output pivotView should include rows containing subtotals or grand totals.
Gets or sets a value that determines whether the Olap output table should use zeros to indicate the missing values.
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.
Gets the list of PivotField objects that define the fields summarized in the output table.
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; }
beginUpdate(): void
Suspends the refresh processes until next call to the endUpdate.
cancelPendingUpdates(): void
Cancels any pending asynchronous view updates.
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.
Function to be executed.
editField(field: PivotField): void
Shows a settings dialog where users can edit a field's settings.
PivotField to be edited.
endUpdate(): void
Resumes refresh processes suspended by calls to beginUpdate.
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.
getDetailView(item: any, binding: string): ICollectionView
Gets an ICollectionView containing the records summarized by a property in the pivotView list.
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.
invalidate(): void
Invalidates the view causing an asynchronous refresh.
onError(e: RequestErrorEventArgs): boolean
Raises the error event.
RequestErrorEventArgs that contains information about the error.
onItemsSourceChanged(e?: EventArgs): void
Raises the itemsSourceChanged event.
onUpdatedView(e?: EventArgs): void
Raises the updatedView event.
onUpdatingView(e: ProgressEventArgs): void
Raises the updatingView event.
ProgressEventArgs that provides the event data.
onViewDefinitionChanged(e?: EventArgs): void
Raises the viewDefinitionChanged event.
refresh(force?: boolean): void
Summarizes the data and updates the output pivotView.
removeField(field: PivotField): void
Removes a field from the current view.
PivotField to be removed.
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.