Exemplo n.º 1
0
        private void InitializeGrid()
        {
            pivotGridControl1.GridVisualStyles = GridVisualStyles.Metro;
            pivotGridControl1.ItemSource       = ProductSalesData.GetSalesData();

            //used to add PivotRows.
            pivotGridControl1.PivotRows.Add(new PivotItem {
                FieldMappingName = "Product", TotalHeader = "Total"
            });
            pivotGridControl1.PivotRows.Add(new PivotItem {
                FieldMappingName = "Date", TotalHeader = "Total"
            });

            //used to add PivotColumns.
            pivotGridControl1.PivotColumns.Add(new PivotItem {
                FieldMappingName = "Country", TotalHeader = "Total"
            });
            pivotGridControl1.PivotColumns.Add(new PivotItem {
                FieldMappingName = "State", TotalHeader = "Total"
            });

            //used to add PivotCalculations.
            pivotGridControl1.PivotCalculations.Add(new PivotComputationInfo {
                FieldName = "Amount", Format = "C", SummaryType = SummaryType.DoubleTotalSum
            });
            pivotGridControl1.PivotCalculations.Add(new PivotComputationInfo {
                FieldName = "Quantity", Format = "#,##0"
            });

            //shows the pivot table field list.
            pivotGridControl1.ShowPivotTableFieldList = true;

            pivotGridControl1.ShowGroupBar = true;
            pivotGridControl1.TableControl.FreezeHeaders = true;
        }
Exemplo n.º 2
0
        private void InitializePivotChart()
        {
            // Adding ItemSource to the Control
            this.pivotChart1.ItemSource = ProductSalesData.GetSalesData();

            // Adding PivotAxis to the Control
            this.pivotChart1.PivotAxis.Add(new PivotItem {
                FieldMappingName = "Product", TotalHeader = "Total"
            });
            this.pivotChart1.PivotAxis.Add(new PivotItem {
                FieldMappingName = "Date", TotalHeader = "Total"
            });

            // Adding PivotLegend to the Control
            this.pivotChart1.PivotLegend.Add(new PivotItem {
                FieldMappingName = "Country", TotalHeader = "Total"
            });

            // Adding PivotCalculations to the Control
            this.pivotChart1.PivotCalculations.Add(new PivotComputationInfo {
                FieldName = "Quantity", Format = "#,##0"
            });
            this.pivotChart1.PrimaryXAxis.InterlacedGrid = this.checkBox1.Checked;
            this.pivotChart1.PrimaryYAxis.InterlacedGrid = this.checkBox2.Checked;
        }