private void Form1_Load(object sender, EventArgs e)
        {
            DashboardExcelDataSource excelDataSource = new DashboardExcelDataSource()
            {
                FileName      = "SalesPerson.xlsx",
                SourceOptions = new DevExpress.DataAccess.Excel.ExcelSourceOptions(
                    new DevExpress.DataAccess.Excel.ExcelWorksheetSettings()
                {
                    WorksheetName = "Data",
                    CellRange     = "A1:L100"
                }
                    )
            };

            excelDataSource.Fill();

            Dashboard dashBoard = new Dashboard();

            dashBoard.DataSources.Add(excelDataSource);
            PieDashboardItem pies = CreatePies(excelDataSource);

            dashBoard.Items.Add(pies);

            dashboardViewer1.Dashboard = dashBoard;
            dashboardViewer1.ReloadData();
        }
        private DashboardExcelDataSource CreateExcelDataSource()
        {
            DashboardExcelDataSource excelDataSource = new DashboardExcelDataSource();

            excelDataSource.FileName = "SalesPerson.xlsx";
            ExcelWorksheetSettings worksheetSettings = new ExcelWorksheetSettings("Data");

            excelDataSource.SourceOptions = new ExcelSourceOptions(worksheetSettings);
            excelDataSource.Fill();
            return(excelDataSource);
        }
        public DashboardExcelDataSource CreateExcelDataSource()
        {
            // Generates the Excel Data Source.
            DashboardExcelDataSource excelDataSource = new DashboardExcelDataSource();

            excelDataSource.FileName = @"Data\Sales.xlsx";
            ExcelWorksheetSettings worksheetSettings = new ExcelWorksheetSettings("Sheet1", "A1:I4166");

            excelDataSource.SourceOptions = new ExcelSourceOptions(worksheetSettings);
            excelDataSource.Fill();

            return(excelDataSource);
        }
        public DashboardExcelDataSource CreateExcelDataSource()
        {
            // Generates the Excel Data Source.
            DashboardExcelDataSource excelDataSource = new DashboardExcelDataSource();

            excelDataSource.FileName = @"Data\SimpleDataSource.xls";
            ExcelWorksheetSettings worksheetSettings = new ExcelWorksheetSettings("Simple Data", "A1:F12");

            excelDataSource.SourceOptions = new ExcelSourceOptions(worksheetSettings);
            excelDataSource.Fill();

            return(excelDataSource);
        }
Пример #5
0
        private static DashboardExcelDataSource CreateExcelDataSource()
        {
            DashboardExcelDataSource excelDataSource = new DashboardExcelDataSource()
            {
                FileName      = @"Data\SalesPerson.xlsx",
                SourceOptions = new ExcelSourceOptions()
                {
                    ImportSettings = new ExcelWorksheetSettings("Data")
                }
            };

            excelDataSource.Fill();
            return(excelDataSource);
        }
        public Form1()
        {
            InitializeComponent();

            Dashboard dashboard = new Dashboard();

            //Create an Excel data source.
            DashboardExcelDataSource excelDataSource = new DashboardExcelDataSource();

            excelDataSource.FileName = @"..\..\Data\Sales.xlsx";
            ExcelWorksheetSettings worksheetSettings = new ExcelWorksheetSettings("Sheet1", "A1:I4166");

            excelDataSource.SourceOptions = new ExcelSourceOptions(worksheetSettings);
            excelDataSource.Fill();
            dashboard.DataSources.Add(excelDataSource);

            // Create a Choropleth Map dashboard item.
            ChoroplethMapDashboardItem map = new ChoroplethMapDashboardItem();

            map.Name                    = "Choropleth Map";
            map.DataSource              = excelDataSource;
            map.Legend.Visible          = true;
            map.ShapeTitleAttributeName = "NAME";
            map.AttributeName           = "NAME";
            map.AttributeDimension      = new Dimension("State");
            ValueMap revenueYTDMap = new ValueMap(new Measure("RevenueYTD (Sum)"));

            map.Maps.Add(revenueYTDMap);

            // Loads a custom shape file to the map.
            map.Area = ShapefileArea.Custom;
            CustomShapefileData data = new CustomShapefileData();

            data.ShapeData           = File.ReadAllBytes(@"..\..\Map\USA.shp");
            data.AttributeData       = File.ReadAllBytes(@"..\..\Map\USA.dbf");
            map.CustomShapefile.Data = data;

            dashboard.Items.Add(map);
            dashboardViewer.Dashboard = dashboard;
        }
        static IDashboardDataSource CreateDataSourceCopy(IDashboardDataSource dataSourceToCopy)
        {
            DashboardEFDataSource efDataSource = dataSourceToCopy as DashboardEFDataSource;

            if (efDataSource != null)
            {
                XElement element = efDataSource.SaveToXml();
                DashboardEFDataSource newDataSource = new DashboardEFDataSource();
                newDataSource.LoadFromXml(element);
                newDataSource.Fill();
                return(newDataSource);
            }

            DashboardExcelDataSource excelDataSource = dataSourceToCopy as DashboardExcelDataSource;

            if (excelDataSource != null)
            {
                XElement element = excelDataSource.SaveToXml();
                DashboardExcelDataSource newDataSource = new DashboardExcelDataSource();
                newDataSource.LoadFromXml(element);
                newDataSource.Fill();
                return(newDataSource);
            }

            DashboardExtractDataSource extractDataSource = dataSourceToCopy as DashboardExtractDataSource;

            if (extractDataSource != null)
            {
                XElement element = extractDataSource.SaveToXml();
                DashboardExtractDataSource newDataSource = new DashboardExtractDataSource();
                newDataSource.LoadFromXml(element);
                return(newDataSource);
            }

            DashboardObjectDataSource objectDataSource = dataSourceToCopy as DashboardObjectDataSource;

            if (objectDataSource != null)
            {
                XElement element = objectDataSource.SaveToXml();
                DashboardObjectDataSource newDataSource = new DashboardObjectDataSource();
                newDataSource.LoadFromXml(element);
                newDataSource.Fill();
                return(newDataSource);
            }

            DashboardOlapDataSource olapDataSource = dataSourceToCopy as DashboardOlapDataSource;

            if (olapDataSource != null)
            {
                XElement element = olapDataSource.SaveToXml();
                DashboardOlapDataSource newDataSource = new DashboardOlapDataSource();
                newDataSource.LoadFromXml(element);
                newDataSource.Fill();
                return(newDataSource);
            }

            DashboardSqlDataSource sqlDataSource = dataSourceToCopy as DashboardSqlDataSource;

            if (sqlDataSource != null)
            {
                XElement element = sqlDataSource.SaveToXml();
                DashboardSqlDataSource newDataSource = new DashboardSqlDataSource();
                newDataSource.LoadFromXml(element);
                newDataSource.Fill();
                return(newDataSource);
            }
            return(null);
        }