Hi there,
I am using QCPCurve
to display a number of 2D coordinates (no lines in between) in a plot using QCustomplot 2.0.0-beta
. When I developed the code on a Raspberry Pi with Qt 4.something
, everything worked smoothly and the points were all displayed correctly. However, when migrating to another Linux system running Qt 5.7
, only the first of 60 evenly spread points is displayed (see https://www.dropbox.com/s/kgx66npyw178ht5/graph.png?dl=0). I verified the data and everything seems correct, so I don't really know what's going on.
I created a class that inherits from QCustomPlot
, which contains the private member
QCPCurve* accesspoints_;
The object is initialized in the constructor's initialization list with
accesspoints_(new QCPCurve(this->xAxis, this->yAxis))
. In the constructor I then apply some adjustments to the QCustomplot
-instance and the QCPCurve
instance:this->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom); this->axisRect()->setupFullAxesBox(); this->accesspoints_->setName("Accesspoints"); this->accesspoints_->setLineStyle(QCPCurve::lsNone); this->accesspoints_->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssSquare, QColor("#000080"), QColor("#6495ED"), 10));
After that, a method is called to add the points from same other class. This is done only once:
for (const t_accesspoint_map::value_type& ap : rmap->getAccesspoints()) { accesspoints_->addData(accesspoints_->dataCount(), ap.second->x(), ap.second->y()); // I verified the loop and the coordinates using std::cout, everything is fine... } this->replot();
At this point,
this->accesspoints_->data()->size()
is, as expected, 60. Finally, a method zoomToMaxExtent()
is called to update the view. It contains:this->rescaleAxes(); this->xAxis->scaleRange(1.05, this->xAxis->range().center()); this->yAxis->scaleRange(1.05, this->yAxis->range().center()); this->replot();
Interestingly, the
scaleRange()
method seems to be aware of all the 60 points, since the visible area matches the area where points should be displayed.
Since I am new to QCustomPlot
and also to Qt
, I don't really know what could be the issue here. Could it be the Qt
version? Should I try QCustomPlot 1.3.2
? Is there something like adaptive sampling for QCPCurve
which could be the issue?
Thanks for helping me out,
Roman