コード例 #1
0
        public List <Duodata <string, int> > BoxPNeighbourhood()
        {
            try
            {
                Table tablechain = DataprocessingInitialisation.BikeBox;
                tablechain = new CountOnColumnElement("Deelgem.", tablechain);
                StringTable   table = tablechain.GetTable();
                List <string> uniqueIDs, amounts;
                uniqueIDs = table.GetColumn("Deelgem.");
                amounts   = table.GetColumn("Amount");
                Duodata <string, int>         toadd;
                List <Duodata <string, int> > toreturn = new List <Duodata <string, int> >();

                for (int i = 0; i < uniqueIDs.Count; i++)
                {
                    toadd = new Duodata <string, int>(uniqueIDs[i], int.Parse(amounts[i]));
                    toreturn.Add(toadd);
                }

                return(toreturn);
            }
            catch (Exception e)
            {
                Scene.SceneManager.getAScene("TestScene").SetParaMeters(e.GetType().ToString() + "\n");
                Scene.SceneManager.getAScene("TestScene").SetParaMeters(e.Message + " ... " + e.StackTrace + "\n");
                List <Duodata <string, int> > temp = new List <Duodata <string, int> >();
                temp.Add(new Duodata <string, int>("Error", 10));
                return(temp);
            }
        }
コード例 #2
0
        public List <Duodata <string, int> > TheftPMonth()
        {
            Table tablechain = DataprocessingInitialisation.BikeTheft;

            Scene.SceneManager.getAScene("TestScene").SetParaMeters(tablechain.GetTable().Columns["Kennisname"].Count.ToString() + " default \n");
            tablechain = new MakePerMonth("Kennisname", tablechain);
            Scene.SceneManager.getAScene("TestScene").SetParaMeters(tablechain.GetTable().Columns["Kennisname"].Count.ToString() + " mademonth \n");
            tablechain = new CountOnColumnElement("Kennisname", tablechain);
            Scene.SceneManager.getAScene("TestScene").SetParaMeters(tablechain.GetTable().Columns["Kennisname"].Count.ToString() + " countedonelement \n");

            StringTable   table = tablechain.GetTable();
            List <string> uniqueIDs, amounts;

            uniqueIDs = table.GetColumn("Kennisname");
            amounts   = table.GetColumn("Amount");

            Duodata <string, int>         toadd;
            List <Duodata <string, int> > toreturn = new List <Duodata <string, int> >();

            for (int i = 0; i < uniqueIDs.Count; i++)
            {
                toadd = new Duodata <string, int>(uniqueIDs[i], int.Parse(amounts[i]));
                toreturn.Add(toadd);
            }
            return(toreturn);
        }
コード例 #3
0
ファイル: PieChart.cs プロジェクト: ChavaDekker/Project4
        //draw pie chart
        public static ARGB[,] Make(List <Duodata <string, int> > aDuodataList)
        {
            int numberofslices = aDuodataList.Count;
            int sizepiechart   = 500;

            ARGB[,] piechart = new ARGB[sizepiechart, sizepiechart];

            double lastAngle = 0;
            double newangle;
            double percentage;
            ARGB   colortofill;



            for (int x = 0; x < sizepiechart; x++)
            {
                for (int y = 0; y < sizepiechart; y++)
                {
                    piechart[x, y] = new ARGB(0, 0, 0, 0);
                }
            }

            int total = 0;

            foreach (Duodata <string, int> i in aDuodataList)
            {
                total += i.GetAttr2();
            }

            for (int j = 0; j < aDuodataList.Count; j++)
            {
                Duodata <string, int> i = aDuodataList[j];

                colortofill = ListOfColorsToUse[j];
                if (i.GetAttr2() > total / 2)
                {
                    percentage = (double)i.GetAttr2() / (double)total / 2;
                    newangle   = lastAngle + 2 * Math.PI * percentage;
                    piechart   = DrawSlice(piechart, lastAngle, newangle, colortofill);
                    lastAngle  = newangle;


                    percentage = (double)i.GetAttr2() / (double)total / 2;
                    newangle   = lastAngle + 2 * Math.PI * percentage;
                    piechart   = DrawSlice(piechart, lastAngle, newangle, colortofill);
                    lastAngle  = newangle;
                }
                else
                {
                    percentage = (double)i.GetAttr2() / (double)total;
                    newangle   = lastAngle + 2 * Math.PI * percentage;
                    piechart   = DrawSlice(piechart, lastAngle, newangle, colortofill);
                    lastAngle  = newangle;
                }
            }

            return(piechart);
        }
コード例 #4
0
        public List <Duodata <string, int> > TheftPColour()
        {
            Table tablechain = DataprocessingInitialisation.BikeTheft;

            tablechain = new FilterOnly("object", "FIETS", tablechain);
            tablechain = new CountOnColumnElement("kleur", tablechain);
            StringTable   table = tablechain.GetTable();
            List <string> uniqueIDs, amounts;

            uniqueIDs = table.GetColumn("kleur");
            amounts   = table.GetColumn("Amount");

            Duodata <string, int>         toadd;
            List <Duodata <string, int> > toreturn = new List <Duodata <string, int> >();

            for (int i = 0; i < uniqueIDs.Count; i++)
            {
                toadd = new Duodata <string, int>(uniqueIDs[i], int.Parse(amounts[i]));
                toreturn.Add(toadd);
            }
            return(toreturn);
        }
コード例 #5
0
        public List <Duodata <string, int> > TheftPMonthInNeighbourhood(string Neighbourhood)
        {
            Table tablechain = DataprocessingInitialisation.BikeTheft;

            tablechain = new MakePerMonth("Kennisname", tablechain);
            tablechain = new FilterOnly("Werkgebied", Neighbourhood, tablechain);
            tablechain = new CountOnColumnElement("Kennisname", tablechain);

            StringTable   table = tablechain.GetTable();
            List <string> uniqueIDs, amounts;

            uniqueIDs = table.GetColumn("Kennisname");
            amounts   = table.GetColumn("Amount");

            Duodata <string, int>         toadd;
            List <Duodata <string, int> > toreturn = new List <Duodata <string, int> >();

            for (int i = 0; i < uniqueIDs.Count; i++)
            {
                toadd = new Duodata <string, int>(uniqueIDs[i], int.Parse(amounts[i]));
                toreturn.Add(toadd);
            }
            return(toreturn);
        }