资源简介
这里解决一个使用图表的都会碰到的问题–跟随鼠标显示值,在QCustomPlot里非常简单,它早就给出了解决方案-QCPItemTracer

代码片段和文件信息
void MEMSCurve::MEMSCurve()
{
//跟踪器
m_xTracer = new MyTracer(m_custPlot MyTracer::XAxisTracer m_custPlot);//x轴
m_tracer1 = new MyTracer(m_custPlot MyTracer::DataTracer m_custPlot);
m_tracer2 = new MyTracer(m_custPlot MyTracer::DataTracer m_custPlot);
m_lineTracer = new MyTracer(m_custPlot MyTracer::CrossLine m_custPlot);//直线
connect(m_custPlot SIGNAL(mouseMove(QMouseEvent*)) this SLOT(myMouseMoveEvent(QMouseEvent*)));
}
void MEMSCurve::myMouseMoveEvent(QMouseEvent* event)
{
int x_pos = event->pos().x();
int y_pos = event->pos().y();
float x_val = EMSTabPage.m_plot.m_custPlot->xAxis->pixelToCoord(x_pos);
float y_val = EMSTabPage.m_plot.m_custPlot->yAxis->pixelToCoord(y_pos);
EMSTabPage.m_plot.m_xTracer->updatePosition(x_val y_val);
auto iter = EMSTabPage.m_plot.m_custPlot->graph(0)->data()->findBegin(x_val);
double value1 = iter->mainValue();
iter = EMSTabPage.m_plot.m_custPlot->graph(1)->data()->findBegin(x_val);
double value2 = iter->mainValue();
EMSTabPage.m_plot.m_tracer1->updatePosition(x_val value1);
EMSTabPage.m_plot.m_tracer2->updatePosition(x_val value2);
EMSTabPage.m_plot.m_lineTracer->updatePosition(x_val y_val);
ui->custPlot->replot();//曲线重绘
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1238 2018-04-16 16:26 MyTracer\main.cpp
文件 4471 2018-04-16 16:22 MyTracer\MyTracer.cpp
文件 977 2018-04-16 15:56 MyTracer\MyTracer.h
文件 137 2018-04-16 16:30 MyTracer\说明.txt
文件 77676 2018-04-16 16:27 MyTracer\运行结果.PNG
目录 0 2018-04-16 16:28 MyTracer
----------- --------- ---------- ----- ----
84499 6
- 上一篇:不掉血源码
- 下一篇:usbview 的vs2005工程
相关资源
- SigmaPlot教程之各种柱形图的数据排列
- uniplot 5.6
- SigmaPlot稳定汉化包
- QCustomPlot下载278871
- CAD批量打印smartbatchplot
- ggplot2手册
- tecplot 10.3 破解版
- Tecplot详细经典教程
- qt下超强绘图控件 QCustomPlot
- Matplotlib中文手册.pdf
- myplot.rar
- SigmaPlot中文教程——SigmaPlotSampleGrap
- iPlot控件(icomp)
- ggplot2(第二版)2016年出版
- qt下超强绘图控件 - QCustomPlot
- Tecplot 360 脚本指南
- plotdigitizer
- Tecplot 360 用户手册
- 2018电影票房分析numpypandasmatplotlib
- ggplot2.Elegant.Graphics.for.Data.Analysis.2nd
- qcustomplot_demo4.zip
- qcustomplot_realtime.zip
- Plotly 绘图模块中文指南第1期
- Tecplot流体模拟软件
- gnuplot 4.6.3 windows版
- serialplot win64
- matplotlib-1.3.1.win-amd64-py2.7.exe
- matplotlib中文用户手册 飞龙译
- Isoplot3.xla
- gnuplot 4.6 中文手册 修订2
评论
共有 条评论