QCustomPlot Discussion and Comments

QCPAxisTickerDateTime tick issueReturn to overview

Hi.
I uses QCustomPlot 2.0.
I replaced in plot example in realtime data demo QCPAxisTickerTime with QCPAxisTickerDateTime

void MainWindow::setupRealtimeDataDemo(QCustomPlot *customPlot)
{
  ...
  QSharedPointer<QCPAxisTickerDateTime> dateTimeTicker(new QCPAxisTickerDateTime);
  customPlot->xAxis->setTicker(dateTimeTicker);
  ...
}

void MainWindow::realtimeDataSlot()
{
	static double lastPointKey = QDateTime::currentDateTime().toMSecsSinceEpoch()/1000.0;
	double key = QDateTime::currentDateTime().toMSecsSinceEpoch()/1000.0;
...

I got time ticks 0, 2, 5, 7
https://preview.ibb.co/ddy3dJ/1.png


I have found the reason of such QCPAxisTickerDateTime behaviour
I think Emanuel Eichhammer should change closest constant 2.5 with 2

double QCPAxisTickerDateTime::getTickStep(const QCPRange &range)
{
   ...
    result = pickClosest(result, QVector<double>()
                             << 1 << 2.5 << 5 << 10 << 15 << 30 << 60 << 2.5*60 << 5*60 << 10*60 << 15*60 << 30*60 << 60*60 // second, minute, hour range
                             << 3600*2 << 3600*3 << 3600*6 << 3600*12 << 3600*24 // hour to day range
                             << 86400*2 << 86400*5 << 86400*7 << 86400*14 << 86400*30.4375 << 86400*30.4375*2 << 86400*30.4375*3 << 86400*30.4375*6 << 86400*30.4375*12); 
  ...