下载ZedGraph
添加 ZedGraph.dll 和ZedGraph.Web.dll的引用
在控件库中添加ZedGraph控件
右键点击工具箱 - 选择项 - .Net Framework 组件 -浏览 -找到ZedGraph.dll 和ZedGraph.Web.dll添加
zedGraphControl 控件就出现在工具箱中
线图示例程序
从工具箱中拖出一个 edGraphControl 控件 (edGraphControl 1 )
在Form1初始化之后调用函数createPane,并将zedGraphControl1作为参数
public Form1()
{
InitializeComponent();
createPane(zedGraphControl1);
}
zedGraphControl1设置函数
public void createPane(ZedGraphControl zgc)
{
GraphPane myPane = zgc.GraphPane;
//设置图标标题和x、y轴标题
myPane.Title.Text = "机票波动情况";
myPane.XAxis.Title.Text = "波动日期";
myPane.YAxis.Title.Text = "机票价格";
//更改标题的字体
FontSpec myFont = new FontSpec("Arial", 20, Color.Red, false, false, false);
myPane.Title.FontSpec = myFont;