qcustomplot 绘图 5

发布时间 2023-06-17 13:42:40作者: 金凯旋

需要解释的类:

QCPGraphData data;    plot 使用的时间通常是以秒为单位的, 所以,要将时间换算成秒填入key

设置x 轴时间显示格式:(默认只显示6个, 设定后,显示数量由dataTicker设置)

时间轴如果过大,显示会发生错误。

    QSharedPointer<QCPAxisTickerDateTime> dateTicker(new QCPAxisTickerDateTime);
    dateTicker->setDateTimeFormat("d. MMMM\nyyyy");
    plot->xAxis->setTicker(dateTicker);