Background: I'm currently trying to dynamically change the ranges for a layer with new style graduated symbology.
Problem: I thought it may be as simple as updating the ranges for the existing symbology using the setLowerValue() and setUpperValue() methods on the QgsRendererRangeV2 class as below:
layer = qgis.util.iface.activeLayer()rangePoint = 0rangeIncrement = 100for range in layer.rendererV2().ranges(): range.setLowerValue(rangePoint) rangePoint += rangeIncrement range.setUpperValue(rangePoint)By my reconning the API documentation suggests that this should be possible.
However, I am getting the error:
AttributeError: 'QgsRendererRangeV2' object has no attribute 'setLowerValue'I've tried also using:
range.setLowerValue(float(rangePoint))with no luck.
What am I doing wrong?
أكثر...
Problem: I thought it may be as simple as updating the ranges for the existing symbology using the setLowerValue() and setUpperValue() methods on the QgsRendererRangeV2 class as below:
layer = qgis.util.iface.activeLayer()rangePoint = 0rangeIncrement = 100for range in layer.rendererV2().ranges(): range.setLowerValue(rangePoint) rangePoint += rangeIncrement range.setUpperValue(rangePoint)By my reconning the API documentation suggests that this should be possible.
However, I am getting the error:
AttributeError: 'QgsRendererRangeV2' object has no attribute 'setLowerValue'I've tried also using:
range.setLowerValue(float(rangePoint))with no luck.
What am I doing wrong?
أكثر...