网站首页 > 技术教程 正文
Hello大家好我是开箱测评小汪,在C#项目开发中使用图表控件,有时候我们希望放大或缩小图表控件来看数据细节和整体数据情况。所有本期课程将带介绍Scottplot图表控件如何来实现这个功能。
本期课程要达到的目的:
1、设置鼠标管轮缩放进行缩放
2、设置鼠标右键长按进行拖放
3、X轴锁定缩放
4、Y轴锁定缩放
环境:
Visual Studio 2019 .net5.0
项目中拖拽出三个复选框,然后为每个复选框添加CheckedChanged事件
程序源码:
using ScottPlot;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Scottplot_01
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
var plt = formsPlot1.Plot;
// sample data
//X轴数据
double[] xs = DataGen.Consecutive(51);
//Y轴数据
double[] sin = DataGen.Sin(51);
double[] cos = DataGen.Cos(51);
// 2条曲线
plt.AddScatter(xs, sin);
plt.AddScatter(xs, cos);
// plot参数设置
plt.Title("标题");
plt.XLabel("X轴");
plt.YLabel("Y轴");
//缩放进行配置
formsPlot1.Refresh();
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
//鼠标右键拖拽缩放
this.formsPlot1.Configuration.RightClickDragZoom = this.cbZoomable.Checked;
//鼠标管轮缩放
this.formsPlot1.Configuration.ScrollWheelZoom = this.cbZoomable.Checked;
}
private void cbLockHorizontal_CheckedChanged(object sender, EventArgs e)
{
//锁定水平缩放
this.formsPlot1.Configuration.LockHorizontalAxis = this.cbLockHorizontal.Checked;
}
private void cbLockVertical_CheckedChanged(object sender, EventArgs e)
{
//锁定垂直缩放
this.formsPlot1.Configuration.LockVerticalAxis = this.cbLockVertical.Checked;
}
}
}
本期教程为项目scottplot图表控件增加了对图表进行缩放,X轴锁定缩放,Y轴锁定缩放的功能,但是光有这些内容还是不能满足我们的要求,下期我将为项目增加十字光标尺功能。感谢各位朋友持续关注我的文章更新。欢迎各位朋友点赞、关注、评论谢谢!
猜你喜欢
- 2024-12-20 UG高版本多轴联动开粗分享 ug12.0多轴编程教程
- 2024-12-20 复仇本田抢夺饭碗,雅马哈官宣AXIS Z摩托新配色
- 2024-12-20 沉浸式多用户跟踪解决方案 沉浸式操作
- 2024-12-20 读懂验光单 散光验光报告怎么看? 验光单的散光
- 2024-12-20 Nike ISPA 推出 The Link Axis:近乎完全可回收的可拆卸鞋款
- 2024-12-20 瑞信老将、亚太策略联席主管据悉辞职,将加入Axis Bank
- 2024-12-20 十四、FLUENT中2D Space设置 fluent设置inlet
- 2024-12-20 FANUC报警!非常有用,点赞收藏吧 fanuc 2021报警
- 2024-12-20 3D打印机? 5AxisMaker制造机众筹亮相
- 2024-12-20 图片欣赏:光滑的硬木枪托,自带瞄准镜,萨维奇Axis栓动猎枪
你 发表评论:
欢迎- 08-06linux 和 windows文件格式互相转换
- 08-06谷歌 ChromeOS 已支持 7z、iso、tar 文件格式
- 08-06Linux下比较文件内容的6种方法
- 08-06文件格式及功能汇总
- 08-0610个Linux文件内容查看命令的实用示例
- 08-06Linux-如何区分不同文件类型
- 08-06Zabbix技术分享——监控windows进程资源使用情况
- 08-06Linux系统卡顿?学会ps命令这三招,轻松定位问题进程
- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)