用ZedGraph作图表(二)

这一次创建一个bar图(代码取至ZedGraph的Demo)


public void CreateBar(ZedGraphControl zgc)
{
GraphPane myPane = zgc.GraphPane;

// 设置图表的说明文字
myPane.Title.Text = "Vertical Bars with Value Labels Above Each Bar";

// 设置横坐标的说明文字
myPane.XAxis.Title.Text = "Position Number";

// 设置纵坐标的说明文字
myPane.YAxis.Title.Text = "Some Random Thing";

PointPairList list = new PointPairList();
PointPairList list2 = new PointPairList();
PointPairList list3 = new PointPairList();
Random rand = new Random();

// Generate random data for three curves
for ( int i=0; i<5; i++ )
{
double x = (double) i;
double y = rand.NextDouble() * 1000;
double y2 = rand.NextDouble() * 1000;
double y3 = rand.NextDouble() * 1000;
list.Add( x, y );
list2.Add( x, y2 );
list3.Add( x, y3 );
}

// 创建每个bar
BarItem myCurve = myPane.AddBar( "curve 1", list, Color.Blue );
BarItem myCurve2 = myPane.AddBar( "curve 2", list2, Color.Red );
BarItem myCurve3 = myPane.AddBar( "curve 3", list3, Color.Green );

// 设置图标的颜色和渐变色
myPane.Chart.Fill = new Fill( Color.White,
Color.FromArgb( 255, 255, 166), 45.0F );

zgc.AxisChange();

// 创建每条bar的label,其中第2个参数表示是否显示在bar的中心位置,第3个参数表示label的排列方向
BarItem.CreateBarLabels( myPane, false, "f0" );
}

Technorati : ZedGraph作图表

转载于:https://www.cnblogs.com/wzywjy/archive/2006/08/11/474115.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值