/// <summary> /// Adds matching values to the <paramref name="grandTotalValueList"/> and <paramref name="grandGrandTotalValueList"/>. /// </summary> /// <param name="majorHeader">The major axis header.</param> /// <param name="majorIndex">The current major axis index.</param> /// <param name="minorIndex">The current minor axis index.</param> /// <param name="dataFieldCollectionIndex">The index of the data field in the data field collection.</param> /// <param name="grandTotalValueList">The list of values used to calculate grand totals for a row or column.</param> /// <param name="grandGrandTotalValueList">The list of values used to calcluate the grand-grand total values.</param> /// <returns>The index of the data field in the data field collection.</returns> protected override int AddMatchingValues( PivotTableHeader majorHeader, int majorIndex, int minorIndex, int dataFieldCollectionIndex, PivotCellBackingData[] grandTotalValueList, PivotCellBackingData[] grandGrandTotalValueList) { if (this.BackingData[majorIndex, minorIndex] == null) { return(dataFieldCollectionIndex); } var minorHeader = this.MinorHeaderCollection[minorIndex]; dataFieldCollectionIndex = this.PivotTable.HasRowDataFields ? majorHeader.DataFieldCollectionIndex : minorHeader.DataFieldCollectionIndex; if (minorHeader.IsLeafNode) { base.AddGrandTotalsBackingData(majorIndex, minorIndex, dataFieldCollectionIndex, grandTotalValueList); // Only add row header leaf node values for grand-grand totals. if (majorHeader.IsLeafNode) { base.AddGrandTotalsBackingData(majorIndex, minorIndex, dataFieldCollectionIndex, grandGrandTotalValueList); } } return(dataFieldCollectionIndex); }
/// <summary> /// Adds matching values to the <paramref name="grandTotalValueLists"/> and <paramref name="grandGrandTotalValueLists"/>. /// </summary> /// <param name="majorHeader">The major axis header.</param> /// <param name="majorIndex">The current major axis index.</param> /// <param name="minorIndex">The current minor axis index.</param> /// <param name="dataFieldCollectionIndex">The index of the data field in the data field collection.</param> /// <param name="grandTotalValueLists">The list of values used to calculate grand totals for a row or column.</param> /// <param name="grandGrandTotalValueLists">The list of values used to calcluate the grand-grand total values.</param> /// <returns>The index of the data field in the data field collection.</returns> protected abstract int AddMatchingValues( PivotTableHeader majorHeader, int majorIndex, int minorIndex, int dataFieldCollectionIndex, PivotCellBackingData[] grandTotalValueLists, PivotCellBackingData[] grandGrandTotalValueLists);
private bool TryFindMatchingHeaderIndex(PivotTableHeader header, Tuple <int, int> baseFieldItem, List <PivotTableHeader> headers, out int headerIndex) { headerIndex = -1; var index = header.CacheRecordIndices.FindIndex(i => i.Item1 == baseFieldItem.Item1); if (index >= 0) { // The value that this will be compared against is in the cell that matches this cell's // row and colum indices other than the base field/item indices. var indicesToMatch = header.CacheRecordIndices.ToList(); indicesToMatch[index] = baseFieldItem; headerIndex = headers.FindIndex(h => this.AreEquivalent(h.CacheRecordIndices, indicesToMatch)); return(headerIndex != -1); } return(false); }
private bool IsSibling(PivotTableHeader header, List <Tuple <int, int> > childIndices) { var possibleSiblingIndices = header.CacheRecordIndices; if (childIndices == null || possibleSiblingIndices == null || childIndices.Count <= 1 || childIndices.Count != possibleSiblingIndices.Count) { return(false); } for (int i = 0; i < childIndices.Count - 1; i++) { if (childIndices[i] != possibleSiblingIndices[i]) { return(false); } } return(true); }
/// <summary> /// Adds matching values to the <paramref name="grandTotalValueLists"/> and <paramref name="grandGrandTotalValueLists"/>. /// </summary> /// <param name="majorHeader">The major axis header.</param> /// <param name="majorIndex">The current major axis index.</param> /// <param name="minorIndex">The current minor axis index.</param> /// <param name="dataFieldCollectionIndex">The index of the data field in the data field collection.</param> /// <param name="grandTotalValueLists">The list of values used to calculate grand totals for a row or column.</param> /// <param name="grandGrandTotalValueLists">The list of values used to calcluate the grand-grand total values.</param> /// <returns>The index of the data field in the data field collection.</returns> protected override int AddMatchingValues( PivotTableHeader majorHeader, int majorIndex, int minorIndex, int dataFieldCollectionIndex, PivotCellBackingData[] grandTotalValueLists, PivotCellBackingData[] grandGrandTotalValueLists) { if (this.BackingData[minorIndex, majorIndex] == null) { return(dataFieldCollectionIndex); } var minorHeader = this.MinorHeaderCollection[minorIndex]; dataFieldCollectionIndex = this.PivotTable.HasRowDataFields ? minorHeader.DataFieldCollectionIndex : majorHeader.DataFieldCollectionIndex; if (minorHeader.IsLeafNode) { base.AddGrandTotalsBackingData(minorIndex, majorIndex, dataFieldCollectionIndex, grandTotalValueLists); } return(dataFieldCollectionIndex); }