zedgraphweb 制作曲折线统计图的特点中,当Y轴上的值超出设置好的警戒值时 如何以另一种颜色显示

Posts - 150,
Articles - 12,
Comments - 1220
(SQL Server & MySQL) DBA
14:28 by 听风吹雨, ... 阅读,
  开源的统计图控件中基本常用的是OpenFlashChar和ZedGraph,今天就先来讲讲ZedGraph的使用。ZedGraph资源ZedGraph来源: ZedGraph相关例子资源:&&ZedGraph的特点:第一,可以先生成图片后再显示,这对一些多用户并发有点帮助。(RenderMode.ImageTag)第二,可以动态生成,不用保存文件,可以减少IO的读写消耗。(RenderMode.RawImage)第三,比较多的呈现方式,比如曲线图、柱状图、饼图等。 &ZedGraph的缺点:第一,编码的时候,在设置属性时太烂了,一点注释都没有,不要说是中文的啦,就连英文都没有,太不方便了。第二,图表的显示比较简陋,没有OpenFlashChar来得好看。&注意事宜第一,当前的最新版本是5.1.5,我以前也使用过4.3.4的版本,这两个版本的差别很大,很多属性都已经不存在了,面向对象的感念可能加强了不少,也清晰了不少,因为现在的属性设置都是先实体,再属性了,而以前就比较混乱了。所以在使用不同的版本的时候要注意这点。第二,在Windows Forms和 ASP.Net Web Form中使用是不同。&一个简单的入门例子 第一,在 bin文件夹中加入 Zedgraph.dll 和Zedgraph.web.dll;第二,添加这两个dll的引用;第三,在网站下要创建一个空文件夹,名称为 'ZedGraphImages',这个文件夹名称是默认的,要修改这个文件夹名称,可以修改属性 RenderedImagePath,CacheDuration缓存的持续时间。ZedGraph会生成一图片存放在缓存的目录中,显示图片时,会生成一个img标签代替ZedGraphWeb标签,并在一个时间内,"欺骗"浏览器加载这张图片;第四,在 aspx文件中加入:&%@ Register TagPrefix="zgw" Namespace="ZedGraph.Web" Assembly="ZedGraph.Web" %&;在html中加入&zgw:ZedGraphWeb ID="ZedGraphWeb1" runat="server" Width="300" Height="130" RenderMode="ImageTag"&&/zgw:ZedGraphWeb&& 第五,在cs文件中添加引用: using ZedGusing ZedGraph.Wusing System.D//颜色第六,注册事件,this.ZedGraphWeb1.RenderGraph += new ZedGraph.Web.ZedGraphWebControlEventHandler(GetImage);//注册事件第七,写方法,private void GetImage(ZedGraphWeb zgw, Graphics g, MasterPane masterPane){}具体代码可以参考一些经验传递数据的时候可以使用字典:IDictionary&int, int& dic; 一些属性设置myPane.XAxis.Scale.FontSpec.Size&=&30;//设置x轴的文字大小.myPane.YAxis.Scale.FontSpec.Size&=&30;//设置y轴的文字大小.myPane.YAxis.MajorGrid.IsVisible&=&true;//设置虚线.myPane.Chart.Border.IsVisible&=&false;//图表区域的边框设置.myPane.Legend.IsVisible&=&false;//图表的注释标签显示设置项目.动态根据传入的数据显示的方法&&&&&&&&///&&summary&&&&&&&&&///&曲线图.&&&&&&&&///&&/summary&&&&&&&&&public&void&CreateLineChart(GraphPane&myPane,&IDictionary&int,&int&&dic,&string&title,&string&xField,&string&yFields,&string&format)&&&&&&&&{&&&&&&&&&&&&myPane.XAxis.Scale.FontSpec.Size&=&30;//设置x轴的文字大小.&&&&&&&&&&&&myPane.YAxis.Scale.FontSpec.Size&=&30;//设置y轴的文字大小.&&&&&&&&&&&&myPane.YAxis.MajorGrid.IsVisible&=&true;//设置虚线.&&&&&&&&&&&&myPane.Chart.Border.IsVisible&=&false;//图表区域的边框设置.&&&&&&&&&&&&myPane.Legend.IsVisible&=&false;//图表的注释标签显示设置项目.&&&&&&&&&&&&int&rows&=&dic.C&&&&&&&&&&&&double[]&arrY&=&new&double[rows];&&&&&&&&&&&&double[]&arrX&=&new&double[rows];&&&&&&&&&&&&string[]&labels&=&new&string[rows];&&&&&&&&&&&&int&i&=&0;&&&&&&&&&&&&foreach&(KeyValuePair&int,&int&&kvp&in&dic)&&&&&&&&&&&&{&&&&&&&&&&&&&&&&arrX[i]&=&Convert.ToDouble(kvp.Key);&&&&&&&&&&&&&&&&arrY[i]&=&Convert.ToDouble(kvp.Value);&&&&&&&&&&&&&&&&labels[i]&=&kvp.Key.ToString();&&&&&&&&&&&&&&&&i++;&&&&&&&&&&&&}&&&&&&&&&&&&LineItem&myCurve&=&myPane.AddCurve(title,&arrX,&arrY,&Color.Red,&SymbolType.Square);&&&&&&&&&&&&myCurve.Symbol.Fill&=&new&Fill(Color.Blue,&Color.White,&Color.Blue);//填充这个蓝条,让这蓝条看起来有3D的效果&&&&&&&&&&&&myCurve.Line.Width&=&2;&&&&&&&&&&&&myPane.XAxis.Scale.TextLabels&=&&//X轴的说明文字&&&&&&&&&&&&myPane.XAxis.Type&=&AxisType.T&&&&&&&&}小图的属性设置&&&&&&&&&&&&myPane.XAxis.Scale.FontSpec.Size&=&30;//设置x轴的文字大小.&&&&&&&&&&&&myPane.YAxis.Scale.FontSpec.Size&=&30;//设置y轴的文字大小.&&&&&&&&&&&&myPane.YAxis.MajorGrid.IsVisible&=&true;//设置虚线.&&&&&&&&&&&&myPane.Chart.Border.IsVisible&=&false;//图表区域的边框设置.&&&&&&&&&&&&myPane.Legend.IsVisible&=&false;//图表的注释标签显示设置项目.小图的属性设置刻度问题&&&&&&&&&&&&myPane.YAxis.Scale.Min&=&0;//设置只显示正半轴.&&&&&&&&&&&&myPane.YAxis.Scale.MajorStep&=&1;//设置刻度为1;属性分布图,From &&&相关资料
