Feature request #3226

Patch to show number of features per class in legend

Added by Marco Hugentobler over 13 years ago. Updated over 12 years ago.

Status:Closed
Priority:Low
Assignee:Tim Sutton
Category:GUI
Pull Request or Patch supplied:Yes Resolution:fixed
Easy fix?:No Copied to github as #:13286

Description

The following patch adds the capability of showing the number of features per class in the legend (updated after symbology change or attribute edit). To enable this feature, select the check box in the options dialog (general->show number of features in legend).

But I'm not sure if it is good to set that in the option or if it would be better to store it in the vectorlayer and expose through the vector property dialog. Because for large layers, it might take some time to update the feature count.

What do you think about it?

101118_qgis_featurecount.diff Magnifier (18.9 KB) Marco Hugentobler, 2010-11-18 01:16 AM

History

#1 Updated by Tim Sutton over 13 years ago

Hi Marco

I tested out your patch - cool addition! Yes I agree it is probably better to add as a general property of the layer - I tested with a large dataset and it seemed to spend a significant amount of time updating feature counts.

On a purely cosmetic level it might be nicer to put the counts in square brackets after the class name e.g.

[19]

Regards

Tim

#2 Updated by Marco Hugentobler over 13 years ago

  • Status changed from Open to Closed
  • Resolution set to fixed

Thanks for your feedback. The patch is applied now in a8c75f92 (SVN r14715). The feature count can be enabled per layer (right click menu of the legend layer).

#3 Updated by Mayeul Kauffmann over 13 years ago

  • Status changed from Closed to Feedback
  • Resolution deleted (fixed)

Hi,
I had been waiting for this, thanks!

Still it does not seem to work for rule-based rendering.

(I use the following type of rules:

tags like '%"place"="town"%'

on OSM data).

#4 Updated by Mayeul Kauffmann over 13 years ago

It does not work either with simpler rules like:

place='town'

(if you have the town field)

#5 Updated by Paolo Cavallini about 13 years ago

Still true?

#6 Updated by Mayeul Kauffmann about 13 years ago

Replying to [comment:5 pcav]:

Still true?

Hi Paolo,

I just saw your question after opening bug #3737.

Yes, there is still this bug for rule-based rendering.
(I'm not sure whether it's best to convert the patch into a bug or to open a new bug, please close one of the two if you wish).

Mayeul

#7 Updated by Giovanni Manghi over 12 years ago

  • Target version changed from Version 1.7.0 to Version 1.7.4

#8 Updated by Giovanni Manghi over 12 years ago

  • Subject changed from Patch for showing number of features per class in legend to Patch to show number of features per class in legend
  • Pull Request or Patch supplied set to Yes

Was this patch applied? if not, why?

#9 Updated by Jürgen Fischer over 12 years ago

  • Resolution set to fixed
  • Status changed from Feedback to Closed

Giovanni Manghi wrote:

Was this patch applied? if not, why?

Yes, it was. see comment 2. The rest of the issue is in #3737.

Also available in: Atom PDF