jparker / ruby-googlechart

A ruby interface to the Google Chart API

This URL has Read+Write access

jparker (author)
Wed Nov 19 22:06:09 -0800 2008
commit  3a67f867dc0a9fcbc0090b14b63ffe57fb913758
tree    1341d5b72b2309aad840384c66b4145ff5eedcf9
parent  0571b6045f50694707b8b037fc97e54e96a078b2
README.rdoc

ruby-googlechart

DESCRIPTION

ruby-googlechart is a ruby library which provides object-oriented access to the Google Charts API.

This library has largely been done as an exercise. These other ruby libraries are more mature and may be better suited to your needs:

FEATURES

  • Line charts (line, XY, sparkline)
  • Bar charts (horizontal, vertical, grouped, stacked)

SYNOPSIS

  require 'google_chart'

  url = GoogleChart.Line(:data => [1, nil, 2, 8, 1])
  url = GoogleChart.Bar(:data => [5, 23, 6, 14])

  url = GoogleChart.Bar do |c|
    c.axes     = {:x => %w[Q1 Q2 Q3 Q4], :y => 0..400}
    c.data     = [335, 285, 240, 220, 160, 175, 200, 205]
    c.encoding = :extended
    c.scale    = 0..400
    c.size     = '800x375'
    c.style    = :dash
    c.title    = "Are You Pondering What I'm Pondering?"
    c.type     = :line
  end
  url = GoogleChart.Bar do |c|
    c.horizontal = true
    c.grouped    = true
    c.data       = [[5, 6, 7, 8], [23, 14, 17, 16]]
    c.encoding   = :text
    c.title      = 'Lorem Ipsum Dolor'
  end

  chart = GoogleChart::LineChart.new
  chart.type  = :sparkline
  chart.size  = '75x25'
  chart.data  = [1, 1, 2, 3, 5, 8, 13]
  chart.color = 'ff0000'
  url = chart.to_url

REQUIREMENTS

  • Low standards

INSTALL

LICENSE

(The MIT License)

Copyright © 2008 John Parker

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.