private RangeFilterDashboardItem CreateRangeFilter(IDashboardDataSource dataSource) { RangeFilterDashboardItem rangeFilter = new RangeFilterDashboardItem(); rangeFilter.DataSource = dataSource; SimpleSeries salesAmountSeries = new SimpleSeries(SimpleSeriesType.Area); rangeFilter.Series.Add(salesAmountSeries); salesAmountSeries.Value = new Measure("Extended Price"); rangeFilter.Argument = new Dimension("OrderDate"); rangeFilter.Argument.DateTimeGroupInterval = DateTimeGroupInterval.MonthYear; rangeFilter.FilterString = "[OrderDate] > #2018-01-01#"; rangeFilter.DateTimePeriods.AddRange( DateTimePeriod.CreateLastYear(), DateTimePeriod.CreateNextMonths("Next 3 Months", 3), new DateTimePeriod { Name = "Year To Date", Start = new FlowDateTimePeriodLimit(DateTimeInterval.Year, 0), End = new FlowDateTimePeriodLimit(DateTimeInterval.Day, 1) }, new DateTimePeriod { Name = "Jul-18-2018 - Jan-18-2019", Start = new FixedDateTimePeriodLimit(new DateTime(2018, 7, 18)), End = new FixedDateTimePeriodLimit(new DateTime(2019, 1, 18)) } ); rangeFilter.DefaultDateTimePeriodName = "Year To Date"; // The caption is initially hidden. Uncomment the line below to show the caption. //rangeFilter.ShowCaption = true; return(rangeFilter); }
private void Form1_Load(object sender, EventArgs e) { // Create a dashboard and display it in the dashboard viewer. dashboardViewer1.Dashboard = new Dashboard(); // Create a data source and add it to the dashboard data source collection. DashboardExcelDataSource dataSource = CreateExcelDataSource(); dashboardViewer1.Dashboard.DataSources.Add(dataSource); // Create a Range Filter dashboard item with the specified data source // and add it to the Items collection to display within the dashboard. RangeFilterDashboardItem rangeFilter = CreateRangeFilter(dataSource); dashboardViewer1.Dashboard.Items.Add(rangeFilter); // Create a pivot and add it to the dashboard. PivotDashboardItem pivot = CreatePivot(dataSource); dashboardViewer1.Dashboard.Items.Add(pivot); // Create the dashboard layout. dashboardViewer1.Dashboard.RebuildLayout(); dashboardViewer1.Dashboard.LayoutRoot.FindRecursive(rangeFilter).Weight = 20; dashboardViewer1.Dashboard.LayoutRoot.FindRecursive(pivot).Weight = 80; dashboardViewer1.Dashboard.LayoutRoot.Orientation = DashboardLayoutGroupOrientation.Vertical; dashboardViewer1.ReloadData(); }
private RangeFilterDashboardItem CreateRangeFilter(IDashboardDataSource dataSource) { // Create a Range Filter dashboard item and specify its data source. RangeFilterDashboardItem rangeFilter = new RangeFilterDashboardItem(); rangeFilter.DataSource = dataSource; // Create a new series of the Area type and add this series to the Series collection to // display it within the Range Filter. SimpleSeries salesAmountSeries = new SimpleSeries(SimpleSeriesType.Area); rangeFilter.Series.Add(salesAmountSeries); // Specify a measure to provide data used to calculate the Y-coordinate of the data points. salesAmountSeries.Value = new Measure("Extended Price"); // Specify a dimension to provide Range Filter argument values. rangeFilter.Argument = new Dimension("OrderDate"); // Specify a group interval for argument values. rangeFilter.Argument.DateTimeGroupInterval = DateTimeGroupInterval.MonthYear; // Restrict the displayed data. rangeFilter.FilterString = "[OrderDate] > #2018-01-01#"; // Add predefined ranges to the context menu. // You can show the item caption and use the Select Date Time Periods drop-down button to apply predefined ranges. rangeFilter.DateTimePeriods.AddRange( DateTimePeriod.CreateLastYear(), DateTimePeriod.CreateNextMonths("Next 3 Months", 3), new DateTimePeriod { Name = "Year To Date", Start = new FlowDateTimePeriodLimit(DateTimeInterval.Year, 0), End = new FlowDateTimePeriodLimit(DateTimeInterval.Day, 1) }, new DateTimePeriod { Name = "Jul-18-2018 - Jan-18-2019", Start = new FixedDateTimePeriodLimit(new DateTime(2018, 7, 18)), End = new FixedDateTimePeriodLimit(new DateTime(2019, 1, 18)) } ); // Specify the period selected when the control is initialized. rangeFilter.DefaultDateTimePeriodName = "Year To Date"; // The caption is initially hidden. Uncomment the line to show the caption. //rangeFilter.ShowCaption = true; return(rangeFilter); }
private void Form1_Load(object sender, EventArgs e) { Dashboard dashboard = new Dashboard(); DashboardExcelDataSource dataSource = CreateExcelDataSource(); dashboard.DataSources.Add(dataSource); RangeFilterDashboardItem rangeFilter = CreateRangeFilter(dataSource); dashboard.Items.Add(rangeFilter); PivotDashboardItem pivot = CreatePivot(dataSource); dashboard.Items.Add(pivot); // Create the dashboard layout. dashboard.RebuildLayout(); dashboard.LayoutRoot.FindRecursive(rangeFilter).Weight = 20; dashboard.LayoutRoot.FindRecursive(pivot).Weight = 80; dashboard.LayoutRoot.Orientation = DashboardLayoutGroupOrientation.Vertical; dashboardViewer1.Dashboard = dashboard; dashboardViewer1.ReloadData(); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { string resourceFileName = "RequestDashboard.resx"; DevExpress.DashboardCommon.ChartPane chartPane1 = new DevExpress.DashboardCommon.ChartPane(); DevExpress.DashboardCommon.ChartPane chartPane2 = new DevExpress.DashboardCommon.ChartPane(); DevExpress.DashboardCommon.ChartPane chartPane3 = new DevExpress.DashboardCommon.ChartPane(); DevExpress.DashboardCommon.DashboardLayoutGroup dashboardLayoutGroup1 = new DevExpress.DashboardCommon.DashboardLayoutGroup(); DevExpress.DashboardCommon.DashboardLayoutGroup dashboardLayoutGroup2 = new DevExpress.DashboardCommon.DashboardLayoutGroup(); DevExpress.DashboardCommon.DashboardLayoutItem dashboardLayoutItem1 = new DevExpress.DashboardCommon.DashboardLayoutItem(); DevExpress.DashboardCommon.DashboardLayoutItem dashboardLayoutItem2 = new DevExpress.DashboardCommon.DashboardLayoutItem(); DevExpress.DashboardCommon.DashboardLayoutGroup dashboardLayoutGroup3 = new DevExpress.DashboardCommon.DashboardLayoutGroup(); DevExpress.DashboardCommon.DashboardLayoutItem dashboardLayoutItem3 = new DevExpress.DashboardCommon.DashboardLayoutItem(); DevExpress.DashboardCommon.DashboardLayoutItem dashboardLayoutItem4 = new DevExpress.DashboardCommon.DashboardLayoutItem(); DevExpress.DashboardCommon.DashboardLayoutItem dashboardLayoutItem5 = new DevExpress.DashboardCommon.DashboardLayoutItem(); this.chartDashboardItem1 = new DevExpress.DashboardCommon.ChartDashboardItem(); this.chartDashboardItem2 = new DevExpress.DashboardCommon.ChartDashboardItem(); this.pieDashboardItem1 = new DevExpress.DashboardCommon.PieDashboardItem(); this.chartDashboardItem3 = new DevExpress.DashboardCommon.ChartDashboardItem(); this.rangeFilterDashboardItem1 = new DevExpress.DashboardCommon.RangeFilterDashboardItem(); ((System.ComponentModel.ISupportInitialize)(this.chartDashboardItem1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.chartDashboardItem2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pieDashboardItem1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.chartDashboardItem3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.rangeFilterDashboardItem1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); // // chartDashboardItem1 // this.chartDashboardItem1.AxisX.TitleVisible = false; this.chartDashboardItem1.ComponentName = "chartDashboardItem1"; this.chartDashboardItem1.DataItemRepository.Clear(); this.chartDashboardItem1.InteractivityOptions.IgnoreMasterFilters = false; this.chartDashboardItem1.Name = "Chart 1"; chartPane1.Name = "Pane 1"; chartPane1.PrimaryAxisY.ShowGridLines = true; chartPane1.PrimaryAxisY.TitleVisible = true; chartPane1.SecondaryAxisY.ShowGridLines = false; chartPane1.SecondaryAxisY.TitleVisible = true; this.chartDashboardItem1.Panes.AddRange(new DevExpress.DashboardCommon.ChartPane[] { chartPane1 }); this.chartDashboardItem1.ShowCaption = true; // // chartDashboardItem2 // this.chartDashboardItem2.AxisX.TitleVisible = false; this.chartDashboardItem2.ComponentName = "chartDashboardItem2"; this.chartDashboardItem2.DataItemRepository.Clear(); this.chartDashboardItem2.InteractivityOptions.IgnoreMasterFilters = false; this.chartDashboardItem2.Name = "Chart 2"; chartPane2.Name = "Pane 1"; chartPane2.PrimaryAxisY.ShowGridLines = true; chartPane2.PrimaryAxisY.TitleVisible = true; chartPane2.SecondaryAxisY.ShowGridLines = false; chartPane2.SecondaryAxisY.TitleVisible = true; this.chartDashboardItem2.Panes.AddRange(new DevExpress.DashboardCommon.ChartPane[] { chartPane2 }); this.chartDashboardItem2.ShowCaption = true; // // pieDashboardItem1 // this.pieDashboardItem1.ComponentName = "pieDashboardItem1"; this.pieDashboardItem1.DataItemRepository.Clear(); this.pieDashboardItem1.InteractivityOptions.IgnoreMasterFilters = false; this.pieDashboardItem1.Name = "Pies 1"; this.pieDashboardItem1.ShowCaption = true; // // chartDashboardItem3 // this.chartDashboardItem3.AxisX.TitleVisible = false; this.chartDashboardItem3.ComponentName = "chartDashboardItem3"; this.chartDashboardItem3.DataItemRepository.Clear(); this.chartDashboardItem3.InteractivityOptions.IgnoreMasterFilters = false; this.chartDashboardItem3.Name = "Chart 3"; chartPane3.Name = "Pane 1"; chartPane3.PrimaryAxisY.ShowGridLines = true; chartPane3.PrimaryAxisY.TitleVisible = true; chartPane3.SecondaryAxisY.ShowGridLines = false; chartPane3.SecondaryAxisY.TitleVisible = true; this.chartDashboardItem3.Panes.AddRange(new DevExpress.DashboardCommon.ChartPane[] { chartPane3 }); this.chartDashboardItem3.ShowCaption = true; // // rangeFilterDashboardItem1 // this.rangeFilterDashboardItem1.ComponentName = "rangeFilterDashboardItem1"; this.rangeFilterDashboardItem1.DataItemRepository.Clear(); this.rangeFilterDashboardItem1.InteractivityOptions.IgnoreMasterFilters = true; this.rangeFilterDashboardItem1.Name = "Range Filter 1"; this.rangeFilterDashboardItem1.ShowCaption = false; // // RequestDashboard // this.Items.AddRange(new DevExpress.DashboardCommon.DashboardItem[] { this.chartDashboardItem1, this.chartDashboardItem2, this.pieDashboardItem1, this.chartDashboardItem3, this.rangeFilterDashboardItem1 }); dashboardLayoutItem1.DashboardItem = this.chartDashboardItem1; dashboardLayoutItem1.Weight = 42.533185840707965D; dashboardLayoutItem2.DashboardItem = this.chartDashboardItem2; dashboardLayoutItem2.Weight = 57.466814159292035D; dashboardLayoutGroup2.ChildNodes.AddRange(new DevExpress.DashboardCommon.DashboardLayoutNode[] { dashboardLayoutItem1, dashboardLayoutItem2 }); dashboardLayoutGroup2.DashboardItem = null; dashboardLayoutGroup2.Weight = 50.0503524672709D; dashboardLayoutItem3.DashboardItem = this.pieDashboardItem1; dashboardLayoutItem3.Weight = 27.876106194690266D; dashboardLayoutItem4.DashboardItem = this.chartDashboardItem3; dashboardLayoutItem4.Weight = 72.123893805309734D; dashboardLayoutGroup3.ChildNodes.AddRange(new DevExpress.DashboardCommon.DashboardLayoutNode[] { dashboardLayoutItem3, dashboardLayoutItem4 }); dashboardLayoutGroup3.DashboardItem = null; dashboardLayoutGroup3.Weight = 24.974823766364551D; dashboardLayoutItem5.DashboardItem = this.rangeFilterDashboardItem1; dashboardLayoutItem5.Weight = 24.974823766364551D; dashboardLayoutGroup1.ChildNodes.AddRange(new DevExpress.DashboardCommon.DashboardLayoutNode[] { dashboardLayoutGroup2, dashboardLayoutGroup3, dashboardLayoutItem5 }); dashboardLayoutGroup1.DashboardItem = null; dashboardLayoutGroup1.Orientation = DevExpress.DashboardCommon.DashboardLayoutGroupOrientation.Vertical; this.LayoutRoot = dashboardLayoutGroup1; this.Title.ImageDataSerializable = ""; this.Title.Text = "Dashboard"; ((System.ComponentModel.ISupportInitialize)(this.chartDashboardItem1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.chartDashboardItem2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pieDashboardItem1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.chartDashboardItem3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.rangeFilterDashboardItem1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); }