Prevent mapael from raising an error if the legend container doesn't exist #335
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1 - The option "display" should be checked before checking the existence of a container with a class 'cssClass' (otherwise, users are forced to add a legend container even if just want to display a choropleth without displaying the related legend)
2 - I think that, even if the option 'display' is set to true, we shouldn't rise an error if the container doesn't exist. In fact, some user define their own default options along with some default ones for the legend (in order to customize fonts, colors, etc), and they extend their default options object in order to display both legended and non-legended maps. As the 'display' option is set to true by default within mapael, it will raise an error for the non-legended maps in this case.