Add zone boundary legends to gauge graph.

pull/1/head
Nelson Jovel 4 years ago
parent ad03606d66
commit 03a63cb568

@ -20,6 +20,22 @@ class GaugePresenter
percentage_for @scale.approval_zone.low_benchmark percentage_for @scale.approval_zone.low_benchmark
end end
def watch_low_legend
percentage_for @scale.watch_zone.low_benchmark
end
def growth_low_legend
percentage_for @scale.growth_zone.low_benchmark
end
def approval_low_legend
percentage_for @scale.approval_zone.low_benchmark
end
def ideal_low_legend
percentage_for @scale.ideal_zone.low_benchmark
end
private private
def zone def zone

@ -28,27 +28,41 @@
stroke-width="<%= stroke_width %>" stroke-width="<%= stroke_width %>"
/> />
<% if gauge.key_benchmark_percentage.present? %>
<line <line
class="zone-benchmark stroke-black" class="zone-benchmark stroke-gray-2"
x1="<%= benchmark_line_point(outer_radius, angle_for(percentage: gauge.key_benchmark_percentage)).x %>" x1="<%= benchmark_line_point(outer_radius, angle_for(percentage: gauge.watch_low_legend)).x %>"
y1="<%= benchmark_line_point(outer_radius, angle_for(percentage: gauge.key_benchmark_percentage)).y %>" y1="<%= benchmark_line_point(outer_radius, angle_for(percentage: gauge.watch_low_legend)).y %>"
x2="<%= benchmark_line_point(inner_radius, angle_for(percentage: gauge.key_benchmark_percentage)).x %>" x2="<%= benchmark_line_point(inner_radius, angle_for(percentage: gauge.watch_low_legend)).x %>"
y2="<%= benchmark_line_point(inner_radius, angle_for(percentage: gauge.key_benchmark_percentage)).y %>" y2="<%= benchmark_line_point(inner_radius, angle_for(percentage: gauge.watch_low_legend)).y %>"
stroke-width="<%= stroke_width %>" stroke-width="<%= stroke_width %>"
/> />
<path <line
class="key-benchmark-indicator fill-black" class="zone-benchmark stroke-gray-2"
d="<%= move_to(point: indicator_tip) %> x1="<%= benchmark_line_point(outer_radius, angle_for(percentage: gauge.growth_low_legend)).x %>"
<%= draw_line_to(point: indicator_right_corner) %> y1="<%= benchmark_line_point(outer_radius, angle_for(percentage: gauge.growth_low_legend)).y %>"
<%= draw_line_to(point: indicator_left_corner) %> x2="<%= benchmark_line_point(inner_radius, angle_for(percentage: gauge.growth_low_legend)).x %>"
<%= draw_line_to(point: indicator_tip) %>" y2="<%= benchmark_line_point(inner_radius, angle_for(percentage: gauge.growth_low_legend)).y %>"
transform="rotate(<%= rotation_angle_for(percentage: gauge.key_benchmark_percentage) %> <%= arc_center.x %> <%= arc_center.y %>)" stroke-width="<%= stroke_width %>"
stroke="none" />
<line
class="zone-benchmark stroke-gray-2"
x1="<%= benchmark_line_point(outer_radius, angle_for(percentage: gauge.ideal_low_legend)).x %>"
y1="<%= benchmark_line_point(outer_radius, angle_for(percentage: gauge.ideal_low_legend)).y %>"
x2="<%= benchmark_line_point(inner_radius, angle_for(percentage: gauge.ideal_low_legend)).x %>"
y2="<%= benchmark_line_point(inner_radius, angle_for(percentage: gauge.ideal_low_legend)).y %>"
stroke-width="<%= stroke_width %>"
/>
<% if gauge.key_benchmark_percentage.present? %>
<line
class="zone-benchmark stroke-black"
x1="<%= benchmark_line_point(outer_radius + 5, angle_for(percentage: gauge.key_benchmark_percentage)).x %>"
y1="<%= benchmark_line_point(outer_radius + 5, angle_for(percentage: gauge.key_benchmark_percentage)).y %>"
x2="<%= benchmark_line_point(inner_radius - 5 , angle_for(percentage: gauge.key_benchmark_percentage)).x %>"
y2="<%= benchmark_line_point(inner_radius - 5, angle_for(percentage: gauge.key_benchmark_percentage)).y %>"
stroke-width="<%= stroke_width + 2 %>"
/> />
<% end %> <% end %>
</svg> </svg>
<span class="gauge-title <%= font_class %> fill-black"><%= gauge.title %></span> <span class="gauge-title <%= font_class %> fill-black"><%= gauge.title %></span>
</div> </div>

Loading…
Cancel
Save