码迷,mamicode.com
首页 > Web开发 > 详细

图表:WebChartControl

时间:2014-07-26 00:51:36      阅读:323      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   io   width   2014   

#region 画统计图
        /// <summary>
        /// 画统计图
        /// </summary>
        private void LoadWebChartControl()
        {
            this.WebChartControl1.Series.Clear();
            var sql = string.Format("{0} and ({1}) order by TimeTypeValue asc", GetSql_Chart(), string.IsNullOrEmpty(AspxGridViewPagger1.FilterSql) ? "1=1" : AspxGridViewPagger1.FilterSql);
            var data = Support.DBHelper.GetDataBySql(sql).ExecuteTable();
            WebChartControl1.Visible = data.Rows.Count >0;
            WebChartControl_Div.Visible = data.Rows.Count > 0;
            List<OrderStatics> listOrderStatics = new List<OrderStatics>();
            List<string> listTime = new List<string>();
            for (int i = 0; i < data.Rows.Count; i++)
            {
                listOrderStatics.Add(new OrderStatics()
                {
                    ChartName = data.Rows[i]["StaticObjValue"].ToString(),
                    ChartX = data.Rows[i]["TimeTypeValue"].ToString(),
                    ChartY = Tool.StringUnit.ToDecimal(data.Rows[i]["moneY"])
                });
                listTime.Add(data.Rows[i]["TimeTypeValue"].ToString());
            }
            List<string> listStaticObjValue = new List<string>();
            listOrderStatics.ForEach(o =>
            {
                if (!listStaticObjValue.Contains(o.ChartName))
                {
                    listStaticObjValue.Add(o.ChartName);
                }
            });
          
            foreach (var objValue in listStaticObjValue)
            {
                #region MyRegion
                var series_name = string.Empty;
                switch (StaObj)
                {
                    case "SellerID"://业务员
                        series_name = GetSellerName(objValue);
                        break;
                    case "ShopName"://店铺
                        series_name = GetShopCName(objValue);
                        break;
                    case "ShippingAgent"://货代
                        series_name = objValue;
                        break;
                }
                Series series = new Series(series_name, ViewType.Line);
                List<OrderStatics> listOrderStaticsItem = listOrderStatics.Where(z => z.ChartName == objValue).OrderBy(o => o.ChartX).ToList();
                foreach (var item in listOrderStaticsItem)
                {
                    series.Points.Add(new SeriesPoint(item.ChartX, item.ChartY));
                }

                //设置标题
              //  var title = new ChartTitle()
              //  WebChartControl1.Titles.Clear();
                //WebChartControl1.Titles.Add(title);
                series.Label.PointOptions.ValueNumericOptions.Format = NumericFormat.Percent;//设置数值显示为百分比
                //series.Label.PointOptions.PointView = PointView.ArgumentAndValues; //设置参数值
                series.ArgumentScaleType = ScaleType.Auto;//设置x坐标显示类型(Qualitative:定性的)
                WebChartControl1.BinaryStorageMode = BinaryStorageMode.Session;
                this.WebChartControl1.Series.Add(series);
                #endregion
            }
        }
      
        #endregion
  <dxchartsui:WebChartControl ID="WebChartControl1" runat="server" Width="1260" Height="300"
                                    ShowLoadingPanelImage="True">
                                </dxchartsui:WebChartControl>

 

bubuko.com,布布扣

图表:WebChartControl,布布扣,bubuko.com

图表:WebChartControl

标签:style   blog   http   color   os   io   width   2014   

原文地址:http://www.cnblogs.com/wzq806341010/p/3868644.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!