Hi Terry,

You can use data-defined symbology in any renderer. It isn't limited to rule-based renderers.

Data-defined means either:

a) you have a column with the necessary values for the style (e.g. a column with RGBA values for your fill colors) b) you set an expression (calculation) with logic that generates your style on the fly. The result of the expression must be a compatible value (e.g. an RGBA color). Your expression may also contain logic with CASE WHEN END or you can merge several attribute values into a common color.

Unfortunately, as you discovered, the legend will only contain the default styles you chose and does not reflect any combination the can come up with your expression rules. Apparently, it is not easy to create such a legend, when data-defined styling is involved. It could also be a performance problem if you have big data sets and QGIS would have to analyze your data every time you print something in print composer.

Note also - that there are two different legends. The one in the main application (layer tree) and the other in the print composer on print layouts.

If you have an idea how to solve this issue, please let us know. It also bothers me. Maybe a semi-automated way that allows the map author to assign common occurences of style combinations.

Andreas

On 16.12.2015 08:58, Terry Morse wrote:
I wanted to set the colors for a polygon vector layer from an attribute field I 
defined. So I set the layer style to rule-based and discovered that I had to 
define a rule for each of the 33 attribute values individually. Additionally, 
although the colors display properly on the map, the rules didn't carry over to 
the legend symbols. It appears that data-defining is not available for legend 
symbols and that I will have to set each of them manually.

Is there a way to create a single rule and data definition that will apply to 
all the values in one fell swoop, and will also be reflected in the legend? If 
not, I would like to suggest this as a feature for a new version of QGIS.

Thank you,
Terry Morse
_______________________________________________
Qgis-user mailing list
[email protected]
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

_______________________________________________
Qgis-user mailing list
[email protected]
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to