Skip to main content
1 of 2
Istopopoki
  • 277
  • 1
  • 8

First of all, checking the QGIS API doc, I can see that the ranges method from the QgsGraduatedSymbolRendererV2 class returns a

const QgsRangeList &

probably meaning that you have little chance to modify its return value.

Additionally, when looping the way you do in Python, you cannot modify a list's values as explained here.

=> twice impossible :)

Fortunately, the solution directly comes from the QgsGraduatedSymbolRendererV2 class thanks to :

renderer.updateRangeUpperValue(iRangeIndex,value)
renderer.updateRangeLowerValue(iRangeIndex,value)

The binding works correctly on my version (QGIS 2.8.2). The final code would look like this:

limit = 0
step = 100
for i, range in enumerate(renderer.ranges()):
    renderer.updateRangeLowerValue(i,limit)
    renderer.updateRangeUpperValue(i,limit+step)
    limit+=step
Istopopoki
  • 277
  • 1
  • 8