2

Is it possible to show the values on top of each bar of a histogram created with QGIS? (I am using QGIS 2.18)

enter image description here

I know this post [Is it possible to label bar charts? addressed a similar question years ago, but it was unanswered, and maybe the program has evolved since, or someone has find a better solution.

3

I'm using QGIS 3.4, but this answer should also be possible in 2.18.

Unfortunately it doesn't look like there's a way to directly display the histogram values as part of the histogram. A workaround is to add field values as labels, and manually adjust the placement settings until they line up with the corresponding part of the diagram.

For example, I used multi-line labels with a horizontal histogram. It should be possible to this in any orientation, though.

enter image description here

As you can see the labels aren't perfectly aligned, but I set this up in just a few minutes. You can achieve better alignment with trial and error.

Use the concat() function to concatenate the fields into one long string separated by any one character. Then use that character as the line separator.

enter image description here

Label placement: offset from centroid. Use trial and error to figure out the best values for X,Y Offset (I used X: -3mm, Y: -7mm).

enter image description here

The diagram is right-oriented (layer diagram properties window > options tab)

enter image description here

with default-width bars (5mm) and with scaled size with a bar length of 10.

enter image description here

Diagram placement is "Around centroid".

  • Great explanation! As you say it is not the answer to the question but a very good workaroud. Thank you so much!! – Pescariz Jan 18 at 9:17
  • This seems like a feature worth requesting. I did a quick search of the bug report/feature request site, and it doesn't look like anyone requested this feature yet. – csk Jan 18 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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