Exemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            var selector = new ValRangeSelector()
            {
                Dock = DockStyle.Bottom
            };

            selector.DateRangeChanged += Selector_DateRangeChanged;
            Controls.Add(selector);
            c1DockingTab1_TabClick(null, EventArgs.Empty);
            _flex.GroupDescriptions = new List <C1.Win.C1FlexGrid.GroupDescription>()
            {
                new C1.Win.C1FlexGrid.GroupDescription("AssignedTo")
            };
            _flex.Cols[0].Width     = 0;
            _flex.Cols[1].StarWidth = "*";
            _flex.Cols[2].StarWidth = "*";
            _flex.Cols[3].StarWidth = "*";
            _flex.Cols[5].StarWidth = "*";
            _flex.DrawMode          = DrawModeEnum.OwnerDraw;
            _flex.OwnerDrawCell    += new OwnerDrawCellEventHandler(_flex_OwnerDrawCell);
        }
Exemplo n.º 2
0
        private void Dashboard_Load(object sender, EventArgs e)
        {
            Visible = false;
            var dashboardLayout = new C1DashboardLayout();
            var selector        = new ValRangeSelector()
            {
                Dock = DockStyle.Bottom
            };
            Series series;
            var    g1 = new BulletGraphs()
            {
                Dock = DockStyle.Fill, Parent = panGauges1
            };
            var g2 = new BulletGraphs()
            {
                Dock = DockStyle.Fill, Parent = panGauges2
            };

            selector.DateRangeChanged += (s, ev) =>
            {
                DataService.GetService().DateRange = ev.NewValue;

                g1.Source      = DataService.GetService().CategorySalesVsGoal;
                labUnits1.Text = Strings.Resource.Unit_Text;

                chartSaleTopProd.DataSource       = DataService.GetService().GetTopSaleProductList(3);
                chartSaleTopProd.AxisY.Format     = Fmt;
                chartSaleTopProd.AxisX.LabelAngle = -45;
                chartSaleTopProd.Series.Clear();
                series         = new Series();
                series.Binding = "Sales";
                SetColor1(series);
                chartSaleTopProd.BindingX = "Name";
                chartSaleTopProd.Series.Add(series);
                chartSaleTopProd.ChartType         = C1.Chart.ChartType.Column;
                chartSaleTopProd.AnimationSettings = C1.Chart.AnimationSettings.All;

                chartCurrProfitVSPriorProfit.AnimationSettings = C1.Chart.AnimationSettings.All;
                chartSalesVsProfit.AnimationSettings           = C1.Chart.AnimationSettings.All;

                gridTopSaleCustomer.DataSource               = DataService.GetService().GetTopSaleCustomerList(7);
                gridTopSaleCustomer.Cols.Count               = 4;
                gridTopSaleCustomer.Cols["Name"].StarWidth   = "*";
                gridTopSaleCustomer.Cols["Sales"].Format     = "C0";
                gridTopSaleCustomer.Cols["Sales"].StarWidth  = "*";
                gridTopSaleCustomer.Cols["Profit"].Format    = "C0";
                gridTopSaleCustomer.Cols["Profit"].StarWidth = "*";
                gridTopSaleCustomer.Cols[0].WidthDisplay     = 0;

                g2.Source      = DataService.GetService().RegionSalesVsGoal;
                labUnits2.Text = Strings.Resource.Unit_Text;

                dashboardLayout.SetCaption(c1SplitterPanel4, Strings.Resource.CategorySales_Header);
                dashboardLayout.SetCaption(c1SplitterPanel8, Strings.Resource.TopSaleProducts_Header);
                dashboardLayout.SetCaption(c1SplitterPanel9, Strings.Resource.TopSaleCustomer_Header);
                dashboardLayout.SetCaption(c1SplitContainer1, Strings.Resource.RegionSales_Header);
                dashboardLayout.SetCaption(c1SplitterPanel6, Strings.Resource.BudgetVSProfit_Header);
                dashboardLayout.SetCaption(splPan1, Strings.Resource.SalesVsProfit_Header);
                dashboardLayout.SetCaption(splPan2, Strings.Resource.BudgetVSProfit_Header);
            };
            Controls.Add(selector);
            c1SplitContainer1.Dock = DockStyle.Fill;

            chartCurrProfitVSPriorProfit.DataSource   = DataService.GetService().BudgetItemList;
            chartCurrProfitVSPriorProfit.AxisY.Format = Fmt;
            series         = new Series();
            series.Binding = "Profit";
            series.Name    = Strings.Resource.CurrentYear_Series;
            SetColor1(series);
            chartCurrProfitVSPriorProfit.Series.Add(series);
            series         = new Series();
            series.Binding = "ProirProfit";
            series.Name    = Strings.Resource.PriorYear_Series;
            SetColor2(series);
            chartCurrProfitVSPriorProfit.Series.Add(series);
            chartCurrProfitVSPriorProfit.BindingX = "Date";

            chartCurrProfitVSPriorProfit.ChartType       = C1.Chart.ChartType.LineSymbols;
            chartCurrProfitVSPriorProfit.Legend.Position = C1.Chart.Position.Top;

            chartSalesVsProfit.DataSource = DataService.GetService().BudgetItemList;
            series         = new Series();
            series.Binding = "Sales";
            series.Name    = Strings.Resource.Sale_Series;
            series.AxisY   = new Axis()
            {
                Position = C1.Chart.Position.Right, Title = Strings.Resource.Sale_Series, Format = Fmt
            };
            SetColor1(series);
            chartSalesVsProfit.Series.Add(series);
            series           = new Series();
            series.Binding   = "Profit";
            series.Name      = Strings.Resource.Profit_Series;
            series.ChartType = C1.Chart.ChartType.Line;
            series.AxisY     = new Axis()
            {
                Position = C1.Chart.Position.Left, Title = Strings.Resource.Profit_Series, Format = Fmt
            };
            SetColor2(series);
            chartSalesVsProfit.Series.Add(series);
            chartSalesVsProfit.BindingX = "Date";
            gridTopSaleCustomer.Visible = true;
            dashboardLayout.Options.ToolIconAppearance = ToolIconAppearance.UpperRight;
            dashboardLayout.AttachToLayout(new SplitLayout(c1SplitContainer1));
            selector.SendToBack();
            Visible = true;
        }
