zoukankan      html  css  js  c++  java
  • 用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作图表

  • 相关阅读:
    Effective Java第三版(一) ——用静态工厂代替构造器
    联合主键下的mapper文件对数据库的批量更新
    dart的基本语法(一)
    单例模式
    给hexo博客的NEXT主题添加一个云日历
    使用nginx+tomcat实现动静分离
    nginx(二)
    nginx(一)
    初识Nginx
    给hexo添加宠物
  • 原文地址:https://www.cnblogs.com/liye/p/1798896.html
Copyright © 2011-2022 走看看