PivotTable ClassNReco.PivotData Class Library Documentation
Represents 2D Pivot Table view for multidimensional array (IPivotData).
Inheritance Hierarchy

System Object
  NReco.PivotData PivotTable

Namespace: NReco.PivotData
Assembly: NReco.PivotData (in NReco.PivotData.dll) Version: 1.3.4
Syntax

public class PivotTable : IPivotTable

The PivotTable type exposes the following members.

Constructors

  NameDescription
Public methodPivotTable( String ,  String , IPivotData)
Initializes a new instance of PivotTable instance by specified PivotData
Public methodPivotTable( String ,  String , IPivotData, IComparer ValueKey , IComparer ValueKey )
Initializes a new instance of PivotTable instance by specified PivotData
Top
Methods

  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetValue
Gets value for specified row and column keys.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodSortColumnKeys(Nullable Int32 , ListSortDirection)
Sort columns by specified row values.
Public methodSortColumnKeys(Nullable Int32 , Int32, ListSortDirection)
Sort columns by specified row values
Public methodSortColumnKeysByRowKey
Sort columns by specified row key.
Protected methodSortKeys
Performs inital ordering of pivot table rows/columns keys
Public methodSortRowKeys(Nullable Int32 , ListSortDirection)
Sort rows by specified column values.
Public methodSortRowKeys(Nullable Int32 , Int32, ListSortDirection)
Sort rows by specified column values.
Public methodSortRowKeysByColumnKey
Sort rows by specified column key.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Properties

  NameDescription
Public propertyColumnKeys
Dimension keys that represent columns of the pivot table
Public propertyColumns
Dimensions used for building columns of the pivot table
Public propertyItem
Gets aggregator for specified row and column indexes
Public propertyPivotData
Gets the IPivotData used for building pivot table.
Public propertyPreserveGroupOrder
Public propertyRowKeys
Dimension keys that represent rows of the pivot table
Public propertyRows
Dimensions used for building rows of the pivot table
Top
Remarks

PivotTable provides an API for building pivot table report from multidimensional array represented by IPivotData instance. Configuration is rather simple: all it needs is a list of dimensions for building rows and columns (it may use only subset of dimensions available in specified PivotData instance). Also it supports table sorting by column or row values (or by totals).
Examples

The following code snippet illustrates how to use PivotTable:
PivotData pvtData; 
var pvtTbl = new PivotTable(
    new [] {"country", "city" }, // rows are cities grouped by country 
    new [] {"company"},  // columns are companines
    pvtData);
for (var r=0; r<pvtTbl.RowKeys.Length; r++) {
    for (var c=0; c<pvtTbl.ColumnKeys.Length; c++) {
        Console.Write("{0}\t", pvtTbl[r,c].Value);
    }
    Console.WriteLine();
}
See Also