* Placed graph in frameset to resemble context's layout
* Added target version due date
This commit is contained in:
parent
7595ae50d2
commit
a97ffaf776
|
@ -10,21 +10,19 @@ class GraphsController < ApplicationController
|
||||||
|
|
||||||
# Initialize the graph
|
# Initialize the graph
|
||||||
graph = SVG::Graph::TimeSeries.new({
|
graph = SVG::Graph::TimeSeries.new({
|
||||||
:width => 800,
|
:area_fill => true,
|
||||||
:height => 300,
|
:height => 300,
|
||||||
:graph_title => l(:label_graphs_total_vs_closed_issues),
|
|
||||||
:show_graph_title => true,
|
|
||||||
:no_css => true,
|
|
||||||
:key => true,
|
:key => true,
|
||||||
|
:no_css => true,
|
||||||
|
:show_x_guidelines => true,
|
||||||
:scale_x_integers => true,
|
:scale_x_integers => true,
|
||||||
:scale_y_integers => true,
|
:scale_y_integers => true,
|
||||||
:show_x_guidelines => true,
|
:show_data_points => true,
|
||||||
:stagger_x_labels => true,
|
|
||||||
:show_data_points => false,
|
|
||||||
:show_data_values => false,
|
:show_data_values => false,
|
||||||
:area_fill => true,
|
:stagger_x_labels => true,
|
||||||
:x_label_format => "%b %d",
|
:style_sheet => "/plugin_assets/redmine_graphs/stylesheets/target_version.css",
|
||||||
:style_sheet => "/plugin_assets/redmine_graphs/stylesheets/target_version.css"
|
:width => 800,
|
||||||
|
:x_label_format => "%b %d"
|
||||||
})
|
})
|
||||||
|
|
||||||
# Group issues
|
# Group issues
|
||||||
|
@ -35,6 +33,7 @@ class GraphsController < ApplicationController
|
||||||
# Set the scope of the graph
|
# Set the scope of the graph
|
||||||
scope_end_date = issues_by_updated_on.sort.keys.last
|
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 = @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 = Date.today
|
||||||
line_end_date = scope_end_date if scope_end_date < line_end_date
|
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
|
created_on_line[scope_end_date.to_s] = created_count
|
||||||
graph.add_data({
|
graph.add_data({
|
||||||
:data => created_on_line.sort.flatten,
|
:data => created_on_line.sort.flatten,
|
||||||
:title => l(:label_issue_plural)
|
:title => l(:label_total).capitalize
|
||||||
})
|
})
|
||||||
|
|
||||||
# Generate the closed_on line
|
# Generate the closed_on line
|
||||||
|
@ -55,9 +54,16 @@ class GraphsController < ApplicationController
|
||||||
closed_on_line[line_end_date.to_s] = closed_count
|
closed_on_line[line_end_date.to_s] = closed_count
|
||||||
graph.add_data({
|
graph.add_data({
|
||||||
:data => closed_on_line.sort.flatten,
|
: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
|
# Compile the graph
|
||||||
headers["Content-Type"] = "image/svg+xml"
|
headers["Content-Type"] = "image/svg+xml"
|
||||||
send_data(graph.burn, :type => "image/svg+xml", :disposition => "inline")
|
send_data(graph.burn, :type => "image/svg+xml", :disposition => "inline")
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
.fill1, .key1 { fill: #666666 !important; }
|
.fill1, .key1, .dataPoint1 { fill: #666666 !important; }
|
||||||
.line1 { stroke: #666666 !important; }
|
.line1 { stroke: #666666 !important; }
|
||||||
|
|
||||||
.fill2, .key2 { fill: #BAE0BA !important; }
|
.fill2, .key2 { fill: #BAE0BA !important; }
|
||||||
.fill2 { fill-opacity: 0.9 !important; }
|
.fill2 { fill-opacity: 0.8 !important; }
|
||||||
.line2 { stroke: #009900 !important; }
|
.line2 { stroke: #009900 !important; }
|
||||||
|
.dataPoint2 { fill: #009900 !important; }
|
||||||
|
|
||||||
|
.key3 { fill: #95964e !important; }
|
||||||
|
.dataPoint3 { stroke: #95964e !important; stroke-width: 10px !important; }
|
|
@ -2,7 +2,10 @@
|
||||||
class TargetVersionGraphHook < Redmine::Hook::ViewListener
|
class TargetVersionGraphHook < Redmine::Hook::ViewListener
|
||||||
def view_versions_show_bottom(context = { })
|
def view_versions_show_bottom(context = { })
|
||||||
if !context[:version].fixed_issues.empty?
|
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 = "<fieldset id='filters'><legend>#{ l(:label_graphs_total_vs_closed_issues) }</legend>"
|
||||||
|
output << tag("embed", :width => "100%", :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'graphs', :action => 'target_version', :id => context[:version]))
|
||||||
|
output << "</fieldset>"
|
||||||
|
return output
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user