MSChart控件文档资料合集.doc_第1页
MSChart控件文档资料合集.doc_第2页
MSChart控件文档资料合集.doc_第3页
MSChart控件文档资料合集.doc_第4页
MSChart控件文档资料合集.doc_第5页
已阅读5页,还剩268页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

介绍MSChart的常用属性和事件2数据源绑定(一),具体代码如下:6数据源绑定方式(二)8数据源绑定(三):9数据源绑定(四):11数据源绑定(四)行绑定13数据源绑定(五)15MSChart的研究(二) 收藏17一.数据源xml18二.数据源Excel18三.数据源CSV文件20继续对MSChart学习:本次主要针对MSChart的图形交互和AJAX的应用。22二. AJAX(一)Click Event23三. AJAX(二)Chart as Trriger29四. AJAX(三)AJAX更新31五. AJAX(四)Real Time Chart35解决MSChart底部横坐标显示不全的问题 收藏38mschart 上下限阈值 画横线 收藏38MSChart for vs2008 收藏39MSCHART全部属性方法介绍 收藏41在access 中创建库表(.net实现)57MSChart学习帮助-开发日志(二).net 3.5 图表控件 收藏62三个电压,三个电流70.NET MSChart应用的一个简单例子76初试 ASP.NET Chart Control83微软图表控件使用初探-数据绑定(交叉表)88MSChart图表控件的一些使用96微软Chart控件导学-数据绑定110Mschart学习(MSchart介绍)116微软图表控件MsChart使用初探122微软Chart控件导学-渲染图表135介绍MSChart的常用属性和事件MSChart的元素组成最常用的属性包括ChartAreas:增加多个绘图区域,每个绘图区域包含独立的图表组、数据源,用于多个图表类型在一个绘图区不兼容时。最常用的属性包括ChartAreas:增加多个绘图区域,每个绘图区域包含独立的图表组、数据源,用于多个图表类型在一个绘图区不兼容时。AlignmentOrientation:图表区对齐方向,定义两个绘图区域间的对齐方式。AlignmentStyle:图表区对齐类型,定义图表间用以对其的元素。AlignWithChartArea:参照对齐的绘图区名称。InnerPlotPosition:图表在绘图区内的位置属性。Auto:是否自动对齐。Height:图表在绘图区内的高度(百分比,取值在0-100 )Width:图表在绘图区内的宽度(百分比,取值在0-100 )X,Y:图表在绘图区内左上角坐标Position:绘图区位置属性,同InnerPlotPosition。Name:绘图区名称。Axis:坐标轴集合Title:坐标轴标题TitleAlignment:坐标轴标题对齐方式Interval:轴刻度间隔大小IntervalOffset:轴刻度偏移量大小MinorGrid:次要辅助线MinorTickMark:次要刻度线MajorGrid:主要辅助线MajorTickMark:主要刻度线DataSourceID:MSChart的数据源。Legends:图例说明。Palette:图表外观定义。Series:最重要的属性,图表集合,就是最终看到的饼图、柱状图、线图、点图等构成的集合;可以将多种相互兼容的类型放在一个绘图区域内,形成复合图。IsValueShownAsLabel:是否显示数据点标签,如果为true,在图表中显示每一个数据值Label:数据点标签文本LabelFormat:数据点标签文本格式LabelAngle:标签字体角度Name:图表名称Points:数据点集合XValueType:横坐标轴类型YValueType:纵坐标轴类型XValueMember:横坐标绑定的数据源(如果数据源为Table,则填写横坐标要显示的字段名称 )YValueMembers:纵坐标绑定的数据源(如果数据源为Table,则填写纵坐标要显示的字段名称,纵坐标可以有两个 ) ChartArea:图表所属的绘图区域名称ChartType:图表类型(柱形、饼形、线形、点形等)Legend:图表使用的图例名称Titles:标题集合。width:MSChart的宽度。height:MSChart的高度。常用事件:Series1.Points.DataBind() 绑定数据点集合,如果要在一个MSChart控件的一个绘图区(ChartArea)内添加多个不同数据源的图表,就用这个主动绑定数据集合的方法。可以将表中指定字段的值绑定到指定的坐标轴上。MSChart1.DataBind() 给整个MSChart绑定一个数据源,该MSChart中的图表全部可以使用该数据源作为统计来源。本文来自CSDN博客,转载请标明出处:/jetable/archive/2009/01/08/3727444.aspx下面给一个自己做的例子:view plaincopy to clipboardprint?int date = new int 20, 40, 50, 80, 30, 10, 60 ; int test = new int 10, 80, 70, 40, 20, 50,90; Chart1.Width = 600; /图片宽度 Chart1.Height = 400; /图片高度 Chart1.BackColor = Color.Azure; /图片背景色 /建一个图表集合 Series series = new Series(test); series.ChartType = SeriesChartType.Column; /图标集类型,Line为直线,SpLine为曲线 series.Color = Color.Green; /线条颜色 series.BorderWidth = 2; /线条宽度 series.ShadowOffset = 1; /阴影宽度 series.IsVisibleInLegend =false; /是否显示数据说明 series.IsValueShownAsLabel = true; series.MarkerStyle = MarkerStyle.Diamond; /线条上的数据点标志类型 series.MarkerSize = 8; / 标志的大小 DateTime date1 = DateTime.Now.Date; for (int i = 0; i date.Length; i+) series.Points.AddXY(date1, datei); date1 = date1.AddDays(1); Chart1.Series.Add(series); /把数据集添加到Chart1中 /再建一个图表集合 Series series1 = new Series(ok); series1.ChartType = SeriesChartType.Column; /图标集类型,Line为直线,SpLine为曲线 series1.Color = Color.Red; /线条颜色 series1.BorderWidth = 2; /线条宽度 series1.ShadowOffset = 1; /阴影宽度 series1.IsVisibleInLegend = false; /是否显示数据说明 series1.IsValueShownAsLabel = true; series1.MarkerStyle = MarkerStyle.Diamond; series1.MarkerSize = 8; DateTime date2 = DateTime.Now.Date; for (int i = 0; i test.Length; i+) series1.Points.AddXY(date2, testi); date2 = date2.AddDays(1); Chart1.Series.Add(series1); /把数据集添加到Chart1中 /设置坐标轴 Chart1.ChartAreas0.AxisX.LineColor = Color.Blue; Chart1.ChartAreas0.AxisY.LineColor = Color.Blue; Chart1.ChartAreas0.AxisX.LineWidth = 2; Chart1.ChartAreas0.AxisY.LineWidth = 2; Chart1.ChartAreas0.AxisY.Title = 总额; /设置网格线 Chart1.ChartAreas0.AxisX.MajorGrid.LineColor = Color.Blue; Chart1.ChartAreas0.AxisY.MajorGrid.LineColor = Color.Blue; int date = new int 20, 40, 50, 80, 30, 10, 60 ; int test = new int 10, 80, 70, 40, 20, 50,90; Chart1.Width = 600; /图片宽度 Chart1.Height = 400; /图片高度 Chart1.BackColor = Color.Azure; /图片背景色 /建一个图表集合 Series series = new Series(test); series.ChartType = SeriesChartType.Column; /图标集类型,Line为直线,SpLine为曲线 series.Color = Color.Green; /线条颜色 series.BorderWidth = 2; /线条宽度 series.ShadowOffset = 1; /阴影宽度 series.IsVisibleInLegend =false; /是否显示数据说明 series.IsValueShownAsLabel = true; series.MarkerStyle = MarkerStyle.Diamond; /线条上的数据点标志类型 series.MarkerSize = 8; / 标志的大小 DateTime date1 = DateTime.Now.Date; for (int i = 0; i date.Length; i+) series.Points.AddXY(date1, datei); date1 = date1.AddDays(1); Chart1.Series.Add(series); /把数据集添加到Chart1中 /再建一个图表集合 Series series1 = new Series(ok); series1.ChartType = SeriesChartType.Column; /图标集类型,Line为直线,SpLine为曲线 series1.Color = Color.Red; /线条颜色 series1.BorderWidth = 2; /线条宽度 series1.ShadowOffset = 1; /阴影宽度 series1.IsVisibleInLegend = false; /是否显示数据说明 series1.IsValueShownAsLabel = true; series1.MarkerStyle = MarkerStyle.Diamond; series1.MarkerSize = 8; DateTime date2 = DateTime.Now.Date; for (int i = 0; i test.Length; i+) series1.Points.AddXY(date2, testi); date2 = date2.AddDays(1); Chart1.Series.Add(series1); /把数据集添加到Chart1中 /设置坐标轴 Chart1.ChartAreas0.AxisX.LineColor = Color.Blue; Chart1.ChartAreas0.AxisY.LineColor = Color.Blue; Chart1.ChartAreas0.AxisX.LineWidth = 2; Chart1.ChartAreas0.AxisY.LineWidth = 2; Chart1.ChartAreas0.AxisY.Title = 总额; /设置网格线 Chart1.ChartAreas0.AxisX.MajorGrid.LineColor = Color.Blue; Chart1.ChartAreas0.AxisY.MajorGrid.LineColor = Color.Blue; 最后显示的图片:数据源绑定(一),具体代码如下:view plaincopy to clipboardprint?protected void Page_Load(object sender, EventArgs e) string fileName = Server.MapPath(.); fileName += App_Datachartdata.mdb; Chart1.Width = 600; /图表宽度 Chart1.Height = 400; /图表高度 Chart1.BackColor = Color.Azure; /图表背景色 Chart1.Titles.Add(房地产); /图表标题 /新建连接 using (OleDbConnection con=new OleDbConnection(PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=+fileName) OleDbCommand cmd = new OleDbCommand(SELECT Name, Sales FROM REPS, con); con.Open(); OleDbDataReader read = cmd.ExecuteReader(); Chart1.DataBindTable(read, Name); read.Close(); /注意数据绑定后,它的series是1而不是0 Chart1.Series1.IsValueShownAsLabel = true; /是否显示数据 Chart1.Series1.IsVisibleInLegend = false; /是否显示数据说明 Chart1.Series1.MarkerStyle = MarkerStyle.Circle; /线条上的数据点标志类型 Chart1.Series1.MarkerSize = 8; /标志大小 Chart1.ChartAreas0.AxisX.LineColor = Color.Blue; /X轴颜色 Chart1.ChartAreas0.AxisY.LineColor = Color.Blue; /Y轴颜色 Chart1.ChartAreas0.AxisX.LineWidth = 2; /X轴宽度 Chart1.ChartAreas0.AxisY.LineWidth = 2; /Y轴宽度 Chart1.ChartAreas0.AxisY.Title = 价格; /Y轴标题 protected void Page_Load(object sender, EventArgs e) string fileName = Server.MapPath(.); fileName += App_Datachartdata.mdb; Chart1.Width = 600; /图表宽度 Chart1.Height = 400; /图表高度 Chart1.BackColor = Color.Azure; /图表背景色 Chart1.Titles.Add(房地产); /图表标题 /新建连接 using (OleDbConnection con=new OleDbConnection(PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=+fileName) OleDbCommand cmd = new OleDbCommand(SELECT Name, Sales FROM REPS, con); con.Open(); OleDbDataReader read = cmd.ExecuteReader(); Chart1.DataBindTable(read, Name); read.Close(); /注意数据绑定后,它的series是1而不是0 Chart1.Series1.IsValueShownAsLabel = true; /是否显示数据 Chart1.Series1.IsVisibleInLegend = false; /是否显示数据说明 Chart1.Series1.MarkerStyle = MarkerStyle.Circle; /线条上的数据点标志类型 Chart1.Series1.MarkerSize = 8; /标志大小 Chart1.ChartAreas0.AxisX.LineColor = Color.Blue; /X轴颜色 Chart1.ChartAreas0.AxisY.LineColor = Color.Blue; /Y轴颜色 Chart1.ChartAreas0.AxisX.LineWidth = 2; /X轴宽度 Chart1.ChartAreas0.AxisY.LineWidth = 2; /Y轴宽度 Chart1.ChartAreas0.AxisY.Title = 价格; /Y轴标题 效果图如下:数据源绑定方式(二)view plaincopy to clipboardprint?protected void Page_Load(object sender, EventArgs e) string fileName = Server.MapPath(.); fileName += App_Datachartdata.mdb; Chart1.Width = 600; /图表宽度 Chart1.Height = 400; /图表高度 Chart1.BackColor = Color.Azure; /图表背景色 Chart1.Titles.Add(房地产); /图表标题 /新建连接 using (OleDbConnection con=new OleDbConnection(PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=+fileName) OleDbCommand cmd = new OleDbCommand(SELECT Name, Sales FROM REPS, con); con.Open(); /OleDbDataReader read = cmd.ExecuteReader(); /Chart1.DataBindTable(read, Name); /read.Close(); Chart1.DataSource = cmd; Chart1.Series0.XValueMember = Name; Chart1.Series0.YValueMembers = Sales; con.Close(); Chart1.DataBind(); 效果图如下:数据源绑定(三):view plaincopy to clipboardprint?protected void Page_Load(object sender, EventArgs e) string fileName = Server.MapPath(.); fileName += App_Datachartdata.mdb; Chart1.Width = 600; /图表宽度 Chart1.Height = 400; /图表高度 Chart1.BackColor = Color.Azure; /图表背景色 Chart1.Titles.Add(房地产); /图表标题 /新建连接 using (OleDbConnection con=new OleDbConnection(PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=+fileName) OleDbCommand cmd = new OleDbCommand(SELECT GrossSales FROM SALES WHERE QuarterEnding #01/01/2002#, con); con.Open(); OleDbDataReader read = cmd.ExecuteReader(); Chart1.Series0.Points.DataBindY(read, GrossSales); read.Close(); protected void Page_Load(object sender, EventArgs e) string fileName = Server.MapPath(.); fileName += App_Datachartdata.mdb; Chart1.Width = 600; /图表宽度 Chart1.Height = 400; /图表高度 Chart1.BackColor = Color.Azure; /图表背景色 Chart1.Titles.Add(房地产); /图表标题 /新建连接 using (OleDbConnection con=new OleDbConnection(PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=+fileName) OleDbCommand cmd = new OleDbCommand(SELECT GrossSales FROM SALES WHERE QuarterEnding #01/01/2002#, con); con.Open(); OleDbDataReader read = cmd.ExecuteReader(); Chart1.Series0.Points.DataBindY(read, GrossSales); read.Close(); 效果图如下:数据源绑定(四): view plaincopy to clipboardprint?protected void Page_Load(object sender, EventArgs e) string fileName = Server.MapPath(.); fileName += App_Datachartdata.mdb; Chart1.Width = 600; /图表宽度 Chart1.Height = 400; /图表高度 Chart1.BackColor = Color.Azure; /图表背景色 Chart1.Titles.Add(房地产); /图表标题 /新建连接 using (OleDbConnection con=new OleDbConnection(PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=+fileName) OleDbCommand cmd = new OleDbCommand(SELECT * FROM REPSALES, con); con.Open(); OleDbDataReader read = cmd.ExecuteReader(); Chart1.DataBindCrossTable(read, Name, Year, Sales, Label=CommissionsC); read.Close(); / Chart1.Legends.Add(Name); protected void Page_Load(object sender, EventArgs e) string fileName = Server.MapPath(.); fileName += App_Datachartdata.mdb; Chart1.Width = 600; /图表宽度 Chart1.Height = 400; /图表高度 Chart1.BackColor = Color.Azure; /图表背景色 Chart1.Titles.Add(房地产); /图表标题 /新建连接 using (OleDbConnection con=new OleDbConnection(PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=+fileName) OleDbCommand cmd = new OleDbCommand(SELECT * FROM REPSALES, con); con.Open(); OleDbDataReader read = cmd.ExecuteReader(); Chart1.DataBindCrossTable(read, Name, Year, Sales, Label=CommissionsC); read.Close(); / Chart1.Legends.Add(Name); 效果图如下:(有点不理想,Legend中出现了Series1,关于legend的设置还有待研究)数据源绑定(四)行绑定view plaincopy to clipboardprint?protected void Page_Load(object sender, EventArgs e) string fileName = Server.MapPath(.); fileName += App_Datachartdata.mdb; Chart1.Width = 600; /图表宽度 Chart1.Height = 400; /图表高度 Chart1.BackColor = Color.Azure; /图表背景色 Chart1.Titles.Add(Bind By Rows); /图表标题 using (OleDbConnection con=new OleDbConnection(PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source= + fileName) OleDbCommand cmd = new OleDbCommand(SELECT * FROM SALESCOUNTS, con); OleDbDataAdapter oda = new OleDbDataAdapter(); oda.SelectCommand = cmd; DataSet ds = new DataSet(); oda.Fill(ds); foreach (DataRow row in ds.Tables0.Rows) string seriesName=rowSalesRep.ToString(); Chart1.Series.Add(seriesName); Chart1.SeriesseriesName.ChartType = SeriesChartType.Line; Chart1.SeriesseriesName.BorderWidth = 2; for (int col = 1; col ds.Tables0.Columns.Count; col+) string colName = ds.Tables0.Columnscol.ColumnName; int yVal = Convert.ToInt32(rowcolName.ToString(); Chart1.SeriesseriesName.Points.AddXY(colName, yVal); protected void Page_Load(object sender, EventArgs e) string fileName = Server.MapPath(.); fileName += App_Datachartdata.mdb; Chart1.Width = 600; /图表宽度 Chart1.Height = 400; /图表高度 Chart1.BackColor = Color.Azure; /图表背景色 Chart1.Titles.Add(Bind By Rows); /图表标题 using

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论