private GridDashboardItem CreateGrid(DashboardExcelDataSource dataSource)
        {
            // Creates a grid dashboard item and specifies its data source.
            GridDashboardItem grid = new GridDashboardItem();

            grid.DataSource = dataSource;

            // Creates new grid columns of the specified type and with the specified dimension or
            // measure. Then, adds these columns to the grid's Columns collection.
            grid.Columns.Add(new GridHyperlinkColumn(new Dimension("Product"), "Product")
            {
                UriPattern = "https://www.google.com/search?q={0}"
            });
            grid.Columns.Add(new GridDimensionColumn(new Dimension("Category")));
            grid.Columns.Add(new GridMeasureColumn(new Measure("Count")));
            grid.Columns.Add(new GridDeltaColumn(new Measure("Count"),
                                                 new Measure("TargetCount")));
            grid.Columns.Add(new GridSparklineColumn(new Measure("Count")));
            grid.SparklineArgument = new Dimension("Date", DateTimeGroupInterval.MonthYear);

            grid.GridOptions.EnableBandedRows    = true;
            grid.GridOptions.ShowHorizontalLines = false;

            return(grid);
        }
Esempio n. 2
0
        private Dashboard CreateDashboard()
        {
            Dashboard dashboard = new Dashboard();
            DashboardObjectDataSource objectDataSource = new DashboardObjectDataSource("MyDataSource");

            objectDataSource.DataSource = typeof(Data);
            objectDataSource.DataMember = "CreateData";
            dashboard.DataSources.Add(objectDataSource);

            // Creates a Pie dashboard item that displays a percentage of quantity summary for top 3 sales persons.
            PieDashboardItem pies = new PieDashboardItem();

            pies.DataSource = dashboard.DataSources[0];
            Dimension salesPersonArgument = new Dimension("SalesPerson");
            Measure   quantity            = new Measure("Quantity");

            pies.Arguments.Add(salesPersonArgument);
            salesPersonArgument.TopNOptions.Enabled = true;
            salesPersonArgument.TopNOptions.Count   = 3;
            salesPersonArgument.TopNOptions.Measure = quantity;
            pies.LabelPosition = PointLabelPosition.Inside;
            pies.Values.Add(quantity);

            // Creates a Grid dashboard item that displays sales persons and quantities.
            GridDashboardItem grid = new GridDashboardItem();

            grid.DataSource = dashboard.DataSources[0];
            grid.Columns.Add(new GridDimensionColumn(new Dimension("SalesPerson")));
            grid.Columns.Add(new GridMeasureColumn(new Measure("Quantity")));

            dashboard.Items.AddRange(pies, grid);
            return(dashboard);
        }
        private static void AddRowsByGridDashboardItem(GridDashboardItem gridItem, MultiDimensionalData mData, DataTable dataTable)
        {
            IList <string> axis     = mData.GetAxisNames();
            int            rowCount = GetRowCount(mData, axis);

            for (int i = 0; i < rowCount; i++)
            {
                AxisPoint point  = mData.GetAxisPoints(axis[0])[i];
                DataRow   newRow = dataTable.NewRow();
                foreach (GridColumnBase column in gridItem.Columns)
                {
                    GridMeasureColumn mCol = column as GridMeasureColumn;
                    if (mCol != null)
                    {
                        newRow[mCol.Measure.DataMember] = GetMesureValue(mData, point, mCol);
                    }

                    GridDimensionColumn dCol = column as GridDimensionColumn;
                    if (dCol != null)
                    {
                        newRow[dCol.Dimension.DataMember] = GetDimenstionValue(mData, axis, point, dCol);
                    }
                }
                dataTable.Rows.Add(newRow);
            }
        }
        private Dashboard CreateSimpleDashboard()
        {
            Dashboard dashboard = new Dashboard();
            DashboardObjectDataSource dataSource = new DashboardObjectDataSource();

            dashboard.DataSources.Add(dataSource);

            GridDashboardItem gridItem = new GridDashboardItem()
            {
                ComponentName = "grid1"
            };

            gridItem.DataSource = dataSource;
            gridItem.Columns.Add(new GridDimensionColumn(new Dimension("Country")));
            gridItem.Columns.Add(new GridMeasureColumn(new Measure("Sales")));

            PieDashboardItem pieItem = new PieDashboardItem()
            {
                ComponentName = "pie1"
            };

            pieItem.DataSource = dataSource;
            pieItem.Values.Add(new Measure("Sales"));
            pieItem.Arguments.Add(new Dimension("Country"));

            dashboard.Items.AddRange(gridItem, pieItem);

            return(dashboard);
        }
