Bug report #16529

"Classification Mode" missing in the QgsColorRampShader() class

Added by m gri about 7 years ago. Updated about 7 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:PyQGIS Console
Affected QGIS version:2.18.7 Regression?:No
Operating System:Windows 7 64 bit Easy fix?:Yes
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:24435

Description

When using a QgsColorRampShader() with PyQGIS, I'm not able to set a Classification Mode, which is callable from the setClassificationMode module.

Even if listed in the Documentation, I can't find the module in the results from the command:

help(QgsColorRampShader())
executed from the Python Console.

If I run this simple code:

myColorRamp = QgsColorRampShader()
myColorRamp.setColorRampItemList(my_list) # this line works
myColorRamp.setColorRampType(QgsColorRampShader.INTERPOLATED) # this line works
myColorRamp.setClassificationMode(1) # this line doesn't work

I get:

AttributeError: 'QgsColorRampShader' object has no attribute 'setClassificationMode'

Am I missing something or the module is effectively missing?

I hope that this bug report is not related to a wrong use of QGIS APIs.

History

#1 Updated by Nyall Dawson about 7 years ago

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

You're looking at the API for QGIS 3.0. The 2.x API has no such method. See http://qgis.org/api/2.18/classQgsColorRampShader.html

#2 Updated by m gri about 7 years ago

Nyall Dawson wrote:

You're looking at the API for QGIS 3.0. The 2.x API has no such method. See http://qgis.org/api/2.18/classQgsColorRampShader.html

Oh, I didn't notice it. Thanks and sorry for the waste of time.

Also available in: Atom PDF