diff --git a/app/controllers/graphs_controller.rb b/app/controllers/graphs_controller.rb index b23c629..588a180 100755 --- a/app/controllers/graphs_controller.rb +++ b/app/controllers/graphs_controller.rb @@ -10,21 +10,19 @@ class GraphsController < ApplicationController # Initialize the graph graph = SVG::Graph::TimeSeries.new({ - :width => 800, + :area_fill => true, :height => 300, - :graph_title => l(:label_graphs_total_vs_closed_issues), - :show_graph_title => true, - :no_css => true, :key => true, + :no_css => true, + :show_x_guidelines => true, :scale_x_integers => true, :scale_y_integers => true, - :show_x_guidelines => true, - :stagger_x_labels => true, - :show_data_points => false, + :show_data_points => true, :show_data_values => false, - :area_fill => true, - :x_label_format => "%b %d", - :style_sheet => "/plugin_assets/redmine_graphs/stylesheets/target_version.css" + :stagger_x_labels => true, + :style_sheet => "/plugin_assets/redmine_graphs/stylesheets/target_version.css", + :width => 800, + :x_label_format => "%b %d" }) # Group issues @@ -35,6 +33,7 @@ class GraphsController < ApplicationController # Set the scope of the graph scope_end_date = issues_by_updated_on.sort.keys.last scope_end_date = @version.effective_date if !@version.effective_date.nil? && @version.effective_date > scope_end_date + scope_end_date = Date.today if !@version.completed? line_end_date = Date.today line_end_date = scope_end_date if scope_end_date < line_end_date @@ -45,7 +44,7 @@ class GraphsController < ApplicationController created_on_line[scope_end_date.to_s] = created_count graph.add_data({ :data => created_on_line.sort.flatten, - :title => l(:label_issue_plural) + :title => l(:label_total).capitalize }) # Generate the closed_on line @@ -55,9 +54,16 @@ class GraphsController < ApplicationController closed_on_line[line_end_date.to_s] = closed_count graph.add_data({ :data => closed_on_line.sort.flatten, - :title => "#{l(:label_issue_plural)} #{l(:label_closed_issues)}" + :title => l(:label_closed_issues).capitalize }) + # Add the version due date marker + graph.add_data({ + :data => [@version.effective_date.to_s, created_count], + :title => l(:field_due_date).capitalize + }) unless @version.effective_date.nil? + + # Compile the graph headers["Content-Type"] = "image/svg+xml" send_data(graph.burn, :type => "image/svg+xml", :disposition => "inline") diff --git a/assets/stylesheets/target_version.css b/assets/stylesheets/target_version.css index 84b59ea..92c071e 100755 --- a/assets/stylesheets/target_version.css +++ b/assets/stylesheets/target_version.css @@ -1,6 +1,10 @@ -.fill1, .key1 { fill: #666666 !important; } +.fill1, .key1, .dataPoint1 { fill: #666666 !important; } .line1 { stroke: #666666 !important; } .fill2, .key2 { fill: #BAE0BA !important; } -.fill2 { fill-opacity: 0.9 !important; } +.fill2 { fill-opacity: 0.8 !important; } .line2 { stroke: #009900 !important; } +.dataPoint2 { fill: #009900 !important; } + +.key3 { fill: #95964e !important; } +.dataPoint3 { stroke: #95964e !important; stroke-width: 10px !important; } \ No newline at end of file diff --git a/lib/target_version_graph_hook.rb b/lib/target_version_graph_hook.rb index 2608c89..ed35cde 100755 --- a/lib/target_version_graph_hook.rb +++ b/lib/target_version_graph_hook.rb @@ -2,7 +2,10 @@ class TargetVersionGraphHook < Redmine::Hook::ViewListener def view_versions_show_bottom(context = { }) if !context[:version].fixed_issues.empty? - return tag("embed", :width => 800, :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'graphs', :action => 'target_version', :id => context[:version])) + output = "
#{ l(:label_graphs_total_vs_closed_issues) }" + output << tag("embed", :width => "100%", :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'graphs', :action => 'target_version', :id => context[:version])) + output << "
" + return output end end end \ No newline at end of file