I was creating a widget with a ratio of 1:2. For example the height was 200px and the width was 400px. Furthermore I was plotting a (plottable) square (same sides).
If I want to calculate the ratio of my widget it would look like:
ratio = ui->chart->axisRect()->width()/ui->chart->axisRect()->height(); >> 2
But if there is a plot with a x,y-Axis there would be an offset due to each axis. Means: The x-Axis has already an offset aswell as the y-Axis has an offset to the widget.
And: If I would like to recalc the scaleRatio by hand I have no chance to obtain the perfect values because there is no chance to
- either move the axis to the border of the widget
- get the (correct) margins/offset (axis) to the widget
- have a function that would calculate the correct values
- use setVisiblity (yaxis, xaxis) to false because the (min) offset is fixed by default?
Maybe I'm doing it wrong?