Esempio n. 5
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            Dashboard dashboard = new Dashboard();
            DashboardObjectDataSource objectDataSource = new DashboardObjectDataSource("Data Source 1");

            objectDataSource.DataSource = typeof(Data);
            objectDataSource.DataMember = "CreateData";
            dashboard.DataSources.Add(objectDataSource);

            // Creates a Pie dashboard item that displays share of sold units quantity per sales person.
            PieDashboardItem pies = new PieDashboardItem();

            pies.DataSource = dashboard.DataSources[0];
            Dimension salesPersonArgument = new Dimension("SalesPerson");
            Measure   quantity            = new Measure("Quantity");

            pies.Arguments.Add(salesPersonArgument);
            salesPersonArgument.TopNOptions.Enabled = true; salesPersonArgument.TopNOptions.Count = 3;
            salesPersonArgument.TopNOptions.Measure = quantity;
            pies.Values.Add(quantity);

            // Creates a Grid dashboard item that displays sales persons and corresponding quantities.
            GridDashboardItem grid = new GridDashboardItem();

            grid.DataSource = dashboard.DataSources[0];
            grid.Columns.Add(new GridDimensionColumn(new Dimension("SalesPerson")));
            grid.Columns.Add(new GridMeasureColumn(new Measure("Quantity")));

            dashboard.Items.AddRange(pies, grid);
            dashboardViewer1.Dashboard = dashboard;
        }
        public Form1()
        {
            InitializeComponent();
            dashboardDesigner1.CreateRibbon();

            Dashboard dashboard = new Dashboard();

            DashboardExcelDataSource excelDataSource = new DashboardExcelDataSource("Excel Data Source");

            excelDataSource.FileName      = @"..\..\Data\GDPByCountry.xlsx";
            excelDataSource.SourceOptions = new ExcelSourceOptions(new ExcelWorksheetSettings("Sheet1"));
            dashboard.DataSources.Add(excelDataSource);

            GridDashboardItem grid = new GridDashboardItem();

            grid.DataSource = excelDataSource;

            // Creates two hyperlink columns: the first column takes hyperlinks from the underlying data source while the second
            // generates links based on the specified URI pattern and data source country names.
            GridHyperlinkColumn hyperlinkColumn1 = new GridHyperlinkColumn(new Dimension("Uri"), new Dimension("OfficialName"));
            GridHyperlinkColumn hyperlinkColumn2 = new GridHyperlinkColumn(new Dimension("Name"), new Dimension("OfficialName"));

            hyperlinkColumn2.UriPattern = "https://en.wikipedia.org/wiki/{0}";

            GridMeasureColumn gdpColumn = new GridMeasureColumn(new Measure("GDP"));

            grid.Columns.AddRange(hyperlinkColumn1, hyperlinkColumn2, gdpColumn);
            dashboard.Items.Add(grid);
            dashboardDesigner1.Dashboard = dashboard;
        }
Esempio n. 7
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            Dashboard dashboard = new Dashboard();

            DashboardObjectDataSource dataSource = new DashboardObjectDataSource("Data Source 1");

            dashboardViewer1.DataLoading += (s, ev) => {
                if (ev.DataSourceName == "Data Source 1")
                {
                    ev.Data = Data.CreateData();
                }
            };
            dashboard.DataSources.Add(dataSource);

            PieDashboardItem pies = new PieDashboardItem();

            pies.DataSource = dashboard.DataSources[0];
            Dimension salesPersonArgument = new Dimension("SalesPerson");
            Measure   quantity            = new Measure("Quantity");

            pies.Arguments.Add(salesPersonArgument);
            salesPersonArgument.TopNOptions.Enabled = true; salesPersonArgument.TopNOptions.Count = 3;
            salesPersonArgument.TopNOptions.Measure = quantity;
            pies.Values.Add(quantity);

            GridDashboardItem grid = new GridDashboardItem();

            grid.DataSource = dashboard.DataSources[0];
            grid.Columns.Add(new GridDimensionColumn(new Dimension("SalesPerson")));
            grid.Columns.Add(new GridMeasureColumn(new Measure("Quantity")));

            dashboard.Items.AddRange(pies, grid);
            dashboardViewer1.Dashboard = dashboard;
        }
