OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/app/views/backlogs/burndown.html.erb

64 lines
2.9 KiB

<%- content_for :header_tags do %>
<%= stylesheet_link_tag 'jquery.jqplot.min.css', :plugin => 'redmine_backlogs' %>
<%= javascript_include_tag 'jquery-1.4.2.min.js', :plugin => 'redmine_backlogs' %>
<!--[if IE]><%= javascript_include_tag 'jquery.jqplot/excanvas.js', :plugin => 'redmine_backlogs' %><![endif]-->
<%= javascript_include_tag 'jquery.jqplot/jquery.jqplot.min.js', :plugin => 'redmine_backlogs' %>
<%= javascript_include_tag 'jquery.jqplot/plugins/jqplot.highlighter.js', :plugin => 'redmine_backlogs' %>
<style type="text/css" media="screen">
.jqplot-axis {
font-size: 0.85em;
}
.jqplot-title {
font-size: 1.1em;
}
.jqplot-y6axis-tick {
padding-right: 0px;
}
</style>
<script type="text/javascript" language="javascript">
function burndown(div) {
<% dataseries = @burndown[:series].keys
dataseries.each do |series| %>
<%= series.to_s %> = [ <%= @burndown[:series][series][:series].collect {|d| "#{d}"}.join(',') %>];
<% end %>
xticks = [ <%= @burndown[:dates].each_with_index.collect {|d,i| "[#{i+1}, '#{escape_javascript(::I18n.t('date.abbr_day_names')[d.wday % 7])}']"}.join(',') %> ];
datasets = [ <%= dataseries.collect{|series| series.to_s}.join(',') %> ];
series = [
<% dataseries.each_with_index do |series, i| %>
{
label: '<%= escape_javascript(series.to_s) %>',
yaxis: '<%= @burndown[:series][series][:units] == :points ? 'yaxis' : 'y2axis' %>'
}<% if i != dataseries.length - 1 %>,<% end %>
<% end %>
];
// add a little clearance to the chart
max_points = <%= @burndown[:max][:points] == 0 ? 1 : 1.01 * @burndown[:max][:points] %>;
max_hours = <%= @burndown[:max][:hours] == 0 ? 1 : 1.01 * @burndown[:max][:hours] %>;
plot1 = $.jqplot(div, datasets, {
legend: {show:true, location:'sw'},
grid: {shadow:false},
seriesDefault: {shadow:false},
series: series,
axes:{
xaxis:{min:1, max:<%= @burndown[:dates].length %>, tickInterval:1, ticks:xticks},
yaxis:{min:0, max: max_points, tickOptions:{formatString:'%d'}},
y2axis:{min:0, max: max_hours, tickOptions:{formatString:'%d'}}
},
highlighter:{
tooltipAxes: 'y',
formatString: '%s'
}
});
}
$(document).ready(function(){
burndown('burndown');
});
</script>
<%- end %>
<div id="burndown" style="margin-top:20px; margin-left:20px; width:640px; height:480px;"></div>