示例#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.GetItemPriceTopList(userId, today);

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

        this.hidChartData.Value = ItemHelper.GetChartData(lists, "ItemBuyDate");
    }
示例#3
0
    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.GetItemPriceTopList(userId, today);

        string max       = "1";
        string step      = "1";
        string itemName  = "";
        string itemPrice = "";

        if (dt.Rows.Count > 0)
        {
            max  = Math.Ceiling(Convert.ToDouble(dt.Rows[0]["ItemPrice"])).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;
                itemPrice += dr["ItemPrice"].ToString() + dot;
                i++;
            }
        }

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