示例#1
0
    //设置图表
    private void GetChartInfo()
    {
        DataTable dt  = new DataTable();
        DateTime  now = DateTime.Now.Date;

        if (curDate != "")
        {
            now = Convert.ToDateTime(curDate).Date;
        }

        switch (chartType)
        {
        case "datechart":
            decimal priceMax = 0m;
            dt        = month_bll.GetItemDateTopList(userId, now, "chart", out priceMax);
            chartDate = ItemHelper.GetChartData(dt, "ItemBuyDate");
            chartUrl  = "/Web2015/ItemDateChartJson.aspx?date=" + curDate;
            break;

        case "numchart":
            dt        = month_bll.GetItemNumTopList(userId, now);
            chartDate = ItemHelper.GetChartData(dt, "ChartUrl");
            chartUrl  = "/Web2015/ItemNumChartJson.aspx?date=" + curDate;
            break;

        case "pricechart":
            dt        = month_bll.GetItemPriceTopList(userId, now);
            chartDate = ItemHelper.GetChartData(dt, "ItemBuyDate");
            chartUrl  = "/Web2015/ItemPriceChartJson.aspx?date=" + curDate;
            break;
        }
    }
示例#2
0
    //初始数据
    private void PopulateControls()
    {
        DataTable lists = bll.GetItemNumTopList(userId, today);

        NumTop.DataSource = lists;
        NumTop.DataBind();

        this.hidChartData.Value = ItemHelper.GetChartData(lists, "PageUrl");
    }
    private void PopulateControls()
    {
        int      userId = Convert.ToInt32(Session["UserID"]);
        DateTime today  = Convert.ToDateTime(Session["TodayDate"]);

        if (curDate != "")
        {
            today = Convert.ToDateTime(curDate);
        }

        MonthBLL  bll = new MonthBLL();
        DataTable dt  = bll.GetItemNumTopList(userId, today);

        int    countMax = 0;
        string max      = "1";
        string step     = "1";
        string itemName = "";
        string countNum = "";

        if (dt.Rows.Count > 0)
        {
            countMax = Convert.ToInt32(dt.Rows[0]["CountNum"]);
            max      = countMax.ToString();
            step     = Math.Floor(Convert.ToDouble(max) / 10).ToString();

            int i = 0;
            foreach (DataRow dr in dt.Rows)
            {
                if (i == 15)
                {
                    break;
                }
                string dot = (i < 15 - 1 && i < dt.Rows.Count - 1 ? "," : "");
                itemName += "{\"text\":\"" + dr["ItemName"].ToString() + "\",\"rotate\":90}" + dot;
                countNum += dr["CountNum"].ToString() + dot;
                i++;
            }
        }

        Response.Write(GetChartJsonString(itemName, countNum, max, step));
        Response.End();
    }