diff options
author | Mauro Verrocchio <mauroverrocchio@gmail.com> | 2016-06-21 23:10:09 +0200 |
---|---|---|
committer | Mauro Verrocchio <mauroverrocchio@gmail.com> | 2016-07-22 10:59:53 +0200 |
commit | 22a2559412027e6125835a8d49e5b25230b7a933 (patch) | |
tree | e7efe26eaa7bbcebf9bc1dcbfab6fedf5a3a3c39 | |
parent | 50124864e389e6813296cc803efac76f7c23b633 (diff) | |
download | gitlab-ce-22a2559412027e6125835a8d49e5b25230b7a933.tar.gz |
Apply responsive design for labels on graphs
Labels Commits and Continuous Integration graphs now scales if on
mobile.
-rw-r--r-- | app/views/projects/graphs/ci/_build_times.haml | 7 | ||||
-rw-r--r-- | app/views/projects/graphs/ci/_builds.haml | 7 | ||||
-rw-r--r-- | app/views/projects/graphs/commits.html.haml | 4 |
3 files changed, 16 insertions, 2 deletions
diff --git a/app/views/projects/graphs/ci/_build_times.haml b/app/views/projects/graphs/ci/_build_times.haml index c58223fd39e..195f18afc76 100644 --- a/app/views/projects/graphs/ci/_build_times.haml +++ b/app/views/projects/graphs/ci/_build_times.haml @@ -19,4 +19,9 @@ ] } var ctx = $("#build_timesChart").get(0).getContext("2d"); - new Chart(ctx).Bar(data,{"scaleOverlay": true, responsive: true, maintainAspectRatio: false}); + var options = { scaleOverlay: true, responsive: true, maintainAspectRatio: false }; + if (window.innerWidth < 768) { + // Scale fonts if window width lower than 768px (iPad portrait) + options.scaleFontSize = 8 + } + new Chart(ctx).Bar(data, options); diff --git a/app/views/projects/graphs/ci/_builds.haml b/app/views/projects/graphs/ci/_builds.haml index 8fca07114fa..1fbf6ca2c1c 100644 --- a/app/views/projects/graphs/ci/_builds.haml +++ b/app/views/projects/graphs/ci/_builds.haml @@ -48,4 +48,9 @@ ] } var ctx = $("##{scope}Chart").get(0).getContext("2d"); - new Chart(ctx).Line(data,{"scaleOverlay": true, responsive: true, maintainAspectRatio: false}); + var options = { scaleOverlay: true, responsive: true, maintainAspectRatio: false }; + if (window.innerWidth < 768) { + // Scale fonts if window width lower than 768px (iPad portrait) + options.scaleFontSize = 8 + } + new Chart(ctx).Line(data, options); diff --git a/app/views/projects/graphs/commits.html.haml b/app/views/projects/graphs/commits.html.haml index 65db8af494d..7e34a89f9ae 100644 --- a/app/views/projects/graphs/commits.html.haml +++ b/app/views/projects/graphs/commits.html.haml @@ -59,6 +59,10 @@ var container = $(selector).parent(); var generateChart = function() { selector.attr('width', $(container).width()); + if (window.innerWidth < 768) { + // Scale fonts if window width lower than 768px (iPad portrait) + options.scaleFontSize = 8 + } return new Chart(ctx).Bar(data, options); }; // enabling auto-resizing |