• 用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作图表

  • 相关阅读:
    记一次ntp反射放大ddos攻击
    除了binlog2sql工具外,使用python脚本闪回数据(数据库误操作)
    vmware linux虚拟机忘记密码怎么办
    flask(二)
    flask(一)
    发布一个Django项目
    nginx的使用
    redis的下载及使用
    Linux虚拟机没有IP的解决办法
    Mariadb的安装与使用
  • 原文地址:https://www.cnblogs.com/liye/p/1798896.html
Copyright © 2020-2023  润新知