Prevent negative numbers on x-axis when using QCustomplot
-
Hi,
I am using qcustomplot to graph numbers coming over the tcp port from an embedded microprocessor.I am setting up my plot window as per the real time graph example:
@plotW->addGraph(); // blue line
plotW->graph(0)->setPen(QPen(Qt::blue));
plotW->graph(0)->setBrush(QBrush(QColor(240, 255, 200)));
plotW->graph(0)->setAntialiasedFill(false);
plotW->addGraph(); // red line
plotW->graph(1)->setPen(QPen(Qt::red));
plotW->xAxis->setRangeLower(0.0);
plotW->xAxis->setLabel("Time S");
plotW->yAxis->setLabel("Compression Depth mm");
plotW->xAxis->setRange(0.0,1.5,Qt::AlignLeft);
plotW->yAxis->setRange(0,60);
plotW->axisRect()->setupFullAxesBox();@and plot in the plotwindow when the data comes in:
@double key = index/2000.0;//converts time to mS
ui->plotW->replot();
updateDepth(val);@When the graph window is created the plot window looks beautiful: 0 - 1.5 on X-Axis, 0 - 60 on y-axis.
But when I actually start plotting the graph, the screen resizes to -1.5 to 0 on x-axis.
How do I prevent the graph displaying -Ve values for the X-Axis which is actually time in ms, and -ve time would make no sense in my app?Thanks
kpks