plotModel = new PlotModel()
{
Title = "数据统计",
LegendTitle = "Max:红色,Min:黄色",
LegendOrientation = LegendOrientation.Horizontal,
LegendPlacement = LegendPlacement.Inside,
LegendPosition = LegendPosition.TopRight,
LegendBackground = OxyColor.FromAColor(, OxyColors.Beige),
LegendBorder = OxyColors.Black,
DefaultFont = "微软雅黑",
}; #region X,Y轴 //X轴
var _dateAxis = new DateTimeAxis()
{
MajorGridlineStyle = LineStyle.Solid,
MinorGridlineStyle = LineStyle.Dot,
IntervalLength = ,
IsZoomEnabled = false,
IsPanEnabled = false,
StringFormat = "M/d HH:mm:ss",
Title = "时间"
};
plotModel.Axes.Add(_dateAxis); //Y轴
var _valueAxis = new LinearAxis()
{
Title = "数值",
Maximum = usl + usl / ,
Minimum = lsl - lsl / ,
MajorGridlineStyle = LineStyle.Solid,//主刻度设置格网
MinorGridlineStyle = LineStyle.Dot,//子刻度设置格网样式
IntervalLength = ,
Angle = ,
IsZoomEnabled = true,//坐标轴缩放
IsPanEnabled = true,//图表缩放功能
Position = AxisPosition.Left,
};
plotModel.Axes.Add(_valueAxis); #endregion #region 线条 //动态线条
var lineSerial = new LineSeries()
{
Title = SvidSelected.ParaName,//eqpParam name
Color = OxyColors.Black,
Smooth = true,
MarkerType = MarkerType.Circle,
StrokeThickness = ,
MarkerSize = ,
MarkerStroke = OxyColors.BlueViolet,
};
plotModel.Series.Add(lineSerial); Task.Factory.StartNew(() =>
{
for (int i = ; i < resData.Count; i++)
{
lineSerial.Points.Add(DateTimeAxis.CreateDataPoint(resData[i].occurenceTime, resData[i].val));
plotModel.InvalidatePlot(true); //每秒刷新一次视图
//Thread.Sleep(200);
}
sw.Stop();
TotalDate = "总渲染时间(毫秒):" + sw.ElapsedMilliseconds;//sw.ElapsedTicks / (decimal)Stopwatch.Frequency;
}); #endregion #region 上限,下限,中线 //添加标注线
var lineMaxAnnotation = new LineAnnotation()
{//上限
Type = LineAnnotationType.Horizontal,
Y = usl,
Text = "上限:" + usl,
Color = OxyColors.Red,
LineStyle = LineStyle.DashDashDot,
StrokeThickness =
};
plotModel.Annotations.Add(lineMaxAnnotation); var lineMinAnnotation = new LineAnnotation()
{//下限
Type = LineAnnotationType.Horizontal,
Color = OxyColors.Blue,
LineStyle = LineStyle.Dash,
StrokeThickness = ,
Y = lsl,
Text = "下限:" + lsl
};
plotModel.Annotations.Add(lineMinAnnotation); var lineMean = new LineAnnotation()
{//平均
Type = LineAnnotationType.Horizontal,
Color = OxyColors.Green,
LineStyle = LineStyle.LongDash,
StrokeThickness = ,
Y = mean,
Text = "平均:" + mean
};
plotModel.Annotations.Add(lineMean); #endregion #region 最大值,最小值 var min = new ScatterSeries();
var maxDataPoint = DateTimeAxis.CreateDataPoint(maxPoint.occurenceTime, maxPoint.val);
min.Points.Add(new ScatterPoint(maxDataPoint.X, maxDataPoint.Y, ));
min.MarkerFill = OxyColor.FromAColor(, OxyColors.Red);
min.MarkerType = MarkerType.Circle;
plotModel.Series.Add(min); var max = new ScatterSeries();
var minDataPoint = DateTimeAxis.CreateDataPoint(minPoint.occurenceTime, minPoint.val);
max.Points.Add(new ScatterPoint(minDataPoint.X, minDataPoint.Y, ));
max.MarkerFill = OxyColor.FromAColor(, OxyColors.Yellow);
max.MarkerType = MarkerType.Circle;
plotModel.Series.Add(max); #endregion