Esempio n. 8
0
        private Dashboard CreateDashboard(IDashboardDataSource dataSource)
        {
            Dashboard newDashboard = new Dashboard();

            newDashboard.DataSources.Add(dataSource);

            ChartDashboardItem chart = new ChartDashboardItem
            {
                DataSource = dataSource,
                DataMember = "Query 1"
            };

            chart.Arguments.Add(new Dimension("OrderDate", DateTimeGroupInterval.MonthYear));
            chart.Panes.Add(new ChartPane());
            SimpleSeries salesAmountSeries = new SimpleSeries(SimpleSeriesType.SplineArea)
            {
                Value = new Measure("ExtendedPrice")
            };

            chart.Panes[0].Series.Add(salesAmountSeries);

            GridDashboardItem grid = new GridDashboardItem
            {
                DataSource = dataSource,
                DataMember = "Query 1"
            };

            grid.Columns.Add(new GridDimensionColumn(new Dimension("SalesPerson")));
            grid.Columns.Add(new GridMeasureColumn(new Measure("ExtendedPrice")));

            newDashboard.Items.AddRange(chart, grid);
            return(newDashboard);
        }
        private void UpdateBarOptions()
        {
            GridDashboardItem         grid       = (GridDashboardItem)dashboardViewer1.Dashboard.Items[0];
            FormatConditionBarOptions barOptions = ((FormatConditionBar)(grid.FormatRules[0]).Condition).BarOptions;

            barOptions.AllowNegativeAxis = checkBox1.Checked;
            barOptions.DrawAxis          = checkBox2.Checked;
            barOptions.ShowBarOnly       = checkBox3.Checked;
        }
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            GridDashboardItem grid = dashboardViewer1.Dashboard.Items[0] as GridDashboardItem;
            string            path = grid.Name + ".xlsx";

            DataTable table = GridDashboardItemToDataTableHelper.CreateDataTableByGridDashboardItem(grid, dashboardViewer1);

            new XtraReport1(table).ExportToXlsx(path);
            Process.Start(path);
        }
        public static DataTable CreateDataTableByGridDashboardItem(GridDashboardItem gridItem, DashboardViewer viewer)
        {
            DataTable dataTable = null;

            if (gridItem != null)
            {
                MultiDimensionalData mData = viewer.GetItemData(gridItem.ComponentName);
                dataTable = new DataTable();

                CreateColumnsByGridDashboardItem(gridItem, dataTable);

                AddRowsByGridDashboardItem(gridItem, mData, dataTable);
            }
            return(dataTable);
        }
        private void button1_Click(object sender, System.EventArgs e)
        {
            GridDashboardItem  grid      = (GridDashboardItem)dashboardViewer1.Dashboard.Items[0];
            GridItemFormatRule rangeRule = grid.FormatRules[0];

            FormatConditionGradientRangeBar rangeCondition =
                (FormatConditionGradientRangeBar)rangeRule.Condition;

            rangeCondition.Generate(new BarStyleSettings(Color.PaleVioletRed),
                                    new BarStyleSettings(Color.PaleGreen), 9);
            RangeInfo middleRange = rangeCondition.RangeSet[4];

            middleRange.StyleSettings = new BarStyleSettings(Color.SkyBlue);

            rangeRule.Condition = rangeCondition;
        }
        public Form1()
        {
            InitializeComponent();
            Dashboard dashboard = new Dashboard(); dashboard.LoadFromXml(@"..\..\Data\Dashboard.xml");

            dashboardViewer1.Dashboard = dashboard;
            GridDashboardItem   grid          = (GridDashboardItem)dashboard.Items["gridDashboardItem1"];
            GridDimensionColumn salesPerson   = (GridDimensionColumn)grid.Columns[0];
            GridMeasureColumn   extendedPrice = (GridMeasureColumn)grid.Columns[1];

            GridItemFormatRule       topRule      = new GridItemFormatRule(extendedPrice, salesPerson);
            FormatConditionTopBottom topCondition = new FormatConditionTopBottom();

            topCondition.TopBottom     = DashboardFormatConditionTopBottomType.Top;
            topCondition.RankType      = DashboardFormatConditionValueType.Number;
            topCondition.Rank          = 3;
            topCondition.StyleSettings = new IconSettings(FormatConditionIconType.IndicatorGreenCheck);
            topRule.Condition          = topCondition;

            GridItemFormatRule       bottomRule      = new GridItemFormatRule(extendedPrice, salesPerson);
            FormatConditionTopBottom bottomCondition = new FormatConditionTopBottom();

            bottomCondition.TopBottom     = DashboardFormatConditionTopBottomType.Bottom;
            bottomCondition.RankType      = DashboardFormatConditionValueType.Percent;
            bottomCondition.Rank          = 40;
            bottomCondition.StyleSettings = new IconSettings(FormatConditionIconType.IndicatorRedFlag);
            bottomRule.Condition          = bottomCondition;

            GridItemFormatRule     aboveAverageRule      = new GridItemFormatRule(extendedPrice);
            FormatConditionAverage aboveAverageCondition = new FormatConditionAverage();

            aboveAverageCondition.AverageType   = DashboardFormatConditionAboveBelowType.Above;
            aboveAverageCondition.StyleSettings =
                new AppearanceSettings(Color.Green, FontStyle.Underline);
            aboveAverageRule.Condition = aboveAverageCondition;

            GridItemFormatRule     belowAverageRule      = new GridItemFormatRule(extendedPrice);
            FormatConditionAverage belowAverageCondition = new FormatConditionAverage();

            belowAverageCondition.AverageType   = DashboardFormatConditionAboveBelowType.Below;
            belowAverageCondition.StyleSettings =
                new AppearanceSettings(Color.Orange, FontStyle.Underline);
            belowAverageRule.Condition = belowAverageCondition;

            grid.FormatRules.AddRange(topRule, bottomRule, aboveAverageRule, belowAverageRule);
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            // Creates the Excel data source.
            DashboardExcelDataSource excelDataSource = new DashboardExcelDataSource();

            excelDataSource = CreateExcelDataSource();

            // Creates the Grid dashboard item and adds it to a dashboard.
            dashboardViewer1.Dashboard = new Dashboard();
            dashboardViewer1.Dashboard.DataSources.Add(excelDataSource);
            GridDashboardItem grid = CreateGrid(excelDataSource);

            dashboardViewer1.Dashboard.Items.Add(grid);

            // Reloads data in the data sources.
            dashboardViewer1.ReloadData();
        }
        public static DashboardItem GenerateGridItem(IDashboardDataSource dataSource, string itemComponentName)
        {
            GridDashboardItem gridItem = new GridDashboardItem()
            {
                ComponentName = itemComponentName
            };

            gridItem.DataSource = dataSource;

            gridItem.Columns.Add(new GridDimensionColumn(new Dimension("Country")));
            gridItem.Columns.Add(new GridMeasureColumn(new Measure("Sales")));
            gridItem.Columns.Add(new GridDeltaColumn(new Measure("Sales"), new Measure("SalesTarget")));
            gridItem.Columns.Add(new GridSparklineColumn(new Measure("Sales")));
            gridItem.SparklineArgument = new Dimension("SalesDate", DateTimeGroupInterval.MonthYear);

            return(gridItem);
        }
        private GridDashboardItem CreateGrid(DashboardObjectDataSource dataSource)
        {
            // Creates a grid dashboard item and specifies its data source.
            GridDashboardItem grid = new GridDashboardItem();

            grid.DataSource = dataSource;

            // Creates new grid columns of the specified type and with the specified dimension or
            // measure. Then, adds these columns to the grid's Columns collection.
            grid.Columns.Add(new GridDimensionColumn(new Dimension("CategoryName")));
            grid.Columns.Add(new GridMeasureColumn(new Measure("Extended Price")));
            grid.Columns.Add(new GridDeltaColumn(new Measure("Extended Price", SummaryType.Max),
                                                 new Measure("Extended Price", SummaryType.Min)));
            grid.Columns.Add(new GridSparklineColumn(new Measure("Extended Price")));
            grid.SparklineArgument = new Dimension("OrderDate", DateTimeGroupInterval.MonthYear);

            return(grid);
        }
        public Form1()
        {
            InitializeComponent();
            Dashboard dashboard = new Dashboard(); dashboard.LoadFromXml(@"..\..\Data\Dashboard.xml");

            dashboardViewer1.Dashboard = dashboard;
            GridDashboardItem grid          = (GridDashboardItem)dashboard.Items["gridDashboardItem1"];
            GridMeasureColumn extendedPrice = (GridMeasureColumn)grid.Columns[1];

            GridItemFormatRule rangeRule = new GridItemFormatRule(extendedPrice);
            FormatConditionGradientRangeBar rangeBarCondition =
                new FormatConditionGradientRangeBar(FormatConditionRangeGradientPredefinedType.BlueRed);

            rangeBarCondition.BarOptions.ShowBarOnly = true;
            rangeRule.Condition = rangeBarCondition;

            grid.FormatRules.AddRange(rangeRule);
        }
        private Dashboard CreateDashboard()
        {
            Dashboard          dBoard = new Dashboard();
            ChartDashboardItem chart  = new ChartDashboardItem();

            chart.Arguments.Add(new Dimension("OrderDate", DateTimeGroupInterval.MonthYear));
            chart.Panes.Add(new ChartPane());
            SimpleSeries salesAmountSeries = new SimpleSeries(SimpleSeriesType.SplineArea);

            salesAmountSeries.Value = new Measure("Extended Price");
            chart.Panes[0].Series.Add(salesAmountSeries);
            GridDashboardItem grid = new GridDashboardItem();

            grid.Columns.Add(new GridDimensionColumn(new Dimension("Sales Person")));
            grid.Columns.Add(new GridMeasureColumn(new Measure("Extended Price")));
            dBoard.Items.AddRange(chart, grid);
            return(dBoard);
        }
        private static void CreateColumnsByGridDashboardItem(GridDashboardItem gridItem, DataTable dataTable)
        {
            foreach (GridColumnBase column in gridItem.Columns)
            {
                DataColumn        tableCol = new DataColumn();
                GridMeasureColumn mCol     = column as GridMeasureColumn;
                if (mCol != null)
                {
                    tableCol.ColumnName = mCol.Measure.DataMember;
                }

                GridDimensionColumn dCol = column as GridDimensionColumn;
                if (dCol != null)
                {
                    tableCol.ColumnName = dCol.Dimension.DataMember;
                }
                dataTable.Columns.Add(tableCol);
            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            // Creates a dashboard and sets it as a currently opened dashboard in the dashboard viewer.
            dashboardViewer1.Dashboard = new Dashboard();

            // Creates a data source and adds it to the dashboard data source collection.
            DashboardObjectDataSource dataSource = new DashboardObjectDataSource();

            dataSource.DataSource = (new nwindDataSetTableAdapters.SalesPersonTableAdapter()).GetData();
            dashboardViewer1.Dashboard.DataSources.Add(dataSource);

            // Creates a grid dashboard item with the specified data source
            // and adds it to the Items collection to display within the dashboard.
            GridDashboardItem grid = CreateGrid(dataSource);

            dashboardViewer1.Dashboard.Items.Add(grid);

            // Reloads data in the data sources.
            dashboardViewer1.ReloadData();
        }
        public Form1()
        {
            InitializeComponent();
            Dashboard dashboard = new Dashboard(); dashboard.LoadFromXml(@"..\..\Data\Dashboard.xml");

            dashboardViewer1.Dashboard = dashboard;
            GridDashboardItem grid          = (GridDashboardItem)dashboard.Items["gridDashboardItem1"];
            GridMeasureColumn extendedPrice = (GridMeasureColumn)grid.Columns[1];

            GridItemFormatRule barRule      = new GridItemFormatRule(extendedPrice);
            FormatConditionBar barCondition = new FormatConditionBar();

            barCondition.StyleSettings                = new BarStyleSettings(FormatConditionAppearanceType.PaleBlue);
            barCondition.NegativeStyleSettings        = new BarStyleSettings(FormatConditionAppearanceType.PaleRed);
            barCondition.BarOptions.AllowNegativeAxis = checkBox1.Checked;
            barCondition.BarOptions.DrawAxis          = true;
            barRule.Condition = barCondition;

            grid.FormatRules.AddRange(barRule);
        }
        public Form1()
        {
            InitializeComponent();
            Dashboard dashboard = new Dashboard();

            dashboard.LoadFromXml(@"..\..\Data\Dashboard.xml");

            // Obtain dashboard items and specify identifiers for data items.
            GridDashboardItem grid = (GridDashboardItem)dashboard.Items[0];
            PieDashboardItem  pie  = (PieDashboardItem)dashboard.Items[1];

            ((GridDimensionColumn)grid.Columns[0]).Dimension.UniqueId = "categoryColumn";
            pie.SeriesDimensions[0].UniqueId = "categorySeries";

            // Obtain the dashboard data source used to provide parameter values.
            DashboardSqlDataSource parameterDataSource =
                (DashboardSqlDataSource)dashboard.DataSources[0];

            // Create a new parameter that obtains its values from the Categories query.
            DynamicListLookUpSettings settings = new DynamicListLookUpSettings();

            settings.DataSource  = parameterDataSource;
            settings.DataMember  = "Categories";
            settings.ValueMember = "CategoryName";
            DashboardParameter parameter = new DashboardParameter("categoryParameter",
                                                                  typeof(string), "Beverages", "Select categories:", true, settings);

            // Enable multi-selection for the created parameter.
            parameter.AllowMultiselect = true;

            // Add the created parameter to a collection of dashboard parameters.
            dashboard.Parameters.Add(parameter);

            // Include the created parameter in filter strings as an operand value.
            grid.FilterString = "categoryColumn in (?categoryParameter)";
            pie.FilterString  = "categorySeries in (?categoryParameter)";

            dashboardViewer1.Dashboard = dashboard;
        }
Esempio n. 23
0
        public Form1()
        {
            InitializeComponent();
            Dashboard dashboard = new Dashboard(); dashboard.LoadFromXml(@"..\..\Data\Dashboard.xml");

            dashboardViewer1.Dashboard = dashboard;
            GridDashboardItem grid          = (GridDashboardItem)dashboard.Items["gridDashboardItem1"];
            GridMeasureColumn extendedPrice = (GridMeasureColumn)grid.Columns[1];

            GridItemFormatRule   lessThanRule      = new GridItemFormatRule(extendedPrice);
            FormatConditionValue lessThanCondition = new FormatConditionValue();

            lessThanCondition.Condition     = DashboardFormatCondition.LessOrEqual;
            lessThanCondition.Value1        = 100000;
            lessThanCondition.StyleSettings =
                new AppearanceSettings(FormatConditionAppearanceType.FontRed);
            lessThanRule.Condition = lessThanCondition;

            GridItemFormatRule   betweenRule      = new GridItemFormatRule(extendedPrice);
            FormatConditionValue betweenCondition = new FormatConditionValue();

            betweenCondition.Condition     = DashboardFormatCondition.Between;
            betweenCondition.Value1        = 100000;
            betweenCondition.Value2        = 200000;
            betweenCondition.StyleSettings =
                new AppearanceSettings(FormatConditionAppearanceType.FontYellow);
            betweenRule.Condition = betweenCondition;

            GridItemFormatRule   greaterThanRule      = new GridItemFormatRule(extendedPrice);
            FormatConditionValue greaterThanCondition = new FormatConditionValue();

            greaterThanCondition.Condition     = DashboardFormatCondition.GreaterOrEqual;
            greaterThanCondition.Value1        = 200000;
            greaterThanCondition.StyleSettings =
                new AppearanceSettings(FormatConditionAppearanceType.FontGreen);
            greaterThanRule.Condition = greaterThanCondition;

            grid.FormatRules.AddRange(lessThanRule, betweenRule, greaterThanRule);
        }