当前位置: 首页 > news >正文

OxyPlot图表曲线图学习笔记(winform)

一、学习OxyPlot

开源地址:https://github.com/oxyplot/oxyplot
最新版:v2.1.2
新建winform,nuget中添加依赖包
在这里插入图片描述

二、写代码

2.1 BarSeries

在这里插入图片描述

2.2 ScatterSeries

在这里插入图片描述

2.3 LineSeries (带指向箭头)

在这里插入图片描述

int pointCount = 50;
double[] xs = Consecutive(pointCount);
double[] ys1 = RandomWalk(pointCount);
double[] ys2 = RandomWalk(pointCount);// create lines and fill them with data points
var line1 = new OxyPlot.Series.LineSeries()
{Title = $"Series 1",Color = OxyPlot.OxyColors.Blue,StrokeThickness = 1,
};var line2 = new OxyPlot.Series.LineSeries()
{Title = $"Series 2",Color = OxyPlot.OxyColors.Red,StrokeThickness = 1,
};for (int i = 0; i < pointCount; i++)
{line1.Points.Add(new OxyPlot.DataPoint(xs[i], ys1[i]));line2.Points.Add(new OxyPlot.DataPoint(xs[i], ys2[i]));
}// create the model and add the lines to it
var model = new OxyPlot.PlotModel
{Title = $"Line Plot ({pointCount:N0} points each)"
};
model.Series.Add(line1);
model.Series.Add(line2);// load the model into the user control
plotView1.Model = model;//箭头
var arrowAnnotation = new OxyPlot.Annotations.ArrowAnnotation
{StartPoint = new DataPoint(30, 30),EndPoint = new DataPoint(40, 30)
};
plotView1.Model.Annotations.Add(arrowAnnotation);
plotView1.Model.InvalidatePlot(true);//刷新绘图区域

2.4 LinearAxis(带提示线)

在这里插入图片描述

2.5 LineSeries(多实例)

在这里插入图片描述
在这里插入图片描述

2.6 柱状图(堆叠/排列)

在这里插入图片描述
在这里插入图片描述

2.7 相关参数注释(参考wpf)

      this.Axes = new ElementCollection(this);              //坐标轴集合;this.Series = new ElementCollection(this);            //线条集合;this.Annotations = new ElementCollection(this);       //注解;this.Legends = new ElementCollection(this);           //图例;this.PlotType = PlotType.XY;                          //坐标系类型;this.PlotMargins = new OxyThickness(double.NaN);    //外边距this.Padding = new OxyThickness(8);                 //内边距this.Background = OxyColors.Undefined;              //图表背景this.PlotAreaBackground = OxyColors.Undefined;      //图表区域背景this.TextColor = OxyColors.Black;                   //图表内的字体颜色(标题、图例、注解、坐标轴)this.TitleColor = OxyColors.Automatic;              //标题字体颜色this.SubtitleColor = OxyColors.Automatic;           //子标题字体颜色this.DefaultFont = "Segoe UI";                      //默认字体this.DefaultFontSize = 12;                          //默认字体大小this.TitleToolTip = null;                           //标题提示this.TitleFont = null;                              //标题字体this.TitleFontSize = 18;                            //标题字体大小this.TitleFontWeight = FontWeights.Bold;            //标题字重this.SubtitleFont = null;                           //子标题字体this.SubtitleFontSize = 14;                         //子标题字体大小this.SubtitleFontWeight = FontWeights.Normal;       //子标题字重this.TitlePadding = 6;                              //标题内边距this.ClipTitle = true;                              //是否裁剪标题this.TitleClippingLength = 0.9;                     //标题裁剪矩形长度this.PlotAreaBorderColor = OxyColors.Black;             //图表区域边框颜色this.PlotAreaBorderThickness = new OxyThickness(1);     //图表区域边框大小this.EdgeRenderingMode = EdgeRenderingMode.Automatic;   //边角渲染模式this.AssignColorsToInvisibleSeries = true;              //是否自动分配颜色给不可见的线条this.IsLegendVisible = true;                            //图例是否可见(要使用图例则必须设置线条标题)   ***其他属性****RenderingDecorator  //渲染装饰器Subtitle            //子标题Title               //标题TitleHorizontalAlignment    //标题和子标题的水平对齐方式***Annotation**注解Layer               //注解渲染层(默认为AboveSeries)XAxis               //X轴XAxisKey            //X轴的键YAxis               //Y轴YAxisKey            //Y轴的键ClipByXAxis         //是否由X轴范围裁剪ClipByYAxis         //是否由Y轴范围裁剪***Series***Background          //背景色IsVisible           //是否可见Title               //标题LegendKey           //对应的图例的键SeriesGroupName     //分组名称RenderInLegend      //是否在图例中显示TrackerFormatString //Tracker格式化字符串TrackerKey          //对应的Tracker的键参考https://dlgcy.com/oxyplot-wpf-public-props/使用备忘https://dlgcy.com/oxyplot-wpf-use-way/

