I'm using QGIS 2.18.3 (Las Palmas). I have created pie charts for a layer in QGIS and in order to be able to move the pie charts around i processed the centroids of my polygons. By moving the (Centroid) points I am now able to move the pie charts around.

I still have some overlapping in my charts, so i'm looking into creating leading lines, so I can allocate the pie chart to its polygon. I have looked into previous questions here (for example How to create dynamic leader lines? or Creating leader lines for moved labels) but I dont seem to be able to use it for the charts.

How can I create a leading line for a pie chart?


1 Answer 1


Creating centroids was an unneccessary step. The placement properties of the diagrams offer "Data defined positions". First you create the "x_coor" and "y_coor" columns. I don't know what coordinate system you are using. Length 15 Precision 3 is enough for almost everything. Leave the two columns empty.

enter image description here

Within the properties of the diagrams, activate the "Data defined position" in "Placement". Use the "x_coor" and "y_coor" column. enter image description here

Start the Editing Mode and use the label toolbar to move your diagrams where you want them. enter image description here

Save the Edits and close the editing mode. Now open your attribute table, "x_coor" and "y_coor" are filled up with coordinates.enter image description here

In the next step, open the properties of the layer and change the style options. Within the style options, we want to change the symbol. Default ist the "Simple Fill", change that to "Geometry Generator". You have to change the "Geometry Type" to "LineString / MultilineString". enter image description here

I've loaded my polygon-layer twice. Once I use them for the normal polygons and once for the geometry-generator to create the leader lines. I have created the diagrams only for the layer with the geometry generator.

enter image description here

  • Hello Andreas, thanks for your quick reply. I'm still having some trouble with your approach. I added new columns (X and Y) to my attribute Table and tried to follow gis.stackexchange.com/questions/232709/… with the pie charts instead of the labeling, but couldnt quite figure out how to alter X and Y. I used the same solution with the geometry generator but the label toolbar remained grey (even in editing modus). I think i'm missing out on some small steps inbetween - can u further help me?
    – rtaani
    Jun 7, 2017 at 12:05
  • You do not have to alter X & Y, just move the diagrams where you want them! QGIS will fill the X & Y colums for you! I'm going to extend my answer, takes some time;-)
    – AndreasK
    Jun 7, 2017 at 12:23
  • Hi Andreas! Thank you so much! I almost hat it right after your first comments, I just had some tiny mistakes with my expression for the geometry generator! Thank you so much, I have learned so much today!
    – rtaani
    Jun 7, 2017 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.