Esempio n. 1
0
    void OnValueEmitted(BarChartValue barChartValue)
    {
        foreach (int value in barChartValue.Values)
        {
            if (Math.Abs(value) > _maxDisplayedValue)
            {
                _maxDisplayedValue = Math.Abs(value);
            }
        }
        BarChartValueView barChartValueView = Instantiate(_barChartValueViewPrefab, _graphTransform);

        barChartValueView.SetXValue(barChartValue.Label);
        barChartValueView.SetYValue(barChartValue.Values);
        barChartValueView.SetColors(_colors);
        _barChartValueElements.Add(barChartValueView);

        foreach (BarChartValueView barChartValueElement in _barChartValueElements)
        {
            barChartValueElement.SetMaxHeight((int)_graphTransform.rect.height);
            barChartValueElement.SetMaxValue(_maxDisplayedValue);
            barChartValueElement.UpdateChart();
        }

        _maxValueLineTransform.anchoredPosition = new Vector2(0, (int)_graphTransform.rect.height);
        _maxValueLineText.text = _maxDisplayedValue + "€";
    }
        private void btnUpdateChart_Click(object sender, EventArgs e)
        {
            var data = new BarChartValue[]
            {
                new BarChartValue("2020", 150),
                new BarChartValue("2021", 200),
                new BarChartValue("2022", 300),
                new BarChartValue("2023", 4000)
            };

            barChartControl1.Data = data;
        }
Esempio n. 3
0
        private void SampleForChart_Load(object sender, EventArgs e)
        {
            var data = new BarChartValue[]
            {
                new BarChartValue("2010", 10),
                new BarChartValue("2011", 20),
                new BarChartValue("2012", 30),
                new BarChartValue("2013", 40)
            };


            barChartControl1.Data = data;
        }
Esempio n. 4
0
    public BarChartController(MoneyController moneyController)
    {
        BarChartValues = new List <BarChartValue> {
            new BarChartValue("0", 0, 0)
        };
        moneyController.OnValueChange += delegate(long oldValue, long newValue)
        {
            long          difference    = newValue - oldValue;
            BarChartValue barChartValue = BarChartValues[BarChartValues.Count - 1];
            int           currentValue  = barChartValue.Values[difference < 0 ? 1 : 0];
            barChartValue.Values[difference < 0 ? 1 : 0] = (int)difference + currentValue;
        };

        TimeScaleView._onDayOver += delegate(int day)
        {
            OnValueChange?.Invoke(BarChartValues[BarChartValues.Count - 1]);
            BarChartValues.Add(new BarChartValue((day + 1).ToString(), 0, 0));
        };
    }
