Qt customplot插件中绘制实时时间堆积曲线

    ui->widget_tem->xAxis->setAutoTickStep(true);//自动分配刻度间距
    ui->widget_tem->xAxis->setAutoTicks(true);//自动分配刻度
 
 
 
 
    double key=QDateTime::currentDateTime().toMSecsSinceEpoch()/1000.0;//将字符串转化为分
    static double skey=QDateTime::currentDateTime().toMSecsSinceEpoch()/1000.0;//程序运行时的初始时间,固定值
 
 
 
 
 
 
                    ui->widget_tem->graph(0)->addData(key,temp);//添加数值曲线

 
 
                    ui->widget_tem->xAxis->setRange(key+0.25,key-skey, Qt::AlignRight);//横坐标时间自动堆积


猜你喜欢

转载自blog.csdn.net/qq_24936663/article/details/52288403
今日推荐