博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
报表统计(八) 访问数据库 Position
阅读量:5921 次
发布时间:2019-06-19

本文共 3465 字,大约阅读时间需要 11 分钟。

View Code
1  public partial class WebForm1 : System.Web.UI.Page 2     { 3         protected void Page_Load(object sender, EventArgs e) 4         { 5             if (!IsPostBack) 6             { 7                 CreateChart(); 8             } 9         }10 11         public DataTable GetTempData()12         {13             string strSql = "SELECT * FROM ChartDB";14             SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=DEMO;Integrated Security=True");15             SqlDataAdapter da = new SqlDataAdapter(strSql, con);16             DataSet ds = new DataSet();17             da.Fill(ds);18             return ds.Tables[0];19         }20 21         public void CreateChart()22         {23             Chart1.Width = 600;24             Chart1.Height = 400;25             Chart1.BackColor = Color.Azure;26             Chart1.ChartAreas[0].AxisX.LineWidth = 3;27             Chart1.ChartAreas[0].AxisX.MajorGrid.LineColor = Color.Red;28             Chart1.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.Red;29             Chart1.ChartAreas[0].AxisY.LineWidth = 1;30             Chart1.ChartAreas[0].Position.X = 2;31             Chart1.ChartAreas[0].Position.Y = 2;32             Chart1.ChartAreas[0].Position.Height = 98;33             Chart1.ChartAreas[0].Position.Width = 98;34             Chart1.DataSource = GetTempData();35             Series s1 = new Series();36             s1.IsValueShownAsLabel = true;37             s1.ChartType = SeriesChartType.Line;38             s1.MarkerStyle = MarkerStyle.Circle;39             s1.MarkerSize = 6;40             Chart1.Series.Add(s1);41             Series s2 = new Series();42             s2.ChartType = SeriesChartType.Line;43             s2.MarkerStyle = MarkerStyle.Cross;44            45             s2.MarkerSize = 6;46             s2.IsValueShownAsLabel = true;47             Chart1.Series.Add(s2);48             Legend l = new Legend();49             l.Docking = Docking.Right;50             l.Alignment = System.Drawing.StringAlignment.Center;51             l.LegendStyle = LegendStyle.Column;52             l.BackColor = Color.LightGoldenrodYellow;53             l.Position.X = 86;54             l.Position.Y = 5;55             l.Position.Height = 20;56             l.Position.Width = 12;57             Chart1.Legends.Add(l);58             Legend l2 = new Legend();59             l2.Docking = Docking.Bottom;60             l2.Alignment = System.Drawing.StringAlignment.Center;61             l2.LegendStyle = LegendStyle.Row;62             Chart1.Legends.Add(l2);63             Legend l1 = new Legend();64             l1.LegendStyle = LegendStyle.Row;65             l1.Docking = Docking.Bottom;66             l1.Alignment = System.Drawing.StringAlignment.Center;67             Chart1.Legends.Add(l1);68             Chart1.Series[0].ChartType = SeriesChartType.Line;69             Chart1.Series[0].XValueMember = "Worker";70             Chart1.Series[0].YValueMembers = "ProductPrice";71             Chart1.Series[0].LegendText = "日收入";72             Chart1.Series[0].ToolTip = "#VALX\t#VALY";73             Chart1.Series[1].XValueMember = "Worker";74             Chart1.Series[1].YValueMembers = "YearPrice";75             Chart1.Series[1].LegendText = "年收入";76             Chart1.Series[2].XValueMember = "Worker";77             Chart1.Series[2].YValueMembers = "MonthPrice";78             Chart1.Series[2].LegendText = "月收入";79             Chart1.DataBind();80         }81     }

转载地址:http://ihnvx.baihongyu.com/

你可能感兴趣的文章
sharepoint2010 数据访问的方式
查看>>
SharePoint 2013 工作流之Visual Studio开发示例篇
查看>>
C# 中New关键字的用法
查看>>
Activity静态变量传递参数
查看>>
MongoDB的复制集
查看>>
js操作符
查看>>
css中常用的标签
查看>>
C# Dapper 简单实例
查看>>
C# 静态类与非静态类、静态成员的区别
查看>>
森林病虫防治系统 (五)
查看>>
第4章 Selenium2-java WebDriver API (三)
查看>>
【Two Sum】cpp
查看>>
【Jump Game II 】cpp
查看>>
HDU 2563 统计问题(递归,思维题)
查看>>
iOS6 自适应旋转处理
查看>>
练习使用DBHelper(代替JDBC)
查看>>
Swift ios应用开发实践
查看>>
OC中如何对内存进行管理的
查看>>
黄聪:WordPress图片插件:Auto Highslide修改版(转)
查看>>
矩阵点乘
查看>>