QCustomPlot Discussion and Comments

Ticks different to dataReturn to overview

Hey y'all,

I wanna create a plot which uses unix time as key for the x-axis, but the ticks can be changed between time since start (relative time) and the current date + time (absolute time). My first intention was to make a bool which checks for each time and then set a ticker accordingly. I have set the relative time one's tickOrigin to the timestamp when the ticker was created. But apparently my understanding of tick origin is wrong. Can someone help me how this can be done?
Thanks in advance!

I made it work using two xAxis (one for each time setting) and hiding one of them as well as their grid depending on what I want to show.

Hello,

it seems that you managed to make it work, but, for information, a proper way to do it would be to use a custom subclass of QCPAxisTicker. And in your reimplementation of getTickStep you would check a boolean that tells you if you want relative or absolute time or something on those line.