QCustomPlot 实验demo


最近的项目用到了QCustomPlot,所以一边实现功能一边写了实验的demo,里面相关的功能都有提及,刚刚接触QCustomPlot或者由着方面需求的小伙伴可以参考一下,相互学习,共同进步,有关于QCustomPlot的相关问题我们可以共同探讨。
环境:Qt5.9.2(之前5.6.1通过),MinGW编译器。
资源截图
代码片段和文件信息
#include “stdafx.h“

#include “AxisFixedPixelTicker.h“

struct AxisFixedPixelTickerPrivate
{
int m_iPixel = 25;
QCPAxis * m_pDependAxis = nullptr;
};

AxisFixedPixelTicker::AxisFixedPixelTicker(QCPAxis * axis)
: QCPAxisTicker()
 d_ptr(new AxisFixedPixelTickerPrivate)
{
d_ptr->m_pDependAxis = axis;
}

AxisFixedPixelTicker::~AxisFixedPixelTicker()
{

}

void AxisFixedPixelTicker::SetTickPixelStep(int pixel)
{
d_ptr->m_iPixel = pixel;
}

int AxisFixedPixelTicker::GetTickPixelStep() const
{
return d_ptr->m_iPixel;
}

double AxisFixedPixelTicker::getTickStep(const QCPRange & range) 
{
if (d_ptr->m_pDependAxis)
{
bool vertical;
if (d_ptr->m_pDependAxis->axisType() == QCPAxis::atLeft
|| d_ptr->m_pDependAxis->axisType() == QCPAxis::atRight)
{
vertical = true;
}
else
{
vertical = false;
}

int screenLength = vertical ? d_ptr->m_pDependAxis->axisRect()->rect().height() : d_ptr->m_pDependAxis->axisRect()->rect().width();
return d_ptr->m_iPixel * range.size() / screenLength;
}
else
{
// return __super::getTickStep(range);
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-10-15 08:56  customplot
     文件        1127  2018-07-23 09:25  customplotAxisFixedPixelTicker.cpp
     文件         606  2016-11-14 00:01  customplotAxisFixedPixelTicker.h
     文件       20147  2018-07-24 15:34  customplotBasicPlot.cpp
     文件        4446  2016-11-14 00:02  customplotBasicPlot.h
     文件        1024  2018-07-24 15:33  customplotBasicPlot_p.h
     文件        1735  2016-10-28 19:57  customplotBasicWidget.cpp
     文件        1331  2016-11-14 00:01  customplotBasicWidget.h
     文件         531  2016-10-28 19:48  customplotBasicWidget_p.h
     文件        7836  2016-11-13 23:56  customplotCrossLinePlot.cpp
     文件        1533  2016-11-14 00:01  customplotCrossLinePlot.h
     文件        6576  2016-11-13 22:27  customplotFinancialPlot.cpp
     文件        1687  2016-11-14 00:01  customplotFinancialPlot.h
     文件         228  2016-10-27 11:42  customplotFinancialPlot_p.h
     文件        4114  2016-11-14 00:03  customplotFinancialWidget.cpp
     文件         984  2016-11-14 00:03  customplotFinancialWidget.h
     文件         251  2016-10-27 17:46  customplotFinancialWidget_p.h
     文件         486  2016-10-26 17:28  customplotIStockCommon.h
     文件       20526  2018-08-24 11:16  customplotMakefile
     文件      528434  2018-08-24 11:16  customplotMakefile.Debug
     文件      528743  2018-08-24 11:16  customplotMakefile.Release
     文件         450  2016-11-14 00:01  customplotPlotCallback.h
     文件         897  2016-10-31 11:41  customplotPlotDefine.h
     文件        9007  2016-10-28 20:27  customplotPlotWidget.cpp
     文件        2640  2016-11-14 00:01  customplotPlotWidget.h
     文件        4585  2016-11-13 16:25  customplotTimeSharingTrendPlot.cpp
     文件         720  2016-11-14 00:01  customplotTimeSharingTrendPlot.h
     文件         319  2016-10-27 17:57  customplotTimeSharingTrendPlot_p.h
     文件        5522  2016-11-14 00:04  customplotTimeSharingTrendWidget.cpp
     文件        1269  2016-11-14 00:02  customplotTimeSharingTrendWidget.h
     文件         390  2016-10-27 17:57  customplotTimeSharingTrendWidget_p.h
............此处省略49个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)