PDA

View Full Version : Qwt axis scale limitation



Momergil
14th January 2013, 10:49
Hello Uwe and others!

As I mentioned in previous posts, I'm developing a graphical solution to display stock trading data as home broker's softwares such as Metastock does and I'm using Qwt for that end.

--
Following the stockcharts example I was able to draw some stock charts quite well but I found a problem with the zoom feature.
For now I'm using only QwtPlotZoomer as in the example and what happens is that if I zoom out to the last level the graph show data regarding the first second in 1970! (I guess that has something to do with using UTC date). What I find funny is that I essentially copied the example's code and there when I zoom out to the last level such thing don't happen, rather the graph is completely shown in the year of 2010 - for which there is data.

So my question is: which code should I put to configure a given xAxis range for the last zoom out? Lets suppose (using a probable parameter, i.e. something I would like to implement) that, when avaliable, in the greatest zoom out possible the graph should plot exactly 1000 candles with the last candle of the vector been shown in the right corner (i.e. the counting-and-showing begins from the right to the left).

Don't forget that i'm using date-time scale for the xAxis!


Thanks,

Momergil



P.s.: Uwe, I send an e-mail to qwt-interest@lists.sourceforge.net with my first user feedback; I hope you received it.

dontgonearthecastle
14th January 2013, 12:38
Do you set the zoomBase correctly before any zooming happens?
If yes, check if you set it *after* you manage the axes (like setting axis scales etc).

Momergil
14th January 2013, 17:03
No, and also I don't know how to use this function :)
And I noticed that such function is not used in the example, that nevertheless works. Could it be because in the example the graph is first populated with data and just then the Zoomer is instantiaded and added while in my case I first attach the zoomer to the QwtPlot and later add the data?

Edit:

Actually I think I learned how to use this function:

QwtPlotZoomer::setZoomBase(QwtPlotTradingCurve->boundingRect());