remove sparklines dependency, replace with staticly generated pie charts, added script/pie.rb to easily regenerate them if necessary
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@510399 13f79535-47bb-0310-9956-ffa450edef68
|
@ -1,40 +0,0 @@
|
|||
class SparklinesController < ApplicationController
|
||||
|
||||
# Handles requests for sparkline graphs from views.
|
||||
#
|
||||
# Params are generated by the sparkline_tag helper method.
|
||||
#
|
||||
def index
|
||||
# Make array from comma-delimited list of data values
|
||||
ary = []
|
||||
if params.has_key?('results') && !params['results'].nil?
|
||||
params['results'].split(',').each do |s|
|
||||
ary << s.to_i
|
||||
end
|
||||
end
|
||||
|
||||
send_data( Sparklines.plot( ary, params ),
|
||||
:disposition => 'inline',
|
||||
:type => 'image/png',
|
||||
:filename => "spark_#{params[:type]}.png" )
|
||||
end
|
||||
|
||||
|
||||
# Use this type of method for sparklines that can be cached. (Doesn't work with the helper.)
|
||||
#
|
||||
# To make caching easier, add a line like this to config/routes.rb:
|
||||
# map.sparklines "sparklines/:action/:id/image.png", :controller => "sparklines"
|
||||
#
|
||||
# Then reference it with the named route:
|
||||
# image_tag sparklines_url(:action => 'show', :id => 42)
|
||||
def show
|
||||
send_data(Sparklines.plot(
|
||||
[42, 37, 89, 74, 70, 50, 40, 30, 40, 50],
|
||||
:type => 'bar', :above_color => 'orange'
|
||||
),
|
||||
:disposition => 'inline',
|
||||
:type => 'image/png',
|
||||
:filename => "sparkline.png")
|
||||
end
|
||||
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
<ul>
|
||||
<% @response.field_facets(field).each do |f| %>
|
||||
<li>
|
||||
<%= sparkline_tag [(f.value * 100.0 / @response.total_hits).ceil], :type => 'pie', :diameter => 20, :share_color => 'blue'%>
|
||||
<%= image_tag "pie_#{(f.value * 100.0 / @response.total_hits).ceil}.png"%>
|
||||
<%= link_to "#{f.name} (#{f.value})", :action => 'add_filter', :field_name=>field, :value=>f.name%>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
After Width: | Height: | Size: 676 B |
After Width: | Height: | Size: 765 B |
After Width: | Height: | Size: 822 B |
After Width: | Height: | Size: 623 B |
After Width: | Height: | Size: 803 B |
After Width: | Height: | Size: 817 B |
After Width: | Height: | Size: 785 B |
After Width: | Height: | Size: 786 B |
After Width: | Height: | Size: 788 B |
After Width: | Height: | Size: 779 B |
After Width: | Height: | Size: 784 B |
After Width: | Height: | Size: 784 B |
After Width: | Height: | Size: 775 B |
After Width: | Height: | Size: 767 B |
After Width: | Height: | Size: 774 B |
After Width: | Height: | Size: 772 B |
After Width: | Height: | Size: 771 B |
After Width: | Height: | Size: 767 B |
After Width: | Height: | Size: 761 B |
After Width: | Height: | Size: 702 B |
After Width: | Height: | Size: 761 B |
After Width: | Height: | Size: 761 B |
After Width: | Height: | Size: 781 B |
After Width: | Height: | Size: 776 B |
After Width: | Height: | Size: 778 B |
After Width: | Height: | Size: 787 B |
After Width: | Height: | Size: 793 B |
After Width: | Height: | Size: 783 B |
After Width: | Height: | Size: 768 B |
After Width: | Height: | Size: 778 B |
After Width: | Height: | Size: 774 B |
After Width: | Height: | Size: 785 B |
After Width: | Height: | Size: 794 B |
After Width: | Height: | Size: 753 B |
After Width: | Height: | Size: 760 B |
After Width: | Height: | Size: 772 B |
After Width: | Height: | Size: 757 B |
After Width: | Height: | Size: 786 B |
After Width: | Height: | Size: 760 B |
After Width: | Height: | Size: 770 B |
After Width: | Height: | Size: 747 B |
After Width: | Height: | Size: 760 B |
After Width: | Height: | Size: 748 B |
After Width: | Height: | Size: 744 B |
After Width: | Height: | Size: 734 B |
After Width: | Height: | Size: 731 B |
After Width: | Height: | Size: 793 B |
After Width: | Height: | Size: 644 B |
After Width: | Height: | Size: 709 B |
After Width: | Height: | Size: 727 B |
After Width: | Height: | Size: 739 B |
After Width: | Height: | Size: 737 B |
After Width: | Height: | Size: 743 B |
After Width: | Height: | Size: 774 B |
After Width: | Height: | Size: 757 B |
After Width: | Height: | Size: 751 B |
After Width: | Height: | Size: 752 B |
After Width: | Height: | Size: 814 B |
After Width: | Height: | Size: 765 B |
After Width: | Height: | Size: 780 B |
After Width: | Height: | Size: 801 B |
After Width: | Height: | Size: 775 B |
After Width: | Height: | Size: 761 B |
After Width: | Height: | Size: 778 B |
After Width: | Height: | Size: 764 B |
After Width: | Height: | Size: 767 B |
After Width: | Height: | Size: 752 B |
After Width: | Height: | Size: 759 B |
After Width: | Height: | Size: 802 B |
After Width: | Height: | Size: 748 B |
After Width: | Height: | Size: 757 B |
After Width: | Height: | Size: 762 B |
After Width: | Height: | Size: 747 B |
After Width: | Height: | Size: 762 B |
After Width: | Height: | Size: 660 B |
After Width: | Height: | Size: 771 B |
After Width: | Height: | Size: 759 B |
After Width: | Height: | Size: 754 B |
After Width: | Height: | Size: 754 B |
After Width: | Height: | Size: 820 B |
After Width: | Height: | Size: 736 B |
After Width: | Height: | Size: 773 B |
After Width: | Height: | Size: 724 B |
After Width: | Height: | Size: 722 B |
After Width: | Height: | Size: 743 B |
After Width: | Height: | Size: 737 B |
After Width: | Height: | Size: 751 B |
After Width: | Height: | Size: 754 B |
After Width: | Height: | Size: 731 B |
After Width: | Height: | Size: 736 B |
After Width: | Height: | Size: 804 B |
After Width: | Height: | Size: 716 B |
After Width: | Height: | Size: 718 B |
After Width: | Height: | Size: 720 B |
After Width: | Height: | Size: 715 B |
After Width: | Height: | Size: 687 B |
After Width: | Height: | Size: 681 B |
After Width: | Height: | Size: 674 B |