本文总结了图表控件常用的一些属性,对图表开发人员来说是一个很好的参考。
实现绘图步骤:
1.加入控件。
2.创建chart实例并设置相关全局属性(设置chart实例的属性将对所有其他成员,包括所有series实例产生影响)。
3.添加Series序列实例,设置该实例相关属性(设置实例化series的属性作用范围是该series实例,如果为单一series实例,可直接设置其属性而不设置chart实例),并绑定数据源。
常用属性:
(假设控件实例为WebChart1,设置全局属性也可通过实例化chart来设置,即Steema.TeeChart.Chart Chart1 = WebChart1.Chart;在此不考虑这种)
[html]
<EMBED id=ZeroClipboardMovie_1 height=18 name=ZeroClipboardMovie_1 type=application/x-shockwave-flash align=middle pluginspage=http://www.macromedia.com/go/getflashplayer width=18 src=http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf wmode="transparent" flashvars="id=1&width=18&height=18" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" quality="best" menu="false" loop="false">
WebChart1.AutoPostback = false; //自动回发(默认)
WebChart1.GetChartFile = "GetChart.aspx"; //处理数据页(默认),GetChart.aspx内容后附
WebChart1.Width = 400; //显示宽度
WebChart1.Height = 300; //显示高度
WebChart1.PictureFormat = Steema.TeeChart.Export.PictureFormats.Bitmap; //显示图片的格式,默认PNG
WebChart1.TempChart =Steema.TeeChart.Web.TempChartStyle.Session;
//设置保存数据形式,默认File,一般选session。Chart.Aspect(外观属性)
WebChart1.Chart.Aspect.View3D = false; //取消3D表示
[html]
<EMBED id=ZeroClipboardMovie_2 height=18 name=ZeroClipboardMovie_2 type=application/x-shockwave-flash align=middle pluginspage=http://www.macromedia.com/go/getflashplayer width=18 src=http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf wmode="transparent" flashvars="id=2&width=18&height=18" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" quality="best" menu="false" loop="false">
WebChart1.Chart.Header.Visible = false; //是否显示头文字
WebChart1.Chart.Header.Text = "顶部显示文字";
[html]
<EMBED id=ZeroClipboardMovie_3 height=18 name=ZeroClipboardMovie_3 type=application/x-shockwave-flash align=middle pluginspage=http://www.macromedia.com/go/getflashplayer width=18 src=http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf wmode="transparent" flashvars="id=3&width=18&height=18" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" quality="best" menu="false" loop="false">
WebChart1.Chart.Axes.Left.Title.Text = "纵坐标文字显示";
WebChart1.Chart.Axes.Bottom.Title.Text = "横坐标文字显示";
[html]
<EMBED id=ZeroClipboardMovie_4 height=18 name=ZeroClipboardMovie_4 type=application/x-shockwave-flash align=middle pluginspage=http://www.macromedia.com/go/getflashplayer width=18 src=http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf wmode="transparent" flashvars="id=4&width=18&height=18" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" quality="best" menu="false" loop="false">
WebChart1.Chart.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Auto;
//图例显示的样式,包含一下方面:默认auto
WebChart1.Chart.Legend.Alignment=Steema.TeeChart.LegendAlignments.Bottom;
//图例显示位置(显示线条颜色,线条代表对象)
WebChart1.Chart.Legend.Visible = false; //是否显示图例
WebChart1.Chart.Legend.Font.Color = System.Drawing.Color.Black;
//图例文本显示颜色
<strong>Chart.Panel(底板设置)</strong>
WebChart1.Chart.Panel.Color = System.Drawing.Color.AliceBlue;
//底板颜色(似乎不管用)
[html]
<EMBED id=ZeroClipboardMovie_5 height=18 name=ZeroClipboardMovie_5 type=application/x-shockwave-flash align=middle pluginspage=http://www.macromedia.com/go/getflashplayer width=18 src=http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf wmode="transparent" flashvars="id=5&width=18&height=18" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" quality="best" menu="false" loop="false">
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line();
WebChart1.Chart.Series.Add(line); //实例化线,也可以如下一句完成:
Steema.TeeChart.Styles.Line line1 =
new Steema.TeeChart.Styles.Line(WebChart1.Chart);
line1.YValues.DataMember = DS.Tables[0].Columns[2].ToString(); //设置比较刻度(纵坐标)
line1.LabelMember = DS.Tables[0].Columns[1].ToString();
//设置成员标签(横坐标)
line.Title = "111111"; //设置其标题,可以在图例上显示此标题,多线时有用
line.Color = System.Drawing.Color.Red; //设置线条颜色,可不设置,默认
line1.DataSource = DS.Tables[0];
WebChart1.DataBind(); //数据绑定
[html]
<EMBED id=ZeroClipboardMovie_6 height=18 name=ZeroClipboardMovie_6 type=application/x-shockwave-flash align=middle pluginspage=http://www.macromedia.com/go/getflashplayer width=18 src=http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf wmode="transparent" flashvars="id=6&width=18&height=18" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" quality="best" menu="false" loop="false">
protected void Page_Load(object sender, EventArgs e)
{
string chartName=Request.QueryString["Chart"];
if (Session[chartName]!=null)
{
System.IO.MemoryStream chartStream = new System.IO.MemoryStream();
chartStream=((System.IO.MemoryStream)Session[chartName]);
Response.OutputStream.Write(chartStream.ToArray(),0,(int)chartStream.Length);
chartStream.Close();
Session.Remove(chartName);
}
}