QCustomPlot Discussion and Comments

Scale axis labels by a give factor?Return to overview

Hi all, in my application where I want to allow user to select "unit" of the axis and update the axis label. I have 20 curves/graphs and each has 1000+ points. Recaluating the data and re-set graph data takes a bit of time during which the GUI freeze. It is annoying esspecially when user set "unit" back and forth. A lot of unnecessary calculation has been incurred.

I tried to use QCPAxisTickerText to overwrite the label which works expect when zooming... The axis ticks will not auto adjust like the default one. How can I work around this?

Also a search on this topic shows that same question was asked in 2015. I wonder if anything is done regarding this (scaling axis label)? Thanks a lot.

this is now possible by subclassing the QCPAxisTicker class.

I suggest you reimplement the generate() method: internally call the baseclass QCPAxisTicker::generate method with a correspondingly scaled range. Important is to transform back the ticks and subticks vector that you get from that method, before returning via your reimplemented generate(), so they appear at the correct axis position (because that factor will of course not influence coordToPixel/pixelToCoord methods)