// Group Destinations Chart
        protected ColumnCharts GetChartbyGroupDestinations(List <DataHubData> listSchoolData) // query from database and return charts object
        {
            string[] colors     = new string[] { "#50B432", "#24CBE5", "#f969e8", "#DDDF00", "#64E572", "#FF9655", "#FFF263", "#6AF9C4" };
            int      indexColor = 0;

            var eColumnCharts = new ColumnCharts();

            eColumnCharts.SetDefault(false);
            eColumnCharts.title.text         = " Destinations by Key Results";
            eColumnCharts.yAxis.title.text   = "% of pupils";
            eColumnCharts.yAxis.min          = 0;
            eColumnCharts.yAxis.max          = 60;
            eColumnCharts.yAxis.tickInterval = 10;

            eColumnCharts.series = new List <ACCDataStore.Entity.RenderObject.Charts.ColumnCharts.series>();
            if (listSchoolData != null && listSchoolData.Count > 0)
            {
                eColumnCharts.xAxis.categories = new List <string>()
                {
                    "Education", "Employment", "Training & Other Development", "Unemployed Seeking", "Unemployed not seeking", "Unknown"
                };

                foreach (var eSchool in listSchoolData)
                {
                    List <float?> data = new List <float?>()
                    {
                    };
                    data.Add((float?)eSchool.listPEducationGroup.checkSumPercentage);
                    data.Add((float?)eSchool.listPEmploymentGroup.checkSumPercentage);
                    data.Add((float?)eSchool.listPTrainingGroup.checkSumPercentage);
                    data.Add((float?)eSchool.listNPUnemployedSeekingGroup.checkSumPercentage);
                    data.Add((float?)eSchool.listNPUnemployedNotSeekingGroup.checkSumPercentage);
                    data.Add(eSchool.Unknown.Percent);

                    eColumnCharts.series.Add(new ACCDataStore.Entity.RenderObject.Charts.ColumnCharts.series()
                    {
                        name  = eSchool.SchoolName,
                        data  = data,
                        color = eSchool.SeedCode.Equals("1002") ? "#058DC7" : colors[indexColor]
                    });
                    indexColor++;
                }
            }

            eColumnCharts.exporting = new ACCDataStore.Entity.RenderObject.Charts.Generic.exporting()
            {
                enabled  = true,
                filename = "export"
            };

            eColumnCharts.chart.options3d = new Entity.RenderObject.Charts.Generic.options3d()
            {
                enabled = true, alpha = 10, beta = 10
            };                                                                                                                            // enable 3d charts

            return(eColumnCharts);
        }
        // Overall Destinations Chart
        protected ColumnCharts GetChartOverallDestinations(List <DataHubData> listSchoolData) // query from database and return charts object
        {
            string[] colors     = new string[] { "#50B432", "#24CBE5", "#f969e8", "#DDDF00", "#64E572", "#FF9655", "#FFF263", "#6AF9C4" };
            int      indexColor = 0;

            var eColumnCharts = new ColumnCharts();

            eColumnCharts.SetDefault(false);
            eColumnCharts.title.text         = " Destinations";
            eColumnCharts.yAxis.title.text   = "% of pupils";
            eColumnCharts.yAxis.min          = 0;
            eColumnCharts.yAxis.max          = 100;
            eColumnCharts.yAxis.tickInterval = 20;

            eColumnCharts.series = new List <ACCDataStore.Entity.RenderObject.Charts.ColumnCharts.series>();
            if (listSchoolData != null && listSchoolData.Count > 0)
            {
                eColumnCharts.xAxis.categories = new List <string>()
                {
                    "Participating", "Not Participating", "Unknown"
                };

                foreach (var eSchool in listSchoolData)
                {
                    List <float?> data = new List <float?>()
                    {
                    };
                    data.Add(eSchool.PositiveDestinations.Select(x => x.Percent).Sum());
                    data.Add(eSchool.NonPositiveDestinations.Select(x => x.Percent).Sum());
                    data.Add(eSchool.Unknown.Percent);

                    eColumnCharts.series.Add(new ACCDataStore.Entity.RenderObject.Charts.ColumnCharts.series()
                    {
                        name  = eSchool.SchoolName,
                        data  = data,
                        color = eSchool.SeedCode.Equals("1002") ? "#058DC7" : colors[indexColor]
                    });
                    indexColor++;
                }
            }

            eColumnCharts.exporting = new ACCDataStore.Entity.RenderObject.Charts.Generic.exporting()
            {
                enabled  = true,
                filename = "export"
            };

            eColumnCharts.chart.options3d = new Entity.RenderObject.Charts.Generic.options3d()
            {
                enabled = true, alpha = 10, beta = 10
            };                                                                                                                            // enable 3d charts

            return(eColumnCharts);
        }
        // Cost Breakdown by Supplier
        protected ColumnCharts GetChartCostBySupplier(IList <ChildAgreements> listChildAgreements) // query from database and return charts object
        {
            var eColumnCharts = new ColumnCharts();

            eColumnCharts.SetDefault(false);
            eColumnCharts.title.text       = "Cost breakdown by Supplier (Agreement)";
            eColumnCharts.yAxis.title.text = "Cost (£)";
            eColumnCharts.yAxis.min        = 0;

            if (listChildAgreements != null && listChildAgreements.Count > 0)
            {
                var listCostbySupplier = listChildAgreements.GroupBy(x => x.supplier_code).Select(r => new
                {
                    Supplier_name = r.First().supplier_name,
                    Count         = r.Count().ToString(),
                    Cost          = r.Sum(xl => xl.actual_cost).ToString()
                }).ToList();

                eColumnCharts.series           = new List <ACCDataStore.Entity.RenderObject.Charts.ColumnCharts.series>();
                eColumnCharts.xAxis.categories = new List <string>();
                List <float?> data = new List <float?>()
                {
                };

                foreach (var temp in listCostbySupplier)
                {
                    eColumnCharts.xAxis.categories.Add(temp.Supplier_name);
                    data.Add((float?)Convert.ToDouble(temp.Cost));
                }

                eColumnCharts.series.Add(new ACCDataStore.Entity.RenderObject.Charts.ColumnCharts.series()
                {
                    name  = listChildAgreements[0].client_id,
                    data  = data,
                    color = "#058DC7"
                });
            }

            eColumnCharts.exporting = new ACCDataStore.Entity.RenderObject.Charts.Generic.exporting()
            {
                enabled  = true,
                filename = "export"
            };

            eColumnCharts.chart.options3d = new Entity.RenderObject.Charts.Generic.options3d()
            {
                enabled = true, alpha = 10, beta = 10
            };                                                                                                                            // enable 3d charts

            return(eColumnCharts);
        }
        // Barchart Cost Breakdown by Placement Category
        protected ColumnCharts GetChartCostByPlacementCategory(IList <ChildAgreements> listChildAgreements) // query from database and return charts object
        {
            var eColumnCharts = new ColumnCharts();

            eColumnCharts.SetDefault(false);
            eColumnCharts.title.text       = "Cost breakdown by Placement Category";
            eColumnCharts.yAxis.title.text = "Cost (£)";
            eColumnCharts.yAxis.min        = 0;

            if (listChildAgreements != null && listChildAgreements.Count > 0)
            {
                eColumnCharts.xAxis.categories = new List <string>()
                {
                    "Out of Authority", "Disability", "Commissioned", "Special Parenting"
                };;

                List <float?> data = new List <float?>()
                {
                };
                data.Add((float?)listChildAgreements.Where(x => x.Placement_Category.Equals("OOA")).Select(x => x.actual_cost).Sum());
                data.Add((float?)listChildAgreements.Where(x => x.Placement_Category.Equals("CD")).Select(x => x.actual_cost).Sum());
                data.Add((float?)listChildAgreements.Where(x => x.Placement_Category.Equals("CO")).Select(x => x.actual_cost).Sum());
                data.Add((float?)listChildAgreements.Where(x => x.Placement_Category.Equals("SP")).Select(x => x.actual_cost).Sum());
                //data.Add((float?)listChildAgreements.Where(x => x.Service_Type.Equals("TBC")).Select(x => x.actual_cost).Sum());

                eColumnCharts.series.Add(new ACCDataStore.Entity.RenderObject.Charts.ColumnCharts.series()
                {
                    name  = "Placement Category",
                    data  = data,
                    color = "#058DC7"
                });
            }

            eColumnCharts.exporting = new ACCDataStore.Entity.RenderObject.Charts.Generic.exporting()
            {
                enabled  = true,
                filename = "export"
            };

            eColumnCharts.chart.options3d = new Entity.RenderObject.Charts.Generic.options3d()
            {
                enabled = true, alpha = 10, beta = 10
            };                                                                                                                            // enable 3d charts

            return(eColumnCharts);
        }
        // Barchart Cost Breakdown by ServiceType
        protected ColumnCharts GetChartNoAgreementsByServiceType(IList <ChildAgreements> listChildAgreements) // query from database and return charts object
        {
            var eColumnCharts = new ColumnCharts();

            eColumnCharts.SetDefault(false);
            eColumnCharts.title.text       = "Number of Agreement Breakdown by Service Type";
            eColumnCharts.yAxis.title.text = "Number of Agreements";
            eColumnCharts.yAxis.min        = 0;

            if (listChildAgreements != null && listChildAgreements.Count > 0)
            {
                eColumnCharts.xAxis.categories = new List <string>()
                {
                    "Secure Care", "Children's Home", "Residential School", "Crisis Support/Crisis Care", "To Be Confirmed"
                };;

                List <float?> data = new List <float?>()
                {
                };
                data.Add((float?)listChildAgreements.Where(x => x.Service_Type.Equals("SC")).Count());
                data.Add((float?)listChildAgreements.Where(x => x.Service_Type.Equals("CH")).Count());
                data.Add((float?)listChildAgreements.Where(x => x.Service_Type.Equals("RS")).Count());
                data.Add((float?)listChildAgreements.Where(x => x.Service_Type.Equals("CS")).Count());
                data.Add((float?)listChildAgreements.Where(x => x.Service_Type.Equals("TBC")).Count());

                eColumnCharts.series.Add(new ACCDataStore.Entity.RenderObject.Charts.ColumnCharts.series()
                {
                    name  = "Service Type",
                    data  = data,
                    color = "#058DC7"
                });
            }

            eColumnCharts.exporting = new ACCDataStore.Entity.RenderObject.Charts.Generic.exporting()
            {
                enabled  = true,
                filename = "export"
            };

            eColumnCharts.chart.options3d = new Entity.RenderObject.Charts.Generic.options3d()
            {
                enabled = true, alpha = 10, beta = 10
            };                                                                                                                            // enable 3d charts

            return(eColumnCharts);
        }
