NReco.PivotDataPivotData
Namespace: NReco.PivotData
Assembly: NReco.PivotData (in NReco.PivotData.dll) Version: 1.4.1
public class PivotData : IPivotData, IEnumerable<KeyValuePair<Object[], IAggregator>>, IEnumerable
The PivotData type exposes the following members.
Name | Description | |
---|---|---|
PivotData(String, IAggregatorFactory) |
Initializes a new instance of the PivotData with specified dimensions and aggregator.
| |
PivotData(String, IAggregatorFactory, Boolean) |
Initializes a new instance of the PivotData with specified dimensions, aggregator and lazy totals mode.
| |
PivotData(String, IAggregatorFactory, IEnumerableIDictionaryString, Object) |
Initializes a new instance of the PivotData with specified dimensions, aggregator and processes specified data.
| |
PivotData(String, IAggregatorFactory, IDataReader) |
Initializes a new instance of the PivotData with specified dimensions, aggregator and processes data from data reader.
| |
PivotData(String, IAggregatorFactory, IEnumerableIDictionaryString, Object, Boolean) |
Initializes new instance of PivotData with specified dimensions, aggregator, lazy totals mode and processes specified data.
| |
PivotData(String, IAggregatorFactory, IEnumerable, FuncObject, String, Object) |
Initializes a new instance of the PivotData with specified dimensions, aggregator, and processes data from enumeration.
| |
PivotData(String, IAggregatorFactory, IDataReader, Boolean) |
Initializes a new instance of the PivotData with specified dimensions configuration, aggregator, lazy totals mode and and processes data from data reader.
| |
PivotData(String, IAggregatorFactory, IEnumerable, FuncObject, String, Object, Boolean) |
Initializes new instance of PivotData with specified dimensions configuration and calculates values for specified data
|
Name | Description | |
---|---|---|
AggregatorFactory |
Gets IAggregatorFactory instance used for creating measure value aggregators.
| |
AllValues |
Get all datapoints (dim keys -> aggregator pairs) contained in the PivotData (including totals).
| |
Count |
Gets the number of unique data point of this multidimensional dataset (calculated data points like totals are not included).
| |
Dimensions |
Gets dimension identifiers of the multidimensional dataset.
| |
ItemObject |
Gets aggegator by specified dimensions keys
| |
ItemValueKey |
Gets value by specified multidimensional key.
| |
LazyAdd |
Determines behaviour when non-existing key is accessed (true by default).
| |
LazyTotals |
Determines totals calculation mode. Lazy means that all totals/sub-totals are calculated on first use; otherwise totals/sub-totals are calculated on-the-fly.
|
Name | Description | |
---|---|---|
Clear |
Removes all dimension keys and values from the PivotData.
| |
CopyTo | Obsolete. | |
Equals | (Inherited from Object.) | |
Finalize | (Inherited from Object.) | |
GetDimensionKeys |
Returns keys of all PivotData dimensions
| |
GetDimensionKeys(String) |
Returns keys of specified dimensions
| |
GetDimensionKeys(String, IComparerObject) |
Returns keys of specified dimensions
| |
GetEnumerator | ||
GetHashCode | (Inherited from Object.) | |
GetState |
Returns compacted state object that contains all values of this PivotData.
| |
GetType | (Inherited from Object.) | |
MemberwiseClone | (Inherited from Object.) | |
Merge |
Modifies the current PivotData object to merge values from itself and specified PivotData.
| |
ProcessData(IEnumerableIDictionaryString, Object) |
Process data from specified list of dictionaries.
| |
ProcessData(IEnumerableDataRow) |
Process data from specified sequence of DataRow objects.
| |
ProcessData(IDataReader) |
Processes data from the specified IDataReader.
| |
ProcessData(IEnumerable, FuncObject, String, Object) |
Processes data from enumerable data.
| |
ProcessData(IPivotData, String) |
Processes data from the specified IPivotData instance and calculates PivotData values
| |
SetState |
Restores PivotData from specified state object.
| |
Slice(String, Boolean) | Obsolete. | |
Slice(String, Boolean, FuncKeyValuePairValueKey, IAggregator, Boolean) | Obsolete. | |
Slice(String, Boolean, FuncObject, IAggregator, Boolean) | Obsolete. | |
ToString | (Inherited from Object.) |
Name | Description | |
---|---|---|
ProcessData |
Processes data from specified IPivotDataSource instance.
(Defined by PivotDataExtensions.) |
PivotData can be used for fast data aggregation from any input source that implements IEnumerable interface.
Totals may be pre-calculated during data processing or calulated on-the-fly on the first access (LazyTotals). Lazy totals calculation mode is recommended for cases when cube has many dimensions and/or large number of unique dimension keys.
Thread safety: a PivotData can support multiple readers concurrently, as long as the data is not modified. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization. When data is processed with ProcessData(IEnumerableIDictionaryString, Object) enumerating through AllValues or GetEnumerator is intrinsically not a thread-safe procedure.
DataTable dataTbl; // lets assume it has columns: 'Delivery Year', 'Delivery Month', 'Supplier Name' var pvtData = new PivotData( new []{"Delivery Year", "Delivery Month", "Supplier Name"}, new CountAggregatorFactory(), true); pvtData.ProcessData( new DataTableReader(dataTbl) ); // real ADO.NET data reader can be used too
Measure aggregation logic is controlled by IAggregatorFactory implementations (each measure is represented by IAggregator instance). Several measures may be calculated at once using CompositeAggregatorFactory:
var pvtData = new PivotData( new string[]{"country","product"}, new CompositeAggregatorFactory( new CountAggregatorFactory(), new SumAggregatorFactory("amount") ), true );
var compositeAggr = pvtData["USA",null].AsComposite(); var countValue = compositeAggr.Aggregators[0].Value; // refers to CountAggregator var sumValue = compositeAggr.Aggregators[1].Value; // refers to SumAggregator