1、控制刻度间距离及刻度个数
控制:刻度步长和刻度个数
关键函数:setTickStep(int) setTickCount(int)
QSharedPointer textTicker(new QCPAxisTickerFixed);
textTicker-›setTickStep(16); 刻度步长
textTicker-›setTickCount(8); 刻度个数
qc-›xAxis-›setTicker(textTicker);
下面代码是控制坐标轴间距及步长的核心片段:
QSharedPointer<QCPAxisTickerFixed>MyTicker(newQCPAxisTickerFixed);
MyTicker-›setTickStep(16);
MyTicker-›setTickCount(8);
qcustomplot-›xAxis-›setTicker(MyTicker);