Exemplo n.º 3
0
        private void Analysis_Load(object sender, EventArgs e)
        {
            dfOlap.AutoApply           = true;
            dfOlap.AutoGenerateFilters = false;
            dfOlap.FilterChanged      += DfOlap_FilterChanged;
            dfMap                     = new C1DataFilter();
            dfMap.AutoApply           = true;
            dfMap.AutoGenerateFilters = false;
            dfMap.FilterChanged      += DfMap_FilterChanged;

            var dashboardLayout = new C1DashboardLayout();

            _vectorLayer = new C1.Win.Map.VectorLayer()
            {
                LabelVisibility = LabelVisibility.Visible
            };
            _vectorLayer.LabelStyle.Font = new Font(Font.FontFamily, 7);

            Map.TileLayer.TileSource = new VirtualEarthRoadSource();
            Map.Layers.Add(_vectorLayer);

            var engine = OlapPanel.FlexPivotEngine;

            engine.DataSource = DataService.GetService().ProductWiseSaleCollection;
            InitOlap(engine);

            var selector = new ValRangeSelector()
            {
                Dock = DockStyle.Bottom
            };

            ChecklistFilter fCategories = new ChecklistFilter("Category", true);

            fCategories.HeaderText      = Strings.Resource.DataFilter_Categories;
            fCategories.ItemsSource     = DataService.GetService().ProductWiseSaleCollection;
            fCategories.ValueMemberPath = "Category";
            fCategories.SelectAll();
            dfOlap.Filters.Add(fCategories);
            dfMap.Filters.Add(fCategories);
            ChecklistFilter fModels = new ChecklistFilter("Product", true);

            fModels.HeaderText      = Strings.Resource.DataFilter_Products;
            fModels.ItemsSource     = fCategories.ItemsSource;
            fModels.ValueMemberPath = "Product";
            fModels.SelectAll();
            dfOlap.Filters.Add(fModels);
            dfMap.Filters.Add(fModels);
            RangeFilter fSales = new RangeFilter("Sales", true);

            fSales.HeaderText = Strings.Resource.DataFilter_Sales;
            var list = from prod in DataService.GetService().ProductWiseSaleCollection.Cast <ProductsWiseSaleItem>() select prod.Sales;

            fSales.Maximum = list.Max();
            fSales.Minimum = list.Min();
            dfOlap.Filters.Add(fSales);
            dfMap.Filters.Add(fSales);

            selector.DateRangeChanged += (s, ev) =>
            {
                dfOlap.DataSource = DataService.GetService().ProductWiseSaleCollection;
                dfMap.DataSource  = DataService.GetService().GetRegionWiseSalesWithCategory();

                DataService.GetService().GetRegionWiseSaleCollection = () => dfMap.View.ToList();

                DataService.GetService().DateRange = ev.NewValue;
                UpdataMapMark();

                chartOpportunities.DataSource = DataService.GetService().OpportunityItemList;
                chartOpportunities.Series.Clear();
                var series = new Series();
                series.Binding = series.Name = "Sales";
                chartOpportunities.Series.Add(series);
                chartOpportunities.BindingX           = "Level";
                chartOpportunities.DataLabel.Position = C1.Chart.LabelPosition.Center;
                chartOpportunities.DataLabel.Content  = "{}{y:C0}";
                chartOpportunities.ChartType          = C1.Chart.ChartType.Funnel;
            };
            Controls.Add(selector);
            dashboardLayout.Options.ToolIconAppearance = ToolIconAppearance.UpperRight;
            dashboardLayout.AttachToLayout(new SplitLayout(c1SplitContainerMain));
            IconBox settings = new IconBox()
            {
                BackgroundImage = Properties.Resources.settings_work_tool
            };

            settings.Click += (s, ev) =>
            {
                OlapPanel.Location = PointToClient(settings.PointToScreen(new Point(-2, settings.Height + 2)));
                if (OlapPanel.Right > Right)
                {
                    OlapPanel.Left = Right - OlapPanel.Width - 2;
                }
                OlapPanel.Parent  = this;
                OlapPanel.Visible = true;
                OlapPanel.BringToFront();
            };
            OlapPanel.MouseLeave += (s, ev) => OlapPanel.Visible = false;
            IconBox dataFilter = new IconBox()
            {
                BackgroundImage = Properties.Resources.C1DataFilter
            };

            dataFilter.Click += (s, ev) =>
            {
                dfOlap.Location = PointToClient(dataFilter.PointToScreen(new Point(-2, dataFilter.Height + 2)));
                if (dfOlap.Right > Right)
                {
                    dfOlap.Left = Right - dfOlap.Width - 2;
                }
                dfOlap.Parent  = this;
                dfOlap.Visible = true;
                dfOlap.BringToFront();
            };
            settings.VisibleChanged += (s, ev) => {
                settings.Visible   = dashboardLayout.GetSelectedItem()?.ItemContainer == c1SplitterPanelGrid;
                dataFilter.Visible = settings.Visible;
            };
            dfOlap.MouseLeave += (s, ev) => dfOlap.Visible = false;
            OlapGrid.Resize   += (s1, ev1) => { OlapPanel.Visible = false; dfOlap.Visible = false; };
            dashboardLayout.ItemContainerSelected += (s, ev) =>
            {
                settings.Visible   = dashboardLayout.GetSelectedItem()?.ItemContainer == c1SplitterPanelGrid;
                dataFilter.Visible = settings.Visible;
            };
            dashboardLayout.Options.HeaderElements.Add(dataFilter);
            dashboardLayout.Options.HeaderElements.Add(settings);
            dashboardLayout.SetCaption(c1SplitterPanelGrid, Strings.Resource.ProductWise_Header);
            dashboardLayout.SetCaption(c1SplitterPanel3, Strings.Resource.RegionWise_Header);
            dashboardLayout.SetCaption(c1SplitterPanel4, Strings.Resource.Opportunities_Header);
            this.c1SplitterPanelGrid.Width = 565;
            selector.SendToBack();
            ScanControls(this);
        }