所以我试图在 qcustomplot 的 x 轴上绘制时间......我的问题是我如何才能拥有 x 轴的“刻度”,间隔为一小时(00:00、01:00、 02:00 ...等)。我的代码和结果如下:
代码:
ui->diagramArea->yAxis->setLabel("Thermocracy");
ui->diagramArea->yAxis->setRange(35,42);
ui->diagramArea->xAxis->setLabel("Hour of Measurement");
ui->diagramArea->xAxis->setTickLabelType(QCPAxis::ltDateTime);
ui->diagramArea->xAxis->setDateTimeFormat("hh:mm");
ui->diagramArea->xAxis->setRange(-7200,75600); //that's because im gmt+2
ui->diagramArea->xAxis->setAutoTickStep(3600);
ui->diagramArea->addGraph();
ui->diagramArea->graph(0)->setBrush(QBrush(QColor(204,243,255)));
ui->diagramArea->graph(0)->setPen(pen);
ui->diagramArea->graph(0)->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc, 5));
ui->diagramArea->graph(0)->setData(vTime,vData);
ui->diagramArea->replot();
结果: