qcustomplot使用

下载文件

将头文件qcustomplot.h和qcustomplot.cpp源文件加入到自己的项目中即可。
qcustomplot相关文件下载地址:https://www.qcustomplot.com/index.php/download

应用

    //图表格式
    ui->qcustomplotWidget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables);
    ui->qcustomplotWidget->addGraph();

    ui->qcustomplotWidget->xAxis->setLabel("时间");  //x轴
    ui->qcustomplotWidget->yAxis->setLabel("延时");  //y轴
    ui->qcustomplotWidget->xAxis->setTickLabelRotation(30);  //x轴文字放不下,倾斜30度
void DelayRecord::Draw_Curves(QString m_time,int m_delay)
{
    date<<QDateTime::fromString(m_time,"yyyy-MM-dd hh:mm:ss.zzz").toTime_t();

    double M_delay;
    M_delay = m_delay;
    delay_time.push_back(M_delay);

    QSharedPointer<QCPAxisTickerDateTime> dateTicker(new QCPAxisTickerDateTime);    //日期做X轴
    dateTicker->setDateTimeFormat("hh:mm:ss.zzz");
    ui->qcustomplotWidget->xAxis->setTicker(dateTicker);//设置X轴为时间轴
    ui->qcustomplotWidget->yAxis->setRange(0,200);
    ui->qcustomplotWidget->yAxis->ticker()->setTickCount(4);

    ui->qcustomplotWidget->graph(0)->setData(date,delay_time);
    ui->qcustomplotWidget->graph(0)->rescaleKeyAxis();

    ui->qcustomplotWidget->replot();

}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值