• ZedGraph如何去掉外边框?并设置背景颜色


    ZedGraph的在显示曲线图的时候,有外边框一直在显示,会显得特别碍眼,如何去掉它呢?
    这个是原始的现象
    在这里插入图片描述

    1 去掉外边框的做法如下:

                  //去掉外边框
                this.zedGraph.GraphPane.Border.IsVisible = false;
    
    • 1
    • 2

    在这里插入图片描述

    2 设置一下背景颜色

        //设置灰色
       this.zedGraph.GraphPane.Fill = new ZedGraph.Fill(Color.FromArgb(120, 120, 120));
    
      //设置曲线区域的矩形框的颜色  黄色
       this.zedGraph.GraphPane.Chart.Fill = new ZedGraph.Fill(Color.Yellow);
    
       //设置绘制曲线区域的矩形框的边框颜色 红色
       this.zedGraph.GraphPane.Chart.Border.Color = Color.Red;
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    效果如下图:
    在这里插入图片描述

    GraphPane是绘图中主要的类,它包含所有其他类作为属性。还可以设置pane title、pane frame、axis frame以及背景颜色等。GraphPane类是ZedGraph类的外部“包装器”,它提供访问图形属性(比如 YAxis、 XAxis 、CurveList)的接口。

    通过GraphPane接口可以访问到的类有

    描述描述
    CurveListGets or sets the list of CurveItem items for this GraphPane获取或设置此GraphPane的CurveItem项列表
    XAxisAccesses the XAxis for this graph访问此图形的XAxis
    X2AxisAccesses the X2Axis for this graph访问此图形的X2Axis
    YAxisAccesses the primary YAxis for this graph访问此图形的主轴YAxis
    Y2AxisAccesses the primary Y2Axis for this graph访问此图形的主轴Y2Axis
    YAxisListGets the collection of Y axes that belong to this GraphPane获取属于此GraphPane的Y轴集合
    YAxisList2Gets the collection of Y2 axes that belong to this GraphPane获取属于此GraphPane的Y2轴集合
    ChartGets the Chart instance for this GraphPane获取此GraphPane的Chart实例
    BarSettingsGets the BarSettings instance for this GraphPane获取此GraphPane的BarSettings实例

    比如我们修改X轴的标题,

     //通过GraphPane接口访问XAxis,并修改X轴的标题
     this.zedGraph.GraphPane.XAxis.Title.Text = "Hi ,I'm XAxis";
    
    • 1
    • 2

    在这里插入图片描述

    小结一下:
    GraphPane类封装了graph pane,所有的图形相关的元素都与GraphPane相关联。通过GraphPane可以获取其它类(轴、曲线等)的接口。

  • 相关阅读:
    基于Java毕业设计志愿者信息管理系统源码+系统+mysql+lw文档+部署软件
    MapReduce实现KNN算法分类推测鸢尾花种类
    这也能造成故障?我只给DTO类加了一个属性
    【中间件篇-Redis缓存数据库08】Redis设计、实现、redisobject对象设计、多线程、缓存淘汰算法
    code 网址
    JSP request对象功能详解说明
    解析idea中的debug调试模式
    EFCore 的 DbFirst 模式
    pdf文件怎么转换成图片?
    Redis 的网络框架是实现了 Reactor 模型吗?
  • 原文地址:https://blog.csdn.net/weixin_40314351/article/details/127669210