codebridge-za / seeking-shelter

A project that focuses on shelters and services aimed at women that are victims of abuse
https://codebridge-za.github.io/seeking-shelter/
9 stars 9 forks source link

Format layer legends correctly when in mobile mode #28

Closed ColinAnthony closed 6 years ago

rikusv commented 6 years ago

In order to make the legend SVGs responsive, we need to add the viewBox attribute. I can't see how to do this with folium (seems to be hard-coded: https://github.com/python-visualization/branca/blob/a2e22815eea5a96d9bf3b08fd0cfb10c6f3c3de6/branca/templates/color_scale.js). An ugly workaround is to do this in build.py:

map_content = map_content.replace('.attr("width", 450)', '.attr("viewBox", "0 0 450 40");')
map_content = map_content.replace('.attr("height", 40);', '')

Should I go ahead with the above, or am I missing a better option...?

ColinAnthony commented 6 years ago

I don't know a lot about folium, or html/javascript, so I have no idea of there are better options. If it is not going to be too much work, you are welcome to go ahead with the hardcoding option.

On Mon, 1 Oct 2018 at 18:11, rikusv notifications@github.com wrote:

In order to make the legend SVGs responsive, we need to add the viewBox attribute. I can't see how to do this with folium (seems to be hard-coded: https://github.com/python-visualization/branca/blob/a2e22815eea5a96d9bf3b08fd0cfb10c6f3c3de6/branca/templates/color_scale.js). An ugly workaround is to do this in build.py:

map_content = map_content.replace('.attr("width", 450)', '.attr("viewBox", "0 0 450 40");') map_content = map_content.replace('.attr("height", 40);', '')

Should I go ahead with the above, or am I missing a better option...?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/codebridge-za/seeking-shelter/issues/28#issuecomment-425966430, or mute the thread https://github.com/notifications/unsubscribe-auth/AIaK8ybzM1Uv1ur_8Q0CDS0Rs0_U5CJzks5ugj63gaJpZM4XB3az .

--

Colin Anthony, PhD

Lecturer Medical Virology University of Cape Town Tel: +27 (0)21 404 7760