Skip to content

Commit

Permalink
Can override Other legend label
Browse files Browse the repository at this point in the history
This adds an optional configuration parameter to vector/GeoJSON layers to replace "Other" as a legend label when conditional styling is used.

Documentation for the vector layer type is also updated.

This also increments SMK's version.
  • Loading branch information
michaelpnelson committed Apr 28, 2023
1 parent 0216972 commit 014d843
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions docs/configuration/layers/vector.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ Set the shape of the legend swatch. "line" is the default.

By default, when <a href="#conditionalstyles-property">conditional styles</a> are used, an "Other" legend will be added with a swatch using the styling in the <a href="#style-property">style</a> to represent features that are not matched by any of the conditions. Set `excludeOtherLegendWithDefaultStyling` to true to exclude the "Other" legend for situations where all of a layer's features will be matched by the conditions and an "Other" legend is not necessary.

`"otherLegendLabelOverride": String`

A string value to display instead of "Other" when <a href="#conditionalstyles-property">conditional styles</a> are used.

## DataUrl Property
`"dataUrl": String`

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.1.9",
"version": "1.1.10",
"name": "@bcgov/smk",
"title": "Simple Map Kit",
"description": "A simple way to add a map your application.",
Expand Down
2 changes: 1 addition & 1 deletion src/smk/layer/layer-vector.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ include.module( 'layer.layer-vector-js', [ 'layer.layer-js' ], function () {
});
if (!self.config.legend.excludeOtherLegendWithDefaultStyling) {
legendData.push({
title: "Other",
title: self.config.legend.otherLegendLabelOverride ? self.config.legend.otherLegendLabelOverride : "Other",
style: self.config.style,
indent: true
});
Expand Down

0 comments on commit 014d843

Please sign in to comment.