更多内容,vx私信交流。jiuailtd

相关文章:

  • python基础及网络爬虫
  • C语言第三十七弹---文件操作(下)
  • 【新手适用】手把手教你从零开始实现一个基于Pytorch的卷积神经网络CNN一: 创建model模块和加载数据集
  • MySQL 函数
  • Java后端八股------消息中间件篇
  • 微信小程序云开发教程——墨刀原型工具入门(素材面板)
  • 记录一个编译的LLVM 含clang 和 PTX 来支持 HIPIFY 的构建配置
  • Java的控制流语句详解
  • 网络通信另个角度的认识(进程间通信),端口号(为什么要有,和pid的关系,如何封装,和进程的定位原理+对应关系)客户端如何拿到服务端的port
  • 数据结构奇妙旅程之二叉平衡树进阶---AVL树
  • scrapy的基本使用介绍
  • CUDA入门之统一内存
  • 学习大数据,所需要Java基础(9)
  • taosdb快速入门
  • Docker的基本概念和优势
  • CentOS7 安装JDK
  • echarts花样作死的坑
  • exif信息对照
  • Java Agent 学习笔记
  • k个最大的数及变种小结
  • Puppeteer:浏览器控制器
  • SpiderData 2019年2月23日 DApp数据排行榜
  • Web设计流程优化:网页效果图设计新思路
  • windows下如何用phpstorm同步测试服务器
  • Zsh 开发指南(第十四篇 文件读写)
  • 从地狱到天堂,Node 回调向 async/await 转变
  • 从零开始在ubuntu上搭建node开发环境
  • 基于Android乐音识别(2)
  • 视频flv转mp4最快的几种方法(就是不用格式工厂)
  • 一些css基础学习笔记
  • 最近的计划
  • Java性能优化之JVM GC(垃圾回收机制)
  • 阿里云服务器如何修改远程端口?
  • ​secrets --- 生成管理密码的安全随机数​
  • !!Dom4j 学习笔记
  • #if和#ifdef区别
  • #pragma multi_compile #pragma shader_feature
  • #宝哥教你#查看jquery绑定的事件函数
  • (M)unity2D敌人的创建、人物属性设置,遇敌掉血
  • (Matalb回归预测)PSO-BP粒子群算法优化BP神经网络的多维回归预测
  • (二)springcloud实战之config配置中心
  • (二)正点原子I.MX6ULL u-boot移植
  • (分布式缓存)Redis持久化
  • (附源码)springboot社区居家养老互助服务管理平台 毕业设计 062027
  • (数据结构)顺序表的定义
  • (未解决)jmeter报错之“请在微信客户端打开链接”
  • (转) ns2/nam与nam实现相关的文件
  • (转)C#调用WebService 基础
  • (转)大型网站架构演变和知识体系
  • .chm格式文件如何阅读
  • .libPaths()设置包加载目录
  • .Net Core和.Net Standard直观理解
  • .NET Entity FrameWork 总结 ,在项目中用处个人感觉不大。适合初级用用,不涉及到与数据库通信。
  • .net 提取注释生成API文档 帮助文档
  • .Net 知识杂记