云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > ZedGraph控件属性及基础教程详解(2003)

ZedGraph控件属性及基础教程详解(2003)

  • 62 次阅读
  • 3 次下载
  • 2025/5/7 1:28:45

ZedGraph 属性及基础教程

myPane.FontSpec.FontColor = Color.Green; // Add gridlines to the plot, and make them gray myPane.XAxis.IsShowGrid = true; myPane.YAxis.IsShowGrid = true;

myPane.XAxis.GridColor = Color.LightGray; myPane.YAxis.GridColor = Color.LightGray;

// Move the legend location

base.Pane.Legend.Position = ZedGraph.LegendPos.Bottom; // Make both curves thicker myCurve.Line.Width = 2.0F; myCurve2.Line.Width = 2.0F; // Fill the area under the curves

myCurve.Line.Fill = new Fill( Color.White, Color.Red, 45F ); myCurve2.Line.Fill = new Fill( Color.White, Color.Blue, 45F ); // Increase the symbol sizes, and fill them with solid white myCurve.Symbol.Size = 8.0F; myCurve2.Symbol.Size = 8.0F;

myCurve.Symbol.Fill = new Fill( Color.Red ); myCurve2.Symbol.Fill = new Fill( Color.White ); // Add a background gradient fill to the axis frame myPane.AxisFill = new Fill( Color.White, Color.FromArgb( 255, 255, 210), -45F ); // Add a caption and an arrow

TextItem myText = new TextItem( \23F, 7F ); myText.FontSpec.FontColor = Color.Red; myText.Location.AlignH = AlignH.Center; myText.Location.AlignV = AlignV.Top; myPane.GraphItemList.Add( myText );

ArrowItem myArrow = new ArrowItem( Color.Red, 12F, 7F, 5F, 20F, 8F ); myPane.GraphItemList.Add( myArrow ); base.ZedGraphControl.AxisChange();

9 / 33

ZedGraph 属性及基础教程

} }

}

我们可以看到,这个例子和第一节中的例子大部分都相同,我在这只讲它们不同的地方,和不好懂的地方。 和第一节的图相比,本节的图在Pane上添加了Grid的显示,其功能要归功于如下代码:

myPane.XAxis.IsShowGrid = true; myPane.YAxis.IsShowGrid = true;

myPane.XAxis.GridColor = Color.LightGray; myPane.YAxis.GridColor = Color.LightGray;

代码一目了然,我就不用多解释什么了,要说的是注意在ZedGraph中,很多都是有缺省值的,IsShowGrid的缺省值就是false,所以第一节中没有对此项进行设置就没有显示Grid。

上节我就已经说过

LineItem myCurve = myPane.AddCurve( \Color.Red, SymbolType.Diamond ); myCurve接收myPane.AddCurve的返回值后就可以对里面的线图作近一步的描述,

myCurve.Line.Width = 2.0F;、myCurve.Line.Fill = new Fill( Color.White, Color.Red, 45F ); 和myCurve.Symbol.Fill = new Fill( Color.Red );

就是其中的三个应用,一个是Line的宽度,第二个表示Line要填充下面的区域,以45度角从左到右从白到红的填充,第三个表示线图上的符号被填充成什么颜色的。效果见下图:

关于Legend的类请见下图:

base.Pane.Legend.Position = ZedGraph.LegendPos.Bottom;

10 / 33

ZedGraph 属性及基础教程

就是显示Pane中的图形的名字,它里面也有很多属性和方法,如果大家写上base.Pane.Legend.IsVisible = false ;那么就可以隐藏图形的名字。

TextItem类的主要方法是在Pane中显示一个textbox的文本框,见上图 ArrowItem类的主要方法是在Pane上显示一个箭头,

ArrowItem myArrow = new ArrowItem( Color.Red, 12F, 7F, 5F, 20F, 8F ); 构造函数的参数含义分别为颜色,箭头的大小,箭头的起始(x,y),终止(x,y)。

基本教程篇--第三节、第四节DateAxisSampleDemo.cs和TextAxisSampleDemo.cs介绍

由于这两个例子很简单也很相似,所以决定还是放到一起来写。按照惯例还是先给出代码和图示。

11 / 33

ZedGraph 属性及基础教程

代码如下:

DateAxisSampleDemo:

using System;

using System.Drawing; using System.Collections; using ZedGraph;

namespace ZedGraph.Demo

{

12 / 33

搜索更多关于: ZedGraph控件属性及基础教程详解(2003) 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

ZedGraph 属性及基础教程 myPane.FontSpec.FontColor = Color.Green; // Add gridlines to the plot, and make them gray myPane.XAxis.IsShowGrid = true; myPane.YAxis.IsShowGrid = true; myPane.XAxis.GridColor = Color.LightGray; myPane.YAxis.GridColor = Color.LightGray;

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com