首页 > 代码库 > 图表:WebChartControl
图表:WebChartControl
#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 =http://www.mamicode.com/ 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 = http://www.mamicode.com/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>
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。