Skip to content

'Fixed Interval' and 'Pretty Breaks' Graduated Renderers don't work when field has all the same values #63277

Description

@angusmcb

What is the bug or the crash?

The above graduated renderers do not create any classes when all of the values are the same.

This means that if the layer has all the same value for a field nothing will display, and the layer will appear empty.

The other graduated renderers will propose at least one class.

Steps to reproduce the issue

  1. Create a layer with zero values (could be other value)
l = QgsVectorLayer("LineString?field=test:double", "test layer", "memory")

f1=QgsFeature()
f1.setAttributes([0.0])

f2=QgsFeature()
f2.setAttributes([0.0])

with edit(l):
    l.addFeature(f1)
    l.addFeature(f2)
    
QgsProject().instance().addMapLayer(l)
  1. Open layer stying panel
  2. Select graduated renderer
  3. Set the value to be the 'test' column
  4. Test by selecting different render modes and pressing 'classify'

Versions

Version de QGIS3.44.3-Solothurn
Révision du code1d1d67e9edd
 
Libraries
Version de Qt5.15.13
Version de Python3.12.11
GDAL version3.11.3 — Eganville
Version de Proj9.6.2
Version de la base de données du registre EPSGv12.013 (2025-05-26)
Version de GEOS3.13.1-CAPI-1.19.2
Version de SQLite3.50.4
Version de PDAL2.9.0
Version du client PostgreSQL17.3
Version de SpatiaLite5.1.0
Version de QWT6.3.0
Version de QScintilla22.14.1
Version de l'OSWindows 11 Version 2009
 
Extensions Python actives
db_manager0.1.20
grassprovider2.12.99
MetaSearch0.3.6
processing2.12.99

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

No response

Metadata

Metadata

Assignees

Labels

BugEither a bug report, or a bug fix. Let's hope for the latter!SymbologyRelated to vector layer symbology or renderersVectorsRelated to general vector layer handling (not specific data formats)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions