WPF——OXY绘图_old
2024-10-09 01:45:45
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
最新文章
- PHP扩展安装mcrypt 提示没有可用包(No package php-mcrypt available)
- 【Beta】Daily Scrum Meeting第五次
- JDBC总结(含DbUtils组件)
- iOS开发UI篇—在UITableview的应用中使用动态单元格来完成app应用程序管理界面的搭建
- quick-cocos2d-x之testlua之mainMenu.lua
- JAVA中线程同步的方法(7种)汇总
- Intel HD4000的驱动-黑苹果之路
- maven学习心得整理
- servlet案例
- for循环遍历字符串的还有一种方法
- [APIO2015]八邻旁之桥
- [六] 函数式接口的复合方法示例 predicate 谓词逻辑运算 Function接口 组合运算 比较器 逆序 比较链
- RabbitMQ远程执行任务RPC。
- [转帖]buffer与cache的区别
- 五一培训 清北学堂 DAY2
- CF871D Paths
- js call 理解
- Oracle总结之plsql编程(基础八)
- bootstrap4
- mac与win7(台式电脑)共享文件
热门文章
- 2019 游族网络java面试笔试题 (含面试题解析)
- JavaScript---js语法,数据类型及方法, 数组及方法,JSON对象及方法,日期Date及方法,正则及方法,数据类型转换,运算符, 控制流程(三元运算),函数(匿名函数,自调用函数)
- NodeJS新建服务器以及CommonJS规范
- 微信小程序生命周期详解
- Object中defineProperty数据描述
- CSRF攻击与防御(转)
- 智能制造进入下半场?APS如何进行优化
- Android实现二维码扫描功能
- elasticsearch基础查询
- centos安装redis并且加入开机启动