Ejemplo n.º 1
0
        private Dashboard CreateDashboard()
        {
            DashboardExcelDataSource excelDataSource = CreateExcelDataSource();
            Dashboard dBoard = new Dashboard();

            dBoard.DataSources.Add(excelDataSource);

            dBoard.BeginUpdate();
            // Create dashboard items.
            ChartDashboardItem chart = CreateChart(excelDataSource);

            dBoard.Items.Add(chart);
            DateFilterDashboardItem dateFilterItem = CreateDateFilterItem(excelDataSource);

            dBoard.Items.Add(dateFilterItem);
            DashboardItemGroup group = CreateGroup();

            dBoard.Groups.Add(group);
            group.AddRange(dateFilterItem, chart);
            // Create layout tree.
            DashboardLayoutItem  dateFilterLayoutItem = new DashboardLayoutItem(dateFilterItem, 30);
            DashboardLayoutItem  chartLayoutItem      = new DashboardLayoutItem(chart, 70);
            DashboardLayoutGroup groupLayoutItem      = new DashboardLayoutGroup(group, 100);

            groupLayoutItem.ChildNodes.AddRange(dateFilterLayoutItem, chartLayoutItem);
            DashboardLayoutGroup rootGroup = new DashboardLayoutGroup(null, 100);

            rootGroup.ChildNodes.Add(groupLayoutItem);
            rootGroup.Orientation = DashboardLayoutGroupOrientation.Vertical;
            dBoard.LayoutRoot     = rootGroup;
            dBoard.EndUpdate();
            return(dBoard);
        }
Ejemplo n.º 2
0
        private static Dashboard CreateDashboard(DashboardSqlDataSource dataSource)
        {
            Dashboard dashboard1 = new Dashboard();

            dashboard1.DataSources.Add(dataSource);

            ComboBoxDashboardItem comboBox1 = new ComboBoxDashboardItem()
            {
                Name         = "Browser",
                DataSource   = dataSource,
                DataMember   = "Statistics",
                ComboBoxType = ComboBoxDashboardItemType.Checked
            };

            comboBox1.FilterDimensions.Add(new Dimension("Browser"));

            ListBoxDashboardItem listBox1 = new ListBoxDashboardItem()
            {
                Name       = "Browser Version",
                DataSource = dataSource,
                DataMember = "Statistics"
            };

            listBox1.FilterDimensions.Add(new Dimension("BrowserDetails"));
            listBox1.InteractivityOptions.IgnoreMasterFilters = false;

            TreeViewDashboardItem treeView1 = new TreeViewDashboardItem()
            {
                Name            = "Date",
                DataSource      = dataSource,
                DataMember      = "Statistics",
                AutoExpandNodes = true
            };

            treeView1.FilterDimensions.AddRange(new Dimension("Date", DateTimeGroupInterval.Year),
                                                new Dimension("Date", DateTimeGroupInterval.Quarter));

            DashboardItemGroup group1 = new DashboardItemGroup()
            {
                Name = "Filters"
            };

            group1.InteractivityOptions.IsMasterFilter = true;
            dashboard1.Groups.Add(group1);
            group1.AddRange(comboBox1, treeView1, listBox1);

            ChartDashboardItem chart1 = new ChartDashboardItem()
            {
                Name       = "Browser Statistics",
                DataSource = dataSource,
                DataMember = "Statistics",
            };

            chart1.Arguments.Add(new Dimension("Date", DateTimeGroupInterval.MonthYear));
            chart1.SeriesDimensions.AddRange(new Dimension("Browser"), new Dimension("BrowserDetails"));
            chart1.Panes.Add(new ChartPane());
            SimpleSeries salesAmountSeries = new SimpleSeries(SimpleSeriesType.SplineArea);

            salesAmountSeries.Value = new Measure("Count");
            chart1.Panes[0].Series.Add(salesAmountSeries);
            dashboard1.Items.Add(chart1);

            return(dashboard1);
        }