I have an attribute table controlled by Atlas on map composer from QGIS. I need to adapt the table for each map and its features but from bottom. In other words, I need to make grow the table from bottom to top. By default table grows from top to bottom
1 Answer
If you want the table to dynamically change its location relative to other objects (including growing from the bottom), you have to:
- Set the "Reference point" to the bottom part.
- Set the dynamic height of
table1
andtable2
in thePosition and Size
settings using the following expression:
6.2 + 6.2 * (1 + aggregate(layer:='table2', aggregate:='count', expression:= fid))
Where 6.2 is the height of the cells with field names. The second value 6.2 is the height of cells with values that are multiplied by the number of these cells in the corresponding table.
- To make the tables not to overlap, you need to set
table1
to dynamically change the Y-coordinate, using the expression:
279 - 6.2 * (1 + aggregate(layer:='table2', aggregate:='count', expression:= fid))
Where 279 is the Y
value of table2
(bottom) with a slight shift.
-
So greatfull for the answer but something is going wrong. I just work with one table so I guess 3rd point is not necessary. I have followed your indications exactly but table behaves as by default. This means table still grows from top to bottom. Just for knowing, I have related two tables so one is driving the atlas and the other goes as a children relation regarding attribute table. Migth change behaviour of your approach?– ColdonApr 22, 2021 at 11:11
-
-
@Coldon The point of all this is that the height of the table automatically adjusts to the number of rows (while the table is fixed to one of the lower boundaries). Apr 22, 2021 at 12:17
-
Problem might be on the layer I am setting on the function. Instead of setting the layer that control Atlas I should set the layer related shown on the table. I am not finding the right sintax. Any suggestion? 6.2 + 6.2 * (relation_aggregate(layer:='sectors_finques', aggregate:='count', expression:= fases))– ColdonApr 23, 2021 at 8:25
-