PDA

View Full Version : How to change the Interval Type in QwtPlot?



ObiWanKenobe
15th April 2013, 16:55
I am experimenting with QWT, specially with QwtPlot and QwtPlotCurve.
I changed the "StockCchart" example a bit, so that I can display "date(x-axis)/double(y-axis)" values.
I want to display every day on the x-axis, but only moths will be displayed.
How can I change the QwtDate::IntervalType from QwtDate::Month to QwtDate::Day?

(Qt 4.8.4, Qwt 6.1 RC3)

Thanks

Uwe
16th April 2013, 08:09
In the stockchart example the position of the ticks depends on the scale interval - when you are zooming in ( rubberband zoom ) you can see, that easily. See QwtDateScaleEngine.

Uwe

ObiWanKenobe
16th April 2013, 11:20
@Uwe: Thanks for the answer.
But I want to display every day on the x-axis regardless of zooming.
There is always only 1 value per day. That why I want to show the date values on the x-axis.
The user want to see dates directly, without further clicking or zooming.

Uwe
16th April 2013, 11:39
But I want to display every day on the x-axis regardless of zooming.
What doesn't count: a range of 1000 days would require 1000 tick labels, what is not displayable on screen.

But what you can do is to overload QwtDateScaleEngine::intervalType() never returning something smaller than days. ( when zooming in too deep ) and with QwtPlot::setAxisMaxMajor you can increase the range, where the scale engine decides to display in days.

When you don't need zooming at all you can calculate the tick positions manually assigning them using QwtPlot::setAxisScaleDiv().

Uwe

ObiWanKenobe
16th April 2013, 11:58
Thanks a lot.
I will try to overload QwtDateScaleEngine::intervalType(), which seems to be the simplest way for me.