Self hosted FLOSS fitness/workout, nutrition and weight tracker
Don't hardcode the width of the weight chart in mobile version
Roland Geider3bd66514b5fe
diff --git a/wger/manager/static/js/workout-manager.js b/wger/manager/static/js/workout-manager.jsindex 36a4a3903..5bbc17060 100644--- a/wger/manager/static/js/workout-manager.js+++ b/wger/manager/static/js/workout-manager.js@@ -655,11 +655,16 @@ function weight_chart(data, width_factor)-function weight_log_chart(data, div_id, reps_i18n)+function weight_log_chart(data, div_id, reps_i18n, width_factor){++ // Calculate the size+ var width_factor = typeof width_factor !== 'undefined' ? width_factor: 600;+ var height_factor = width_factor / 600 * 200;+var margin = {top: 20, right: 80, bottom: 30, left: 50},- width = 600 - margin.left - margin.right,- height = 200 - margin.top - margin.bottom;+ width = width_factor - margin.left - margin.right,+ height = height_factor - margin.top - margin.bottom;var parseDate = d3.time.format("%Y-%m-%d").parse;diff --git a/wger/manager/templates/mobile/workout/log.html b/wger/manager/templates/mobile/workout/log.htmlindex d9b79234e..763db6003 100644--- a/wger/manager/templates/mobile/workout/log.html+++ b/wger/manager/templates/mobile/workout/log.html@@ -52,7 +52,10 @@ function custom_modal_init()<script>$(document).ready(function() {- weight_log_chart({{date_list.chart_data|safe}}, "{{date_list.div_uuid}}", "{{reps}}")+ weight_log_chart({{date_list.chart_data|safe}},+ "{{date_list.div_uuid}}",+ "{{reps}}",+ $('#content').width() * 0.95)});</script>{% endwith %}