Qcustomplot 的一些常用函数记录(项目)

下滚轮缩放时候怎么可以只缩放x轴y轴不变呢
m_pCustomPlot->axisRect()->setRangeZoomAxes(m_pCustomPlot->xAxis, nullptr);
 // 设置一天为固定的一个刻度
    ui->widget->xAxis->setAutoTickStep(false);
    ui->widget->xAxis->setTickStep(3600*24); // 一天的秒数  设置刻度

//设置X轴时间刻度
    ui->customplot->xAxis->setTickLabelType(QCPAxis::ltDateTime);
    ui->customplot->xAxis->setDateTimeFormat("hh:mm:ss");
    ui->customplot->xAxis->setDateTimeSpec(Qt::LocalTime);
       
//设置label 旋转35° 横着显示可能显示不全
ui->customPlot->xAxis->setTickLabelRotation(35);  待更新
ui->customPlot->graph(0)->dataCount();  //获得线数据的个数
ui->customPlot->replot();// 每次更改界面数据  都要进行刷新
ui->customPlot->xAxis->range().upper//x轴的最大值
ui->customPlot->xAxis->range().lower//x轴的最小值
 ui->customPlot->yAxis->setLabel("y轴单位:mA"); 
if(graph(i)->selected()) // 查看哪条曲线被选中
 customPlot->selectionRect()->setPen(QPen(Qt::black,1,Qt::DashLine));//设置选框的样式:虚线
customPlot->selectionRect()->setBrush(QBrush(QColor(0,0,100,50)));//设置选框的样式:半透明浅蓝
customPlot->setSelectionRectMode(QCP::SelectionRectMode::srmZoom);
customPlot->xAxis->setUpperEnding(QCPLineEnding::esSpikeArrow);//x轴终点箭头图案
customPlot->xAxis->setLowerEnding(QCPLineEnding::esDisc);//x轴起点圆点图案
customPlot->yAxis->setUpperEnding(QCPLineEnding::esSpikeArrow);//y轴终点小方块图案
customPlot->xAxis->setNumberFormat("d");//g灵活的格式,b漂亮的指数形式,c乘号改成×
customPlot->graph(0)->setBrush(QBrush(QColor(0, 0, 255, 20))); // 曲线与X轴包围区的颜色
  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

七 六 伍

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值