波浪线图:
RenderMode.ImageTag例子:RenderMode.RawImage例子:&qianshao 的BLOG
用户名:qianshao
文章数:242
评论数:121
访问量:1060850
注册日期:
阅读量:5863
阅读量:12276
阅读量:338658
阅读量:1041546
51CTO推荐博文
使用ZedGraph画曲线柱状图
&& 刚接触到ZedGraph,到网上搜素到的方法基本上都是使用临时文件来存储图片,然后再显示,但是临时图片太多的话会占用大量的空间。很不划算。最后看到有人说把RenderMode="RawImage"就可以了 ,但是会出现乱码。如何解决呢?下面是我的方法。&&& 新建一个目录,命名为bin,把文件ZedGraph.Web.dll,ZedGraph.dll拷到bin目录下面。建立文件tuppian.aspx。其内容为:&%@ Page Language="C#" AutoEventWireup="true" CodeFile="tuppian.aspx.cs" Inherits="tuppian" %&&%@ Register assembly="ZedGraph.Web" namespace="ZedGraph.Web" tagprefix="cc1" %&&%--特别注意了:本页面不要有HTML代码,和asp.net代码。不然会出现乱码,RenderMode="RawImage"一定要设置RawImage,不然会报错。--%&&cc1:ZedGraphWeb ID="ZedGraphWeb1" runat="server" RenderMode="RawImage"&&/cc1:ZedGraphWeb&tuppian.aspx.cs为:using S using System.D using System.C using System.C using System.W using System.Web.S using System.Web.UI; using System.Web.UI.WebC using System.Web.UI.WebControls.WebP using System.Web.UI.HtmlC using System.D using ZedG using ZedGraph.W public partial class tuppian : System.Web.UI.Page { &&&&DarwGrapClass dg = new DarwGrapClass(); &&&&protected void Page_Load(object sender, EventArgs e) &&&&{ &&&&} &&&&protected override void OnInit(EventArgs e) &&&&{ &&&&&&&&InitializeComponent(); &&&&&&&&base.OnInit(e); &&&&} &&&&private void InitializeComponent() &&&&{ &&&&&&&&string id = Request.QueryString["id"]; &&&&&&&&switch (id) &&&&&&&&{ &&&&&&&&&&&&case "1": &&&&&&&&&&&&&&&&DrawLine(); &&&&&&&&&&&&&&&& &&&&&&&&&&&&case "2": &&&&&&&&&&&&&&&&DrawPie(); &&&&&&&&&&&&&&&& &&&&&&&&&&&&default: &&&&&&&&&&&&&&&&DrawBar(); &&&&&&&&&&&&&&&& &&&&&&&&} &&&&} &&&&private void DrawBar() &&&&{ &&&&&&&&dg.Type = AnalyticsType.B &&&&&&&&dg.Title = "用户访问柱状图"; &&&&&&&&dg.XAxisTitle = "月份"; &&&&&&&&dg.YAxisTitle = "用户访问数量"; &&&&&&&&Random rand = new Random(); &&&&&&&&string[] aa = { "企业1", "企业2", "企业3" }; &&&&&&&&for (int i = 0; i & 2; i++) &&&&&&&&{ &&&&&&&&&&&&ZedGraph.PointPairList ppl = new ZedGraph.PointPairList(); &&&&&&&&&&&&for (int j = 0; j & 12; j++) &&&&&&&&&&&&{ &&&&&&&&&&&&&&&&double x = rand.Next(10); &&&&&&&&&&&&&&&&double y = rand.NextDouble() * 100; &&&&&&&&&&&&&&&&ppl.Add(x, y); &&&&&&&&&&&&&&&&//dg.NameList.Add((j + 1).ToString() + "月"); &&&&&&&&&&&&&&&&//ppl.Add(j+1,j+1);以此递增 &&&&&&&&&&&&&&&&//dg.NameList.Add("第" + j.ToString() + "月份"); &&&&&&&&&&&&} &&&&&&&&&&&&dg.DataSource.Add(ppl); &&&&&&&&&&&&dg.LabelList.Add("企业" + i.ToString()); &&&&&&&&&&&&//dg.NameList.Add((i + 1).ToString() + "月"); &&&&&&&&} &&&&&&&&for (int k = 0; k & 12; k++) &&&&&&&&{ &&&&&&&&&&&&dg.NameList.Add((k + 1).ToString() + "月"); &&&&&&&&} &&&&&&&&dg.y_step = 5; &&&&&&&&dg.DarwGrap(ZedGraphWeb1); &&&&} &&&&private void DrawPie() &&&&{ &&&&&&&&dg.Type = AnalyticsType.P &&&&&&&&dg.Title = "用户访问饼图"; &&&&&&&&Random rand = new Random(); &&&&&&&&for (int i = 0; i & 3; i++) &&&&&&&&{ &&&&&&&&&&&&dg.ScaleData.Add((i + 2) * rand.Next(100)); &&&&&&&&&&&&dg.NameList.Add("企业:" + i.ToString());//各个部分所代表的含义 &&&&&&&&} &&&&&&&&dg.DarwGrap(ZedGraphWeb1); &&&&} &&&&private void DrawLine() &&&&{ &&&&&&&&dg.Type = AnalyticsType.L &&&&&&&&dg.Title = "用户访问曲线图"; &&&&&&&&dg.XAxisTitle = "月份"; &&&&&&&&dg.YAxisTitle = "用户访问数量"; &&&&&&&&Random rand = new Random(); &&&&&&&&for (int i = 0; i & 2; i++) &&&&&&&&{ &&&&&&&&&&&&ZedGraph.PointPairList ppl = new ZedGraph.PointPairList(); &&&&&&&&&&&&//数据源添加 &&&&&&&&&&&&for (double x = 0; x & 12; x += 1.0) &&&&&&&&&&&&{ &&&&&&&&&&&&&&&&double y = rand.NextDouble() * 100; &&&&&&&&&&&&&&&&ppl.Add(x, y); &&&&&&&&&&&&} &&&&&&&&&&&&//从数据库中取得 &&&&&&&&&&&&//for (int i = 0; i & this.dt.Rows.C i++)&&//这个循环主要是取到里面的说明文字,用了一个数组的方法 &&&&&&&&&&&&//{ &&&&&&&&&&&&//&&&&ppl.Add(i,this.dt.Rows[i].Cells[1].Text.Trim()); &&&&&&&&&&&&//} &&&&&&&&&&&&//dg.NameList.Add("第" + i.ToString() + "月份"); &&&&&&&&&&&&dg.DataSource.Add(ppl); &&&&&&&&&&&&dg.NameList.Add("企业:" + i.ToString()); &&&&&&&&} &&&&&&&&//改变x组的显示字符,当然也可以绑定数据库,从数据库中取得。 &&&&&&&&for (int k = 0; k & 12; k++) &&&&&&&&{ &&&&&&&&&&&&dg.LabelList.Add((k + 1).ToString() + "月"); &&&&&&&&} &&&&&&&&//for (int i = 0; i & this.dt.Rows.C i++)&&//这个循环主要是取到里面的说明文字,用了一个数组的方法 &&&&&&&&//{ &&&&&&&&//&&&&dg.LabelList.Add(this.dt.Rows[i].Cells[0].Text.Trim()); &&&&&&&&//} &&&&&&&&dg.DarwGrap(ZedGraphWeb1); } }新建一个类DarwGrapClass.cs,放在App_Code目录下面。其内容为:using S using System.D using System.C using System.W using System.Web.S using System.Web.UI; using System.Web.UI.HtmlC using System.Web.UI.WebC using System.Web.UI.WebControls.WebP using System.D using ZedG using ZedGraph.W using System.Collections.G public enum AnalyticsType { &&&&Line, //折线图 &&&&Line2,//带阴影区域的折线图 &&&&Curve,//带星的折线图 &&&&Curve2,//带阴影区域的星行折线图 &&&&Bar, //柱状图 &&&&Graph, &&&&Pie //饼图 }; public class DarwGrapClass { &&&&public DarwGrapClass() &&&&{ &&&&&&&&// &&&&&&&&//TODO: 在此处添加构造函数逻辑 &&&&&&&&// &&&&} &&&&#region Private Attribute &&&&/**/ &&&&///&&&&&&/// 默认颜色种类 &&&&///&&&&&&private List&Color& defaultColors = new List&Color&(); &&&&/**/ &&&&///&&&&&&/// 统计的个数 &&&&///&&&&&&private int C &&&&#endregion &&&&//Public P &&&&#region Public Property &&&&/**/ &&&&///&&&&&&/// 统计图的名称 &&&&///&&&&&&public string T &&&&/**/ &&&&///&&&&&&/// 横轴的名称(饼图不需要) &&&&///&&&&&&public string XAxisT &&&&/**/ &&&&///&&&&&&/// 纵轴的名称(饼图不需要) &&&&///&&&&&&public string YAxisT &&&&/**/ &&&&///&&&&&&/// 显示的曲线类型:Line,Bar,Pie &&&&///&&&&&&public AnalyticsType T &&&&/**/ &&&&///&&&&&&/// 折线图和柱状图的数据源 &&&&///&&&&&&public List&PointPairList& DataSource = new List&PointPairList&(); &&&&/**/ &&&&///&&&&&&/// 饼图的数据源 &&&&///&&&&&&public List&double& ScaleData = new List&double&(); &&&&/**/ &&&&///&&&&&&/// 各段数据的颜色 &&&&///&&&&&&public List&Color& Colors = new List&Color&(); &&&&/**/ &&&&///&&&&&&/// 各段数据的名称 &&&&///&&&&&&public List&string& NameList = new List&string&(); &&&&/**/ &&&&///&&&&&&/// 用于柱状图,每个圆柱体表示的含义 &&&&///&&&&&&public List&string& LabelList = new List&string&(); &&&&public double y_ &&&&public double x_ &&&&#endregion &&&&public void DarwGrap(ZedGraphWeb ZedGraph) &&&&{ &&&&&&&&ZedGraph.RenderGraph += new ZedGraph.Web.ZedGraphWebControlEventHandler(zedGraphControl_RenderGraph); &&&&} &&&&private void InitDefaultColors() &&&&{ &&&&&&&&defaultColors.Add(Color.Red); &&&&&&&&defaultColors.Add(Color.Green); &&&&&&&&defaultColors.Add(Color.Blue); &&&&&&&&defaultColors.Add(Color.Yellow); &&&&&&&&defaultColors.Add(Color.YellowGreen); &&&&&&&&defaultColors.Add(Color.Brown); &&&&&&&&defaultColors.Add(Color.Aqua); &&&&&&&&defaultColors.Add(Color.Cyan); &&&&&&&&defaultColors.Add(Color.DarkSeaGreen); &&&&&&&&defaultColors.Add(Color.Indigo); &&&&} &&&&/**/ &&&&///&&&&&&/// 如果属性为空则初始化属性数据 &&&&///&&&&&&private void InitProperty() &&&&{ &&&&&&&&InitDefaultColors(); &&&&&&&&if (string.IsNullOrEmpty(Title)) &&&&&&&&{ &&&&&&&&&&&&Title = "未命名统计图"; &&&&&&&&} &&&&&&&&if (string.IsNullOrEmpty(XAxisTitle)) &&&&&&&&{ &&&&&&&&&&&&XAxisTitle = "横轴"; &&&&&&&&} &&&&&&&&if (string.IsNullOrEmpty(YAxisTitle)) &&&&&&&&{ &&&&&&&&&&&&YAxisTitle = "纵轴"; &&&&&&&&} &&&&&&&&if (Type == AnalyticsType.Pie) &&&&&&&&{ &&&&&&&&&&&&Count = ScaleData.C &&&&&&&&} &&&&&&&&else &&&&&&&&{ &&&&&&&&&&&&Count = DataSource.C &&&&&&&&} &&&&&&&&if (Colors.Count == 0 || Colors.Count != Count) &&&&&&&&{ &&&&&&&&&&&&Random r = new Random(); &&&&&&&&&&&&int tempIndex = 0; &&&&&&&&&&&&List&int& tempIndexList = new List&int&(); &&&&&&&&&&&&for (int i = 0; i & C i++) &&&&&&&&&&&&{ &&&&&&&&&&&&&&&&tempIndex = r.Next(defaultColors.Count); &&&&&&&&&&&&&&&&if (tempIndexList.Contains(tempIndex)) &&&&&&&&&&&&&&&&{ &&&&&&&&&&&&&&&&&&&&i--; &&&&&&&&&&&&&&&&} &&&&&&&&&&&&&&&&else &&&&&&&&&&&&&&&&{ &&&&&&&&&&&&&&&&&&&&tempIndexList.Add(tempIndex); &&&&&&&&&&&&&&&&&&&&Colors.Add(defaultColors[tempIndex]); &&&&&&&&&&&&&&&&} &&&&&&&&&&&&} &&&&&&&&} &&&&&&&&if (NameList.Count == 0) &&&&&&&&{ &&&&&&&&&&&&if (Type == AnalyticsType.Bar) &&&&&&&&&&&&{ &&&&&&&&&&&&&&&&for (int i = 1; i & DataSource[0].Count + 1; i++) &&&&&&&&&&&&&&&&{ &&&&&&&&&&&&&&&&&&&&NameList.Add("第" + i.ToString() + "组"); &&&&&&&&&&&&&&&&} &&&&&&&&&&&&} &&&&&&&&&&&&else &&&&&&&&&&&&{ &&&&&&&&&&&&&&&&for (int i = 1; i & Count + 1; i++) &&&&&&&&&&&&&&&&{ &&&&&&&&&&&&&&&&&&&&NameList.Add("第" + i.ToString() + "组"); &&&&&&&&&&&&&&&&} &&&&&&&&&&&&} &&&&&&&&} &&&&&&&&if (LabelList.Count == 0) &&&&&&&&{ &&&&&&&&&&&&for (int i = 0; i & C i++) &&&&&&&&&&&&{ &&&&&&&&&&&&&&&&LabelList.Add("含义" + i.ToString()); &&&&&&&&&&&&} &&&&&&&&} &&&&&&&&if (x_step == 0.0) &&&&&&&&&&&&x_step = 5; &&&&&&&&if (y_step == 0.0) &&&&&&&&&&&&y_step = 5; &&&&} &&&&/**/ &&&&///&&&&&&/// 画图 &&&&///&&&&&&///&&&&&&///&&&&&&///&&&&&&private void zedGraphControl_RenderGraph(ZedGraphWeb zgw, System.Drawing.Graphics g, ZedGraph.MasterPane masterPane) &&&&{ &&&&&&&&InitProperty(); &&&&&&&&GraphPane myPane = masterPane[0]; &&&&&&&&myPane.Title.Text = T &&&&&&&&myPane.XAxis.Title.Text = XAxisT &&&&&&&&myPane.YAxis.Title.Text = YAxisT &&&&&&&&//if (true) &&&&&&&&//{ &&&&&&&&// DrawMessage(myPane, "yiafdhaskjhfasfksahfasdlhfaslf lasgfasglgsadi"); &&&&&&&&// pane.AxisChange(g); &&&&&&&&// &&&&&&&&//} &&&&&&&&switch (Type) &&&&&&&&{ &&&&&&&&&&&&case AnalyticsType.Line: &&&&&&&&&&&&&&&&DrawLine(myPane); &&&&&&&&&&&&&&&& &&&&&&&&&&&&case AnalyticsType.Bar: &&&&&&&&&&&&&&&&DrawBar(myPane); &&&&&&&&&&&&&&&& &&&&&&&&&&&&case AnalyticsType.Pie: &&&&&&&&&&&&&&&&DrawPie(myPane); &&&&&&&&&&&&&&&& &&&&&&&&&&&&case AnalyticsType.Line2: &&&&&&&&&&&&&&&&DrawLine2(myPane); &&&&&&&&&&&&&&&& &&&&&&&&&&&&case AnalyticsType.Curve: &&&&&&&&&&&&&&&&DrawCurve(myPane); &&&&&&&&&&&&&&&& &&&&&&&&&&&&case AnalyticsType.Curve2: &&&&&&&&&&&&&&&&DrawCurve2(myPane); &&&&&&&&&&&&&&&& &&&&&&&&&&&&default: &&&&&&&&&&&&&&&& &&&&&&&&} &&&&&&&&masterPane.AxisChange(g); &&&&} &&&&#region Draw &&&&/**/ &&&&///&&&&&&/// 画折线图 &&&&///&&&&&&///&&&&&&private void DrawLine(GraphPane graphPane) &&&&{ &&&&&&&&for (int i = 0; i & C i++) &&&&&&&&{ &&&&&&&&&&&&graphPane.AddCurve(NameList[i], DataSource[i], Colors[i], SymbolType.None); &&&&&&&&&&&&string[] labels = LabelList.ToArray(); &&&&&&&&&&&&graphPane.XAxis.Scale.TextLabels = &&&&&&&&&&&&graphPane.XAxis.Type = AxisType.T &&&&&&&&&&&&graphPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, 255, 166), 90F); &&&&&&&&&&&&graphPane.Fill = new Fill(Color.FromArgb(250, 250, 255)); &&&&&&&&&&&&graphPane.YAxis.Scale.MajorStep = y_ &&&&&&&&} &&&&} &&&&/**/ &&&&///&&&&&&/// 画折线图,带阴影区域 &&&&///&&&&&&///&&&&&&private void DrawLine2(GraphPane graphPane) &&&&{ &&&&&&&&for (int i = 0; i & C i++) &&&&&&&&{ &&&&&&&&&&&&graphPane.AddCurve(NameList[i], DataSource[i], Colors[i], SymbolType.None).Line.Fill = new Fill(Color.White, Colors[i], 90F); &&&&&&&&&&&&string[] labels = LabelList.ToArray(); &&&&&&&&&&&&graphPane.XAxis.Scale.TextLabels = &&&&&&&&&&&&graphPane.XAxis.Type = AxisType.T &&&&&&&&&&&&graphPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, 255, 166), 90F); &&&&&&&&&&&&graphPane.Fill = new Fill(Color.FromArgb(250, 250, 255)); &&&&&&&&&&&&graphPane.YAxis.Scale.MajorStep = y_ &&&&&&&&} &&&&} &&&&/**/ &&&&///&&&&&&/// 画星行折线图 &&&&///&&&&&&///&&&&&&private void DrawCurve(GraphPane graphPane) &&&&{ &&&&&&&&for (int i = 0; i & C i++) &&&&&&&&{ &&&&&&&&&&&&graphPane.AddCurve(NameList[i], DataSource[i], Colors[i], SymbolType.Star); &&&&&&&&&&&&string[] labels = LabelList.ToArray(); &&&&&&&&&&&&graphPane.XAxis.Scale.TextLabels = &&&&&&&&&&&&graphPane.XAxis.Type = AxisType.T &&&&&&&&&&&&graphPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, 255, 166), 90F); &&&&&&&&&&&&graphPane.Fill = new Fill(Color.FromArgb(250, 250, 255)); &&&&&&&&&&&&graphPane.YAxis.Scale.MajorStep = y_ &&&&&&&&} &&&&} &&&&/**/ &&&&///&&&&&&/// 画星行折线图,带阴影区域 &&&&///&&&&&&///&&&&&&private void DrawCurve2(GraphPane graphPane) &&&&{ &&&&&&&&for (int i = 0; i & C i++) &&&&&&&&{ &&&&&&&&&&&&graphPane.AddCurve(NameList[i], DataSource[i], Colors[i], SymbolType.Star).Line.Fill = new Fill(Color.White, Colors[i],90F); &&&&&&&&&&&&string[] labels = LabelList.ToArray(); &&&&&&&&&&&&graphPane.XAxis.Scale.TextLabels = &&&&&&&&&&&&graphPane.XAxis.Type = AxisType.T &&&&&&&&&&&&graphPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, 255, 166), 90F); &&&&&&&&&&&&graphPane.Fill = new Fill(Color.FromArgb(250, 250, 255)); &&&&&&&&&&&&graphPane.YAxis.Scale.MajorStep = y_ &&&&&&&&} &&&&} &&&&/**/ &&&&///&&&&&&/// 画柱状图 &&&&///&&&&&&///&&&&&&private void DrawBar(GraphPane graphPane) &&&&{ &&&&&&&&for (int i = 0; i & C i++) &&&&&&&&{ &&&&&&&&&&&&graphPane.AddBar(LabelList[i], DataSource[i], Colors[i]).Bar.Fill = new Fill(Colors[i], Color.White, Colors[i]); &&&&&&&&&&&&//.Line.Fill = new Fill(Color.White, Color.Red, 45F); &&&&&&&&&&&&//.Line.Fill = new Fill(Color.White, Color.Blue, 45F); &&&&&&&&} &&&&&&&&graphPane.XAxis.MajorTic.IsBetweenLabels = &&&&&&&&string[] labels = NameList.ToArray(); &&&&&&&&graphPane.XAxis.Scale.TextLabels = &&&&&&&&graphPane.XAxis.Type = AxisType.T &&&&&&&&graphPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, 255, 166), 90F); &&&&&&&&//graphPane.Fill = new Fill(Color.FromArgb(250, 250, 255)); &&&&&&&&graphPane.Fill = new Fill(Color.White, Color.FromArgb(200, 200, 255), 45.0f); &&&&&&&&//graphPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45.0f); &&&&&&&&graphPane.YAxis.Scale.MajorStep = y_ &&&&&&&&//graphPane.BaseDimension =8; &&&&} &&&&/**/ &&&&///&&&&&&/// 画饼图 &&&&///&&&&&&///&&&&&&private void DrawPie(GraphPane graphPane) &&&&{ &&&&&&&&graphPane.Fill = new Fill(Color.White, Color.Silver, 45.0f); &&&&&&&&graphPane.Legend.Position = LegendPos.F &&&&&&&&graphPane.Legend.Location = new Location(0.95f, 0.15f, CoordType.PaneFraction, AlignH.Right, AlignV.Top); &&&&&&&&graphPane.Legend.FontSpec.Size = 20f; &&&&&&&&graphPane.Legend.IsHStack = &&&&&&&&for (int i = 0; i & C i++) &&&&&&&&{ &&&&&&&&&&&&graphPane.AddPieSlice(ScaleData[i], Colors[i], Color.White, 45f, 0, NameList[i]); &&&&&&&&} &&&&} &&&&/**/ &&&&///&&&&&&/// 如果系统出错,显示错误信息 &&&&///&&&&&&///&&&&&&///&&&&&&private void DrawMessage(GraphPane graphPane, string message) &&&&{ &&&&&&&&TextObj text = new TextObj(message, 200, 200); &&&&&&&&text.Text = &&&&&&&&graphPane.GraphObjList.Add(text); &&&&} &&&&#endregion } 最后,注意当画饼图时,有时注释会把图片遮住,这时只要设置图片长和高的比例就可以了。曲线图和直方图的xM的说明文字如果太多的话,就会屏蔽掉一些,这是也只要设置长和高的比例就可以解决问题了。
了这篇文章
类别:┆阅读(0)┆评论(0)
16:01:34 15:01:33君,已阅读到文档的结尾了呢~~
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
ZedGraph 属性
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口使用ZedGraph画曲线柱状图_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
使用ZedGraph画曲线柱状图
上传于||文档简介
&&刚​接​触​到​Z​e​d​G​r​a​p​h​,​到​网​上​搜​素​到​的​方​法​基​本​上​都​是​使​用​临​时​文​件​来​存​储​图​片​,​然​后​再​显​示​,​但​是​临​时​图​片​太​多​的​话​会​占​用​大​量​的​空​间​。​很​不​划​算​。​最​后​看​到​有​人​说​把​R​e​n​d​e​r​M​o​d​e​=​&​q​u​o​t​;​R​a​w​I​m​a​g​e​&​q​u​o​t​;​就​可​以​了​ ​,​但​是​会​出​现​乱​码​。
阅读已结束,如果下载本文需要使用2下载券
想免费下载本文?
定制HR最喜欢的简历
下载文档到电脑,查找使用更方便
还剩10页未读,继续阅读
定制HR最喜欢的简历
你可能喜欢

我要回帖

更多关于 折线统计图的特点 的文章

 

随机推荐