QCustomPlot Discussion and Comments

Custom tick stepReturn to overview

Im new in QCustomPlot but i am not able to create custom size of TickStep ..

Right now, I have this plot ... (time is from 6:00 to 6:00 another day) ...


And what is my desired X axis label ..


I tried to play with setTickStep but without any success :(

  QVector<double> x(96), y(96); 
         for (int i=0; i<95; ++i)
           x[i] = i*900+22500;
           y[i] = someValues loaded from db 



         ui->customPlot->setBackground(QBrush(QColor(239, 239, 239, 255)));
         ui->customPlot->graph(0)->setData(x, y);

         ui->customPlot->xAxis->setRange(21600, 108000);


solved there http://stackoverflow.com/questions/32426977/custom-tick-step-on-qcustomplot-qt

Is it still possible to set a custom tick step size without overriding functions? I can't find a setTickStep function in the documentation...

setTickStep was available in the previous version of qcustomplot. in qcp 2.0, the idea is you use a custom QCPAxisTicker, which has access to more functionality and customization. In QCPAxisTicker, you can change the number of ticks you want to show, as well as change what all goes into the ticks.

If you do just want fixed tick steps in QCP 2.0, use the QCPAxisTickerFixed


which has a setTickStep (and can do a bit more, like use tick step multiples/powers).

If your code often accesses this setTickStep method and dynamically changes it depending on other parameters, it is a sign you should probably subclass an own QCPAxisTicker to encapsulate that behaviour.