Skip to content

Commit

Permalink
Remove duplicate add to data-join tooltip if colorProperty == heightP…
Browse files Browse the repository at this point in the history
…roperty; add note to legend title if two properties used for data-driven styling
  • Loading branch information
akacarlyann committed Apr 14, 2018
1 parent 564008a commit 6b1bf53
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
11 changes: 10 additions & 1 deletion mapboxgl/templates/choropleth.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@
{% block legend %}

var legend = document.getElementById('legend');
calcCircleColorLegend({{ colorStops }}, "{{ colorProperty }}");

{% if colorStops and colorProperty and heightProperty %}
{% if colorProperty != heightProperty %}
calcCircleColorLegend({{ colorStops }}, "{{ colorProperty }} vs. {{ heightProperty }}");
{% else %}
calcCircleColorLegend({{ colorStops }}, "{{ colorProperty }}");
{% endif %}
{% else %}
calcCircleColorLegend({{ colorStops }}, "{{ colorProperty }}");
{% endif %}

{% endblock legend %}

Expand Down
10 changes: 6 additions & 4 deletions mapboxgl/templates/vector_choropleth.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
popUpKeys[row["{{ dataJoinProperty }}"]] = row["{{ colorProperty }}"];

{% if extrudeChoropleth %}
heightPopUpKeys[row["{{ dataJoinProperty }}"]] = row["{{ heightProperty }}"];
{% if colorProperty != heightProperty %}
heightPopUpKeys[row["{{ dataJoinProperty }}"]] = row["{{ heightProperty }}"];
{% endif %}
{% endif %}

layerFilter.push(row["{{ dataJoinProperty }}"]);
Expand Down Expand Up @@ -136,9 +138,9 @@
popup_html += '<li><b> ' + "{{ colorProperty }}".toUpperCase() + '</b>: ' + popUpKeys[f.properties["{{ vectorJoinDataProperty }}"]] + ' </li>'

{% if extrudeChoropleth %}

popup_html += '<li><b> ' + "{{ heightProperty }}".toUpperCase() + '</b>: ' + heightPopUpKeys[f.properties["{{ vectorJoinDataProperty }}"]] + ' </li>'

{% if colorProperty != heightProperty %}
popup_html += '<li><b> ' + "{{ heightProperty }}".toUpperCase() + '</b>: ' + heightPopUpKeys[f.properties["{{ vectorJoinDataProperty }}"]] + ' </li>'
{% endif %}
{% endif %}

popup_html += '</div>'
Expand Down

0 comments on commit 6b1bf53

Please sign in to comment.