Bug report #11957

Python diagram transparency

Added by Christophe Damour about 8 years ago. Updated about 8 years ago.

Category:Python plugins
Affected QGIS version:2.6.0 Regression?:No
Operating System:All Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:20165


Setting diagram transparency doesn't work using python :

dr = QgsLinearlyInterpolatedDiagramRenderer()
ds = QgsDiagramSettings()
ds.transparency = 70

The strange thing is that transparency is correctly set in the diagram's appearence tab after running this code.
Moreover, if the dialog is validated, the diagrams become transparent...


#1 Updated by Matthias Kuhn about 8 years ago

  • Status changed from Open to Closed

You should set the alpha values on the colors in the QgsDiagramSettings. The transparency variable is only a cache for loading/saving the style.

#2 Updated by Christophe Damour about 8 years ago

Thank you very much for your answer, Matthias.
Can you confirm that alpha value = 255 * transparency /100 (e.g. transparency = 30)?
I doesn't seem to be exactly that, I wonder if it's a rounding problem...

Also available in: Atom PDF