Exemple #6
0
        // Pupils by Ages Chart
        protected ColumnCharts GetChartCohortbyCentre(List <SummaryDHdata> listSchoolData, string dataname) // query from database and return charts object
        {
            string[] colors         = new string[] { "#50B432", "#24CBE5", "#f969e8", "#DDDF00", "#64E572", "#FF9655", "#FFF263", "#6AF9C4" };
            string[] datacatagories = { "Positive Destination", "Non-Positive Destination", "Unknown Destination" };

            int indexColor    = 1;
            var eColumnCharts = new ColumnCharts();

            eColumnCharts.SetDefault(false);
            eColumnCharts.title.text       = "Percentage " + dataname + " by Centres";
            eColumnCharts.yAxis.title.text = "Percentage";
            //eColumnCharts.yAxis.min = 0;
            //eColumnCharts.yAxis.max = 100;
            //eColumnCharts.yAxis.tickInterval = 20;
            int indexsubject = Array.FindIndex(datacatagories, item => item.Equals(dataname));

            eColumnCharts.series = new List <ACCDataStore.Entity.RenderObject.Charts.ColumnCharts.series>();
            if (listSchoolData != null && listSchoolData.Count > 0)
            {
                eColumnCharts.xAxis.categories = listSchoolData.Select(x => x.centrename).ToList();


                eColumnCharts.series.Add(new ACCDataStore.Entity.RenderObject.Charts.ColumnCharts.series()
                {
                    type  = "column",
                    name  = "Centres",
                    data  = listSchoolData.Select(x => (float?)float.Parse(x.listdata[indexsubject].sPercent)).ToList(),
                    color = colors[indexColor]
                });

                indexColor++;
            }

            eColumnCharts.exporting = new ACCDataStore.Entity.RenderObject.Charts.Generic.exporting()
            {
                enabled  = true,
                filename = "export"
            };

            eColumnCharts.chart.options3d = new Entity.RenderObject.Charts.Generic.options3d()
            {
                enabled = true, alpha = 10, beta = 10
            };                                                                                                                            // enable 3d charts

            return(eColumnCharts);
        }
        // Pupils by Ages Chart
        protected ColumnCharts GetChartPupilsAges(List <DataHubData> listSchoolData) // query from database and return charts object
        {
            string[] colors        = new string[] { "#50B432", "#24CBE5", "#f969e8", "#DDDF00", "#64E572", "#FF9655", "#FFF263", "#6AF9C4" };
            int      indexColor    = 0;
            var      eColumnCharts = new ColumnCharts();

            eColumnCharts.SetDefault(false);
            eColumnCharts.title.text         = "Pupils by Ages ";
            eColumnCharts.yAxis.title.text   = "% of pupils";
            eColumnCharts.yAxis.min          = 0;
            eColumnCharts.yAxis.max          = 100;
            eColumnCharts.yAxis.tickInterval = 20;

            eColumnCharts.series = new List <ACCDataStore.Entity.RenderObject.Charts.ColumnCharts.series>();
            if (listSchoolData != null && listSchoolData.Count > 0)
            {
                eColumnCharts.xAxis.categories = listSchoolData[0].ListPupilsbyAges.Select(x => x.Code).ToList();
                foreach (var eSchool in listSchoolData)
                {
                    eColumnCharts.series.Add(new ACCDataStore.Entity.RenderObject.Charts.ColumnCharts.series()
                    {
                        name = eSchool.SchoolName,
                        data = eSchool.ListPupilsbyAges.Select(x => x.sPercent.Equals("n/a") ? null : (float?)Convert.ToDouble(x.Percent)).ToList(),
                        //data = eSchool.ListPupilsbyAges.Select(x => (float?)Convert.ToDouble(x.Percent)).ToList(),
                        color = eSchool.SeedCode.Equals("1002") ? "#058DC7" : colors[indexColor]
                    });
                    indexColor++;
                }
            }

            eColumnCharts.exporting = new ACCDataStore.Entity.RenderObject.Charts.Generic.exporting()
            {
                enabled  = true,
                filename = "export"
            };

            eColumnCharts.chart.options3d = new Entity.RenderObject.Charts.Generic.options3d()
            {
                enabled = true, alpha = 10, beta = 10
            };                                                                                                                            // enable 3d charts

            return(eColumnCharts);
        }