PDA

View Full Version : Can force the axis' backbone extend to align with the edge of the canvas?



Nicho
1st July 2013, 05:14
Hi, Uwe
How can I force the axis' backbone extend to align with the edge of the canvas?
By default, it seems the axis' backbone is aligned with the plot grid.

Nicho

Uwe
1st July 2013, 08:23
Check the examples - f.e spectrogram.

Uwe

Nicho
2nd July 2013, 11:05
Check the examples - f.e spectrogram.

Uwe

Uwe,
Again, I meet two questions about plot matrix.
First one:
I have used this function to align the backbone:

plotLayout()->setAlignCanvasToScales( true );
But that will make the spacing between columns be different.
I guess that is because the far right axis label of some plots is too long and causes the different spacing, right?
And is there a way to fix it?

Another question :
The size of each plot is different from each other.
Is there a way to make them be the same size?

Thanks a lot.

Nicho

Uwe
3rd July 2013, 08:04
For both questions the same answer: you have to remove the grid layout that is used in the PlotMatrix class and implement a new method


void PlotMatrix::layoutPlots( const QRect &rect )
{
// calculate and assign the geometries of your plots here
...
}

In PlotMatrix::resizeEvent() and some other places that have an effect on the size of your plots you have to call:


layoutPlots( contentsRect() );As you probably want to have the same size for the canvases ( not the plots ! ) you have to subtract the sizeHints() of the scales, legends and titles ( QwtPlot is a composite widget ! ).

Uwe

Nicho
3rd July 2013, 11:00
Uwe,
In plot matrix, the width of the plots in the far left column is smaller than the others.
And in my application, in some situation, the height also has this problem.
Seeing the pic below:
9263

I wish, yes, maybe the canvases to have the same size in pixel.
I have thought the grid layout will layout all the plots as average size.
But now it seems not.
I don't know why.
And how to subtract the sizeHints() of such as scales?
Can you take scales as an example to tell me what should I code in the sizeHints() when I subtract it?

Thank you.
Nicho

Nicho
4th July 2013, 08:25
any help ?

Nicho
10th July 2013, 12:58
Could Uwe give me a hand for my question in detail?

Uwe
10th July 2013, 14:32
My previous answer is still valid - it is exactly what you have to do.

Uwe