4

Is the any way to group multiple points by attribute to make pie charts that shows types by locations?

I have a layer with groups of points with two fields (group and type). Every group of points is exactly in the same location.

What I want to do is to show a pie char in every location showing as many parts as types is in the group.

I've been trying out with count as @Kazuhito suggested in the expression constructor of the diagrams creator of the layer, but the charts are blank.

1 Answer 1

5

With a simple test data of 2 locations ("group" in this case) with 6 points each;

enter image description here

Create a new field to count each type at each location, for instance type_A by:

count( "type", group_by:= "group", filter:= "type"='A')

Here group_by:= part defines the group to aggregate, while the filter:= extracts the data matching with the condition "type"='A'.

Repeat this to create new fields according to your types.

enter image description here

When you create the pie chart, you may have to choose Over point as the Placement option.

enter image description here

3
  • It works perfect, but what I'm trying to avoid is creating new fields. I've tried to use your sugestion in the expression builder when settings the atributes for the pie chart but it not work there... !expression builder Commented May 3, 2020 at 8:33
  • 1
    @Viskovitz you may use virtual field, this way you are not permanently creating new field in your layer (they will show only in this specific project) or you could create a virtual layer just for the creation of the pie chart. but yes it would be nice to see a simpler solution using only the diagrams dialog
    – J.R
    Commented May 5, 2020 at 9:41
  • Finally I did what @J.R proposed and it worked fine. Thanks. Commented May 20, 2020 at 19:04

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.