Пример #1
1
        private void BindOrganizationTypesChart()
        {
            BarChartSeries yearSeries;
            DEWSReference.DeptEstadoDataSoapClient DEWS = new DeptEstadoDataSoapClient();

            foreach (DataRow dRow in DEWS.GetCorpOrganizationTypesByYearSeries().Rows)
            {
                yearSeries = new BarChartSeries();
                yearSeries.Name = dRow["OrganizationFormType"].ToString();
                yearSeries.Data = new decimal[]
                    {
                        Convert.ToDecimal(dRow["CorpTotal2008"]), Convert.ToDecimal(dRow["CorpTotal2009"]),
                        Convert.ToDecimal(dRow["CorpTotal2010"]), Convert.ToDecimal(dRow["CorpTotal2011"]),
                        Convert.ToDecimal(dRow["CorpTotal2012"])
                    };

                bcCorpOrganizationTypes.Series.Add(yearSeries);
            }
        }
Пример #2
0
    private void loadGenderChart()
    {
        BarChartSeries Male = new BarChartSeries();
        Male.BarColor = "#0000FF";
        Male.Name = "Male";

        BarChartSeries Female = new BarChartSeries();
        Female.BarColor = "#FF00FF";
        Female.Name = "Female";

        string strCountMale = "SELECT COUNT (*) AS 'COUNT' FROM Tenants WHERE Gender = 1";
        string strCountFemale = "SELECT COUNT (*) AS 'COUNT' FROM Tenants WHERE Gender = 2";

        int MaleCount = int.Parse(DataAccess.ReturnData(strCountMale, conString, "COUNT"));
        int FemaleCount = int.Parse(DataAccess.ReturnData(strCountFemale, conString, "COUNT"));

        Decimal[] MaleNumbers = {
                                    Convert.ToDecimal(MaleCount)
                                };
        Decimal[] FemaleNumbers = {
                                      Convert.ToDecimal(FemaleCount)
                                  };

        Male.Data = MaleNumbers;
        Female.Data = FemaleNumbers;

        BarChartSeries[] GenderCountCollection = {
                                                     Male, Female
                                                  };

        barchartGender.Series.AddRange(GenderCountCollection);
        barchartGender.DataBind();

        lblTotalTenants.Text = (FemaleCount + MaleCount).ToString();
    }
Пример #3
0
        protected void panelonload(object sender, EventArgs e)
        {
            try
            {
                var sc = new RecipeServiceSoapClient();
                List<MongoMap> mn = new List<MongoMap>();
                //Response.Write(sc.Search("mango"));
                mn = JsonConvert.DeserializeObject<List<MongoMap>>(sc.DataAnalytics());
                // String ca = null, data;

                Dictionary<String,Double> dic=new Dictionary<string, Double>();
                foreach (var map in mn)
                {
                    dic.Add(map._id,map.value.count);
                    //Response.Write(map._id+"-"+map.value.count+"<br/>");
                    if (map.value.count > 100)
                    {
                        // ca += map._id.Replace("PT", "") + ",";
                        BarChartSeries a = new BarChartSeries();
                        a.Name = map._id.Replace("PT", "");
                        a.BarColor = GenerateRandomColour().ToString();
                        a.Data = new[] { Convert.ToDecimal(map.value.count) };
                        BarChart1.Series.Add(a);
                      
                    }
                 
                    GridView2.DataSource = dic;
                    GridView2.DataBind();
                }
                // BarChart1.CategoriesAxis = ca.Substring(0, ca.Count() - 1);
            }
            catch (Exception ex)
            {
                Response.Write(ex);
            }
        }
Пример #4
0
        private void BindBarChart()
        {
            zgSales.Visible = false;
            bcSales.Visible = true;
            if (salesByMonthData == null) { salesByMonthData = CommerceReport.GetSalesByYearMonthBySite(siteSettings.SiteGuid); }

            StringBuilder categories = new StringBuilder();

            string comma = string.Empty;
            List<decimal> revenue = new List<decimal>();

            // original data is sorted descending on Y, M resorting here
            DataRow[] result = salesByMonthData.Select(string.Empty, "Y ASC, M ASC");

            int spaceInterval = 0;
            int totalItems = result.Length;
            int itemsAdded = 0;
            if (totalItems > 12)
            {
                spaceInterval = 4;
            }
            int nextItemToShow = 0;

            foreach (DataRow row in result)
            {
                categories.Append(comma);

                if (itemsAdded == nextItemToShow)
                {
                    categories.Append(row["Y"].ToString());
                    categories.Append("-");
                    categories.Append(row["M"].ToString());
                    nextItemToShow = itemsAdded + spaceInterval;
                }

                comma = ",";

                revenue.Add(Convert.ToDecimal(row["Sales"]));
                itemsAdded += 1;

            }

            bcSales.ChartTitle = Resource.SalesByMonthChartLabel;

            bcSales.CategoriesAxis = categories.ToString();
            BarChartSeries series = new BarChartSeries();
            //series.Name = Resource.SalesByMonthChartSalesLabel;
            series.Data = revenue.ToArray();

            bcSales.Series.Add(series);

            //bcSales.CategoriesAxis
            //bcSales.Series.
        }