Seer is a lightweight, semantically rich Ruby on Rails gem that provides a seamless interface for the Google Visualization API. It allows you to easily create a visualization of data in a variety of formats, and displaying a chart requires only a single line of code in your view.

Seer - Seer is a lightweight, semantically rich wrapper for the Google Visualization API. It allows you to easily create a visualization of data in a variety of formats, including area charts, bar charts, column charts, gauges, line charts, and pie charts.
Seer is a lightweight, semantically rich wrapper for the Google Visualization API. It allows you to easily create a visualization of data in a variety of formats, including area charts, bar charts, column charts, gauges, line charts, and pie charts.



seer

http://github.com/Bantik/seer

git://github.com/Bantik/seer.git

No way.

86

Series label for line chart accepts a method OR a string.


Seer can generate a variety of charts, including:

  • area charts,
  • bar charts,
  • column charts,
  • gauges,
  • line charts, and
  • pie charts.
Montage of graphs generated by Seer.

Support for additional chart types, including motion, geographic, and org charts, is slated for the next release.


Installation

Seer is hosted on Gemcutter, so make sure that gemcutter.org is in your gem source list:

$ gem update --system
$ gem install gemcutter --source http://gemcutter.org
$ gem tumble

Once you've confirmed this, install Seer as you would any other Rails gem:

$ gem install seer

Usage

Once the gem is installed, add this line to the <head> of either your layout file or the page that will be displaying your graph:

<%= Seer::init_visualization -%>

Now you're ready to leverage the graphing library.

Gather the data you want to visualize in an instance variable in your controller, then use the visualize method to insert the appropriate chart in your view. In your controller:



  # @data must be an array, and each object in the array must respond to the data method specified
  # in the visualize call (in this example, 'quantity')
  @data = Widget.all

In your view:


  <div id="chart" class="chart"></div>

  <%= Seer::visualize(
        @widgets,
        :as => :bar_chart,
        :in_element => 'chart',
        :series => {
          :series_label => 'name',
          :data_method => 'quantity'
        },
        :chart_options => {
          :height => 300,
          :width => 200 * @widgets.size,
          :is_3_d => false,
          :legend => 'none',
          :colors => ["#990000"],
          :title => "Widget Quantities",
          :title_x => 'Quantity',
          :title_y => 'Widgets'
        }
      )
   -%>

For a full introduction to Seer, please refer to the blog post announcing Seer.

For issues, source code, and more, refer to the Seer home page on GitHub.


License and Legal Stuff

This work is licensed under a MIT License.


Back to Projects