Ejemplo n.º 1
0
        PivotData FillPivotData()
        {
            int columnCount = pivotGridControl1.Cells.ColumnCount,
                rowCount    = pivotGridControl1.Cells.RowCount;
            List <PivotGridField> columnFields = pivotGridControl1.GetFieldsByArea(PivotArea.ColumnArea),
                                  rowFields    = pivotGridControl1.GetFieldsByArea(PivotArea.RowArea);

            PivotData data = new PivotData(columnCount, rowCount,
                                           columnFields.Count, rowFields.Count);

            FillFieldValues(true, columnCount, columnFields, data);
            FillFieldValues(false, rowCount, rowFields, data);

            for (int i = 0; i < columnCount; i++)
            {
                for (int j = 0; j < rowCount; j++)
                {
                    PivotCellEventArgs info = pivotGridControl1.Cells.GetCellInfo(i, j);
                    if (info != null)
                    {
                        data.SetCellValue(i, j, info.Value);
                    }
                }
            }

            return(data);
        }
Ejemplo n.º 2
0
 void FillFieldValues(bool isColumn, int count, List <PivotGridField> fields, PivotData data)
 {
     for (int i = 0; i < count; i++)
     {
         FieldValue value = data.GetFieldValue(isColumn, i);
         value.ValueType = pivotGridControl1.GetFieldValueType(isColumn, i);
         value.DataField = pivotGridControl1.Cells.GetCellInfo(isColumn ? i : 0, isColumn ? 0 : i).DataField;
         for (int j = 0; j < fields.Count; j++)
         {
             value.SetValue(j, pivotGridControl1.GetFieldValue(fields[j], i), fields[j]);
         }
     }
 }
Ejemplo n.º 3
0
 void Form1_Load(object sender, EventArgs e)
 {
     // TODO: This line of code loads data into the 'nwindDataSet.CustomerReports' table. You can move, or remove it, as needed.
     this.customerReportsTableAdapter.Fill(this.nwindDataSet.CustomerReports);
     this.pivotData = FillPivotData();
 }