Sha256: 9e521632d6ea1e8e7a01d0670c479b343d1119b4eb351dd465d0f65d7f7dbc8c

Contents?: true

Size: 1.96 KB

Versions: 9

Compression:

Stored size: 1.96 KB

Contents

<%= partial(:left) %>

<div id='right'>
  <h1><a href='/fields/<%= @field %>'><%= humanize @field %></a> &raquo; <%= humanize @id %> &raquo; <%= humanize @view %></h1>

  <% if @counts.flatten.empty? %>
    <h2>No requests found.</h2>
  <% else %>
    <div id='graph'></div>

    <script type='text/javascript'>
    $.plot($("#graph"),
      [{
       data: [ <%= @counts.enum_for(:each_with_index).collect {|f, i| "[#{i}, #{f.last}]"}.join(',') %> ],
       label: 'requests'
      }],
      {
       series: {
           bars: { show: true, align: "center", barWidth: 0.9}
       },
       grid: { hoverable: true, clickable: true },
       xaxis: {
         autoscaleMargin: 0.05,
         ticks: [ <%= @counts.reverse.enum_for(:each_with_index).collect {|f, i| "[#{i}, '#{f.first.split(' ').join('\n').split('?').first.gsub('/','/\n')}']"}.join(',') %> ]
       },
       yaxis: {
         autoscaleMargin: 0.01
       },
       legend: {
         show: false
       },
       colors: ["#6bc2f6", "#d18b2c", "#dba255", "#919733"]
      });
  
      var previousPoint = null;
  
      $("#graph").bind("plothover", function (event, pos, item) {
        if (item) {
            if (previousPoint != item.dataIndex) {
                previousPoint = item.dataIndex;
          
                $("#tooltip").remove();
                var x = item.datapoint[0].toFixed(2),
                    y = item.datapoint[1].toFixed(2);
          
                showTooltip(item.pageX, item.pageY,
                            Math.round(y) + ' ' + item.series.label + ' for ' + item.series.xaxis.ticks[item.dataIndex].label );
            }
        }
        else {
            $("#tooltip").remove();
            previousPoint = null;            
        }
      });
    
      $("#graph").bind("plotclick", function (event, pos, item) {
          if (item) {
            window.location = "/fields/<%= @field %>/" + encodeURIComponent(ids[item.dataIndex])
          }
      });
    </script>
  <% end %>
</div>

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
all_seeing_eye-0.0.9 lib/all_seeing_eye/server/views/view.erb
all_seeing_eye-0.0.8 lib/all_seeing_eye/server/views/view.erb
all_seeing_eye-0.0.7 lib/all_seeing_eye/server/views/view.erb
all_seeing_eye-0.0.6 lib/all_seeing_eye/server/views/view.erb
all_seeing_eye-0.0.5 lib/all_seeing_eye/server/views/view.erb
all_seeing_eye-0.0.4 lib/all_seeing_eye/server/views/view.erb
all_seeing_eye-0.0.3 lib/all_seeing_eye/server/views/view.erb
all_seeing_eye-0.0.2 lib/all_seeing_eye/server/views/view.erb
all_seeing_eye-0.0.1 lib/all_seeing_eye/server/views/view.erb