gitlab-org--gitlab-foss/app/views/projects/graphs/ci/_build_times.haml
Mauro Verrocchio 22a2559412 Apply responsive design for labels on graphs
Labels Commits and Continuous Integration graphs now scales if on
mobile.
2016-07-22 10:59:53 +02:00

27 lines
786 B
Text

%div
%p.light
Commit duration in minutes for last 30 commits
%canvas#build_timesChart{height: 200}
:javascript
var data = {
labels : #{@charts[:build_times].labels.to_json},
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
barStrokeWidth: 1,
barValueSpacing: 1,
barDatasetSpacing: 1,
data : #{@charts[:build_times].build_times.to_json}
}
]
}
var ctx = $("#build_timesChart").get(0).getContext("2d");
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);