Bug report #11957
Python diagram transparency
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | - | ||
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 |
Description
Setting diagram transparency doesn't work using python :
dr = QgsLinearlyInterpolatedDiagramRenderer() ds = QgsDiagramSettings() ... ds.transparency = 70 ... dr.setDiagramSettings(ds) ... myLayer.setDiagramRenderer(dr)
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...
History
#1 Updated by Matthias Kuhn almost 10 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 almost 10 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...