QCustomPlot Discussion and Comments

Graph points not visible when value==range.lowerReturn to overview

Hi
When the values of a graph are equal to the lower bound of the y axis range, the points are not visible.
They are visible for the upper bound.

The ticks and the grid line are OK, but the issue appears also for the zeroLine (if lower bound is 0).

Seems there is a pixel offset...

Quick example base on the QCP plot-examples project :

QVector<double> x(101), y(101), y2(101); // initialize with entries 0..100
  for (int i=0; i<101; ++i)
  {
    x[i] = i/50.0 - 1; // x goes from -1 to 1
    y[i] = 0.5;
    y2[i] = 1;
  }
  // create graph and assign data to it:
  customPlot->addGraph();
  customPlot->graph(0)->setData(x, y);
  customPlot->addGraph();
  customPlot->graph(1)->setData(x, y2);
  // set axes ranges, so we see all data:
  customPlot->xAxis->setRange(-1, 1);
  customPlot->yAxis->setRange(0, 1);
  customPlot->yAxis->grid()->setVisible(true);
  customPlot->yAxis->grid()->setZeroLinePen(QPen(Qt::red));
  customPlot->xAxis->setVisible(false);
  customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);

The code is obviously not correct to show the issue....

Replace

y[i] = 0.5;

By

y[i] = 0;