Commit 22a25594 authored by Mauro Verrocchio's avatar Mauro Verrocchio

Apply responsive design for labels on graphs

Labels Commits and Continuous Integration graphs now scales if on
mobile.
parent 50124864
...@@ -19,4 +19,9 @@ ...@@ -19,4 +19,9 @@
] ]
} }
var ctx = $("#build_timesChart").get(0).getContext("2d"); 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);
...@@ -48,4 +48,9 @@ ...@@ -48,4 +48,9 @@
] ]
} }
var ctx = $("##{scope}Chart").get(0).getContext("2d"); 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);
...@@ -59,6 +59,10 @@ ...@@ -59,6 +59,10 @@
var container = $(selector).parent(); var container = $(selector).parent();
var generateChart = function() { var generateChart = function() {
selector.attr('width', $(container).width()); 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); return new Chart(ctx).Bar(data, options);
}; };
// enabling auto-resizing // enabling auto-resizing
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment