diff --git a/mapboxgl/templates/choropleth.html b/mapboxgl/templates/choropleth.html index be2b605..402a9a0 100644 --- a/mapboxgl/templates/choropleth.html +++ b/mapboxgl/templates/choropleth.html @@ -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 %} diff --git a/mapboxgl/templates/vector_choropleth.html b/mapboxgl/templates/vector_choropleth.html index 582b33a..139b913 100644 --- a/mapboxgl/templates/vector_choropleth.html +++ b/mapboxgl/templates/vector_choropleth.html @@ -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 }}"]); @@ -136,9 +138,9 @@ popup_html += '
  • ' + "{{ colorProperty }}".toUpperCase() + ': ' + popUpKeys[f.properties["{{ vectorJoinDataProperty }}"]] + '
  • ' {% if extrudeChoropleth %} - - popup_html += '
  • ' + "{{ heightProperty }}".toUpperCase() + ': ' + heightPopUpKeys[f.properties["{{ vectorJoinDataProperty }}"]] + '
  • ' - + {% if colorProperty != heightProperty %} + popup_html += '
  • ' + "{{ heightProperty }}".toUpperCase() + ': ' + heightPopUpKeys[f.properties["{{ vectorJoinDataProperty }}"]] + '
  • ' + {% endif %} {% endif %} popup_html += ''