I'm having some trouble with QwtPlot
ticks.
The X axis of my QwtPlot
is this:
I'm setting the AxisMaxMajor to 24:
dataPlot->setAxisMaxMajor(QwtPlot::xBottom, 24);
But it does not solve my problem.
I need exactly 23 ticks (1~23) to represent each hour of the day. How can I do that?
Qwt 6.1.0
Qt 5.3.2
When needing date/time related ticks you need to use QwtDateScaleEngine
. Scale engines based on the decimal system won't come up if with something in 1-24.
If the QwtDateScale
classes does not fit for your use case you have the option to set the ticks manually ( QwtPlot::setAxisScaleDiv()
).
In case you have no control over the axis ranges ( f.e because of zooming ) the final fallback solution is to implement your own type of QwtScaleEngine
. This is easier as it sounds, as it simply means returning a tick at every hour for a given range.