Ejemplo n.º 1
0
        public void ChartPie()
        {
            List <string>   chk_kategorie   = new List <string>();
            List <DateTime> chk_daty        = new List <DateTime>();
            List <string>   chk_uzytkownicy = new List <string>();

            GetCheckedNodes(tW_kategorie.Nodes, chk_kategorie);
            GetDates(tW_daty.Nodes, chk_daty);
            GetChecked_uzytkownicy(tW_users.Nodes, chk_uzytkownicy);

            chart1.Series["s2"].Points.Clear();


            foreach (var kat in chk_kategorie)
            {
                List <string> list = new List <string>();
                list.Add(kat);

                var operation = DBaccess.GetOperationWithCategory(chk_daty, list,
                                                                  chk_uzytkownicy.Select(s => int.Parse(s)).ToList());

                if (operation.FirstOrDefault() != null)
                {
                    var suma = operation.Sum(x => x.Kwota);
                    chart1.Series["s2"].Points.AddXY(kat, suma);
                }
            }
        }
Ejemplo n.º 2
0
        public void LineChart()
        {
            List <string>   chk_kategorie   = new List <string>();
            List <DateTime> chk_daty        = new List <DateTime>();
            List <string>   chk_uzytkownicy = new List <string>();

            GetCheckedNodes(tW_kategorie.Nodes, chk_kategorie);
            GetDates(tW_daty.Nodes, chk_daty);
            GetChecked_uzytkownicy(tW_users.Nodes, chk_uzytkownicy);

            chart2.Series["Wydatki"].Points.Clear();

            chart2.Series[0].XValueType = ChartValueType.DateTime;

            var ListOfDataExpense = DBaccess.GetOperationWithCategory(chk_daty, chk_kategorie, chk_uzytkownicy.Select(s => int.Parse(s)).ToList())
                                    .Select(x => new { date = x.Data, price = x.Typ.Equals("wydatek") ? x.Kwota : 0 });

            var ListOfDataIncome = DBaccess.GetOperationWithCategory(chk_daty, chk_kategorie, chk_uzytkownicy.Select(s => int.Parse(s)).ToList())
                                   .Select(x => new { date = x.Data, price = x.Typ.Equals("przychod") ? x.Kwota : 0 });

            chart2.Series[0].Points.DataBind(ListOfDataExpense, "date", "price", "");
            chart2.Series[0].XValueType = ChartValueType.DateTime;

            chart2.Series[1].Points.DataBind(ListOfDataIncome, "date", "price", "");
            chart2.Series[1].XValueType = ChartValueType.DateTime;

            chart2.Series[0].Color       = Color.Red;
            chart2.Series[0].BorderWidth = 5;

            chart2.Series[1].Color       = Color.Green;
            chart2.Series[1].BorderWidth = 5;

            chart2.Series[0].IsValueShownAsLabel = true;
            chart2.Series[0].Font              = new Font(Font.SystemFontName, 15, FontStyle.Regular);
            chart2.Series[0].MarkerSize        = 7;
            chart2.Series[0].MarkerColor       = Color.DarkRed;
            chart2.Series[0].MarkerBorderColor = Color.Black;
            chart2.Series[0].MarkerStyle       = MarkerStyle.Circle;

            chart2.Series[1].IsValueShownAsLabel = true;
            chart2.Series[1].Font              = new Font(Font.SystemFontName, 15, FontStyle.Regular);
            chart2.Series[1].MarkerSize        = 7;
            chart2.Series[1].MarkerColor       = Color.DarkGreen;
            chart2.Series[1].MarkerBorderColor = Color.Black;
            chart2.Series[1].MarkerStyle       = MarkerStyle.Circle;
        }
Ejemplo n.º 3
0
        public void ColumnChart()
        {
            List <string>   chk_kategorie   = new List <string>();
            List <DateTime> chk_daty        = new List <DateTime>();
            List <string>   chk_uzytkownicy = new List <string>();

            GetCheckedNodes(tW_kategorie.Nodes, chk_kategorie);
            GetDates(tW_daty.Nodes, chk_daty);
            GetChecked_uzytkownicy(tW_users.Nodes, chk_uzytkownicy);
            chart3.Series["s1"].Points.Clear();

            var operation     = DBaccess.GetOperationWithCategory(chk_daty, chk_kategorie, chk_uzytkownicy.Select(s => int.Parse(s)).ToList());
            var sumaPrzychody = operation.Where(x => x.Typ.Equals("przychod")).Sum(x => x.Kwota);
            var sumaWydatki   = operation.Where(x => x.Typ.Equals("wydatek")).Sum(x => x.Kwota);

            chart3.Series["s1"].Points.AddXY("Wydatki - " + sumaWydatki, sumaWydatki);
            chart3.Series["s1"].Points.AddXY("Przychody - " + sumaPrzychody, sumaPrzychody);

            chart3.Series[0].Points[0].Color = Color.Red;
            chart3.Series[0].Points[1].Color = Color.Green;
        }