WPF——OXY绘图_old的更多相关文章

  1. WPF——OXY绘图

    private PlotModel _plotModel; public PlotModel plotModel { get { return _plotModel; } set { _plotMod ...

  2. WPF 在绘图控件(Shape)中添加文字 [2018.7.15]

    原文:WPF 在绘图控件(Shape)中添加文字 [2018.7.15] Q:使用Shape的子类Ellipse画一个圆,如何在圆中添加文字? A:Shape类中不包含Text属性.可使用Shape类 ...

  3. WPF特效-绘图

    原文:WPF特效-绘图                  WPF玩起来还是挺炫酷的.我实现的效果:不同色块交叉,交叉部分颜色叠加显示.(叠加部分暂时用随机颜色代替).单独色块点击弹出以色块颜色为主的附 ...

  4. WPF 实时绘图的逻辑

    实时绘图实际上是两个线程.外部线程直接用thread,只有到绘图那个逻辑才用绘图控件的mycanvas2.Dispatcher.Invoke. 或者说,INVOKE并不是开线程,只是一个绘图的委托而已 ...

  5. WPF中绘图(含调用GDI+)

    private void DrawStuff() { // //if (buffer == null) //{ // buffer = new RenderTargetBitmap((int)Back ...

  6. WPF学习(11)2D绘图

    本篇我们来学习WPF的绘图,在2D绘图中主要有这么几个重要的类:Drawing.Visual和Shape,顺便讲下Brush和BitmapEffect. 1 2D绘图 1.1Drawing类 Draw ...

  7. 《Programming WPF》翻译 第7章 1.图形基础

    原文:<Programming WPF>翻译 第7章 1.图形基础 WPF使得在你的应用程序中使用图形很容易,以及更容易开发你的显卡的能力.这有很多图形构架的方面来达到这个目标.其中最重要 ...

  8. WPF绘制深度不同颜色的3D模型填充图和线框图

    原文:WPF绘制深度不同颜色的3D模型填充图和线框图 在机械测量过程中,测量的数据需要进行软件处理.通常测量一个零件之后,需要重建零件的3D模型,便于观察测量结果是否与所测工件一致. 重建的3D模型需 ...

  9. WPF特效-绘制实时2D激光雷达图

    原文:WPF特效-绘制实时2D激光雷达图 接前两篇: https://blog.csdn.net/u013224722/article/details/80738619 https://blog.cs ...

随机推荐

  1. spark存储模块之内存存储--MemeoryStore

    MemeoryStore 上一节,我们对BlockManager的主要写入方法做了一个整理,知道了BlockMananger的主要写入逻辑,以及对于块信息的管理.但是,由于spark的整个存储模块是在 ...

  2. excel 宏循环行数据 ,Excel统计所有sheet数据行数 VBA

    Sub fun1() '统计每一个sheet有多少行数据 Set s1 = Sheets("Sheet1") 'totalok = 0 To Sheets.Count s1.Cel ...

  3. Nuxt项目搭建到发布部署

    一.项目目录结构: 方式1.直接利用官方提供好的脚手架工具进行搭建:npx create-nuxt-app <项目名> 目录会是这样(具体目录都放些什么,请看官方文档,详细): 方式2.手 ...

  4. python递归函数的执行过程

    举例: def nove(n,a,b,c): if n == 1: print(a,'------------>',c) else: nove(n-1,a,c,b) nove(1,a,b,c) ...

  5. MySQL登录时出现 Access denied for user 'root'@'xxx.xxx.xxx.xxx' (using password: YES) 的原因及解决办法

    场景一:调试web程序访问数据库的时候出现 场景二:MySQL登陆的时候,区分本地localhost登陆,以及远程登陆.即使本地能够登陆,如果不授权也无法远程登陆 分析原因:(区分)当本地出现这样的情 ...

  6. Shell 编程 条件语句

    本篇主要写一些shell脚本条件语句的使用. 条件测试 test 条件表达式 [ 条件表达式 ] 文件测试 -d:测试是否为目录(Directory). -e:测试文件或目录是否存在(Exist). ...

  7. virt-install创建虚拟机并制作成模板

    一.使用virt-install创建新的虚拟机 virt--template --ram --vcpu= --virt-type kvm --cdrom=/Data/kvm/iso/CentOS-.i ...

  8. Dapper: How to get return value ( output value) by call stored procedure

    使用Dapper 执行存储过程插入一条数据,同时返回主键 Dapper 的参数类型有以下四种 System.Data.ParameterDirection public enum ParameterD ...

  9. 如何测试Web服务.2

    -->全文字数:2700,需要占用你几分钟的阅读时间 ,您也可以收藏后,时间充足时再阅读- -->上一节讲了<Web服务基础介绍>,本节介绍可用于测试web服务的开源测试工具. ...

  10. 软件测试生命周期(STLC)的8个阶段的详细信息

    一.演化 ♦1960年代的趋势: ♦1990年代的趋势: ♦2000年代的趋势: 测试的趋势和能力正在发生变化.现在要求测试人员更加注重技术和流程.现在的测试不仅仅局限于发现错误,而且范围更广,从项目 ...