<% if !respond_to?(:chart) %> <% def chart(*args); 'Please install Flotilla plugin (http://flotilla.rubyforge.org/) for charts'; end; %> <% end %>
Goals > <%=h @metric.convert.name %> Goal > <%=h @metric.metric_type %>

<%=h @metric.title %>

<% if @metric.metric_variants.count == 0 %> No metric variants <% else %>
Conversion Rates
<%= chart("analysis_graph#{@metric.id}", { "Served" => { :collection => @rates[:served], :x => :variant_type, :y => :value }, "Conversions" => { :collection => @rates[:conversions], :x => :variant_type, :y => :value } }, { :xaxis => {:autoscaleMargin => 0.1, :ticks => @rates[:titles].map { |i,t| [i + 0.5, t] }.sort }, :yaxis => { :min => 0, :minTickSize => 1 }, :bars => { :show => true }, :legend => { :position => "ne" } }, :placeholder_size => "300x200") %>
<%= chart("analysis_conv_graph#{@metric.id}", { "Conversion Rate (%)" => { :collection => @rates[:conversion_rates], :x => :variant_type, :y => :value } }, { :xaxis => {:autoscaleMargin => 0.1, :ticks => @rates[:titles].map { |i,t| [i + 0.5, t] }.sort }, :yaxis => { :min => 0, :minTickSize => 1 }, :bars => { :show => true }, :legend => { :position => "ne" } }, :placeholder_size => "300x200") %>
<% @metric.metric_variants.each do |mv| %>
Value <%= mv.value %>
Conversion: <%= mv.conversions %> / <%= mv.served %> (<%= number_to_percentage(mv.conversion_rate, :precision => 0) %>)
<% end %> <% end %>
Edit Metric | New Variant