Esempio n. 5
0
        public ActionResult Index()
        {
            ViewBag.Message  = "Welcome to Safety Patrol Management System!";
            ViewBag.pagename = "Dashboard";
            if (HttpContext.Session.Count > 0)
            {
                var islogin = HttpContext.Session["islogin"].ToString();
                if (islogin == "1")
                {
                    ViewBag.currentuser = HttpContext.Session["fname"];
                    ViewBag.Message     = "";
                    if (HttpContext.Session["userlevel"].ToString() == "0")
                    {
                        return(RedirectToAction("Index", "Findings"));
                    }
                    else
                    {
                        int    y;
                        int    month;
                        string smonth;

                        if (HttpContext.Request["year"] != null && HttpContext.Request["year"] != "")
                        {
                            y = int.Parse(HttpContext.Request["year"]);
                        }
                        else
                        {
                            y = 0;
                        }
                        if (HttpContext.Request["month"] != null && HttpContext.Request["month"] != "")
                        {
                            smonth = HttpContext.Request["month"].ToString();
                            if (CheckDate(smonth))
                            {
                                month = Convert.ToDateTime(HttpContext.Request["month"].ToString() + "01, 1900").Month;
                            }
                            else
                            {
                                ViewBag.Message = "Invalid Month Selection!";
                                month           = 0;
                                smonth          = "";
                            }
                        }
                        else
                        {
                            month  = 0;
                            smonth = "";
                        }
                        if (y == 0 && month > 0)
                        {
                            ViewBag.Message = "Please Select Year!";
                        }

                        List <string>        lDept = db.dept.Select(s => s.department).Distinct().ToList();
                        List <BarChartValue> bc    = new List <BarChartValue>();
                        List <catcount>      c3    = new List <catcount>();
                        dashboard            d     = new dashboard();


                        if (y == 0)
                        {
                            ViewBag.syear  = ""; //DateTime.Today.Year;
                            ViewBag.smonth = "";

                            foreach (string l in lDept)
                            {
                                var temp = db.dataFindings.Where(s => s.department == l).Where(s => s.ignore == 0).ToList();

                                var c = db.dataFindings.Where(s => s.status == 3).Where(s => s.department == l).Where(s => s.ignore == 0).ToList();
                                var r = db.dataFindings.Where(s => s.status == 2).Where(s => s.department == l).Where(s => s.ignore == 0).ToList();
                                var p = db.dataFindings.Where(s => s.status == 1).Where(s => s.department == l).Where(s => s.ignore == 0).ToList();


                                BarChartValue x = new BarChartValue();
                                x.ChartValue = temp.Count;
                                x.completed  = c.Count;
                                x.review     = r.Count;
                                x.pending    = p.Count;
                                x.DeptName   = l;

                                bc.Add(x);
                            }
                        }
                        else
                        {
                            ViewBag.syear  = y;
                            ViewBag.smonth = smonth;
                            if (month > 0)
                            {
                                foreach (string l in lDept)
                                {
                                    var           temp = db.dataFindings.Where(s => s.department == l).Where(s => s.recdate.Year == y).Where(s => s.recdate.Month == month).Where(s => s.ignore == 0).ToList();
                                    var           c    = db.dataFindings.Where(s => s.status == 3).Where(s => s.department == l).Where(s => s.recdate.Year == y).Where(s => s.recdate.Month == month).Where(s => s.ignore == 0).ToList();
                                    var           r    = db.dataFindings.Where(s => s.status == 2).Where(s => s.department == l).Where(s => s.recdate.Year == y).Where(s => s.recdate.Month == month).Where(s => s.ignore == 0).ToList();
                                    var           p    = db.dataFindings.Where(s => s.status == 1).Where(s => s.department == l).Where(s => s.recdate.Year == y).Where(s => s.recdate.Month == month).Where(s => s.ignore == 0).ToList();
                                    BarChartValue x    = new BarChartValue();
                                    x.ChartValue = temp.Count;
                                    x.completed  = c.Count;
                                    x.review     = r.Count;
                                    x.pending    = p.Count;
                                    x.DeptName   = l;
                                    bc.Add(x);
                                }
                            }
                            else
                            {
                                foreach (string l in lDept)
                                {
                                    var           temp = db.dataFindings.Where(s => s.department == l).Where(s => s.recdate.Year == y).Where(s => s.ignore == 0).ToList();
                                    var           c    = db.dataFindings.Where(s => s.status == 3).Where(s => s.department == l).Where(s => s.recdate.Year == y).Where(s => s.ignore == 0).ToList();
                                    var           r    = db.dataFindings.Where(s => s.status == 2).Where(s => s.department == l).Where(s => s.recdate.Year == y).Where(s => s.ignore == 0).ToList();
                                    var           p    = db.dataFindings.Where(s => s.status == 1).Where(s => s.department == l).Where(s => s.recdate.Year == y).Where(s => s.ignore == 0).ToList();
                                    BarChartValue x    = new BarChartValue();
                                    x.ChartValue = temp.Count;
                                    x.completed  = c.Count;
                                    x.review     = r.Count;
                                    x.pending    = p.Count;
                                    x.DeptName   = l;
                                    bc.Add(x);
                                }
                            }
                        }



                        List <tbl_classification> categories = db.classification.ToList();
                        foreach (var cat in categories)
                        {
                            //d.cc.count.Add(db.dataFindings.Where(e => e.classification == cat.classification).Count());
                            int      cnt  = db.dataFindings.Where(e => e.classification == cat.classification).Count();
                            string   c1   = cat.classification.ToString();
                            catcount cat1 = new catcount();
                            cat1.categories = c1;
                            cat1.count1     = cnt;

                            c3.Add(cat1);
                        }


                        d.bcv = bc;

                        d.bcc = c3;

                        ViewBag.noOfFindings = db.dataFindings.Where(m => m.ignore == 0).Count();
                        ViewBag.F_pending    = db.dataFindings.Where(m => m.status == 1).Where(m => m.ignore == 0).Count();
                        ViewBag.F_review     = db.dataFindings.Where(m => m.status == 2).Where(m => m.ignore == 0).Count();
                        ViewBag.F_completed  = db.dataFindings.Where(m => m.status == 3).Where(m => m.ignore == 0).Count();

                        return(View(d));
                    }
                }
            }
            return(RedirectToAction("Index", "Login"));
        }