Sha256: 8fea98833a0f83bc020570db23e56cf8aa7210be564e6f3ab76c427e7552d395

Contents?: true

Size: 609 Bytes

Versions: 1

Compression:

Stored size: 609 Bytes

Contents

<h3><%=vanity_h metric.name %></h3>
<%= vanity_simple_format vanity_h(Vanity::Metric.description(metric).to_s), :class=>"description" %>
<%=
begin 
  data = Vanity::Metric.data(metric)
  min, max = data.map(&:last).minmax
  js = data.map { |date,value| "['#{(date.to_time + 1.hour).httpdate}',#{value}]" }.join(",")
  vanity_html_safe(%{<div class="chart"></div>
    <script type="text/javascript">
    $(function(){Vanity.metric("#{vanity_h id.to_s}").plot([{label:"#{vanity_h metric.name}", data: [#{js}]}])})
    </script>})
rescue Exception=>ex
  %{<div class="error">#{vanity_h ex.message}</div>}
end %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tupalo-vanity-1.5.1 lib/vanity/templates/_metric.erb