Permalink
Browse files

Making bundler a little happier

  • Loading branch information...
1 parent 3370b09 commit 69689e859d2ed09889b18225e1fde3d54914c6a0 @qrush qrush committed Oct 9, 2009
View
11 Gemfile
@@ -4,9 +4,18 @@ bundle_path "vendor/bundler_gems"
source "http://gemcutter.org"
source "http://gems.github.com"
-gem "rails", "2.3.4", :only => :bundle
+gem "rails", "2.3.4"
+gem "activesupport", "2.3.4"
+gem "activerecord", "2.3.4"
+gem "actionpack", "2.3.4"
+gem "activeresource", "2.3.4"
+gem "actionmailer", "2.3.4"
+
gem "clearance"
gem "will_paginate"
+gem "gchartrb"
+gem "sinatra"
+gem "xml-simple"
gem "ddollar-pacecar", "1.1.6", :require_as => "pacecar"
gem "shoulda", :only => :test
View
2 bin/convert_to_should_syntax
@@ -1,3 +1,3 @@
-#!/usr/bin/env ruby
+#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.join(File.dirname(__FILE__), "../vendor/bundler_gems/environment")
load File.join(File.dirname(__FILE__), "../vendor/bundler_gems/gems/shoulda-2.10.2/bin/convert_to_should_syntax")
View
2 bin/cucumber
@@ -1,3 +1,3 @@
-#!/usr/bin/env ruby
+#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.join(File.dirname(__FILE__), "../vendor/bundler_gems/environment")
load File.join(File.dirname(__FILE__), "../vendor/bundler_gems/gems/cucumber-0.3.101/bin/cucumber")
View
2 bin/htmldiff
@@ -1,3 +1,3 @@
-#!/usr/bin/env ruby
+#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.join(File.dirname(__FILE__), "../vendor/bundler_gems/environment")
load File.join(File.dirname(__FILE__), "../vendor/bundler_gems/gems/diff-lcs-1.1.2/bin/htmldiff")
View
2 bin/ldiff
@@ -1,3 +1,3 @@
-#!/usr/bin/env ruby
+#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.join(File.dirname(__FILE__), "../vendor/bundler_gems/environment")
load File.join(File.dirname(__FILE__), "../vendor/bundler_gems/gems/diff-lcs-1.1.2/bin/ldiff")
View
2 bin/nokogiri
@@ -1,3 +1,3 @@
-#!/usr/bin/env ruby
+#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.join(File.dirname(__FILE__), "../vendor/bundler_gems/environment")
load File.join(File.dirname(__FILE__), "../vendor/bundler_gems/gems/nokogiri-1.3.3/bin/nokogiri")
View
2 bin/rackup
@@ -1,3 +1,3 @@
-#!/usr/bin/env ruby
+#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.join(File.dirname(__FILE__), "../vendor/bundler_gems/environment")
load File.join(File.dirname(__FILE__), "../vendor/bundler_gems/gems/rack-1.0.0/bin/rackup")
View
2 bin/rails
@@ -1,3 +1,3 @@
-#!/usr/bin/env ruby
+#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.join(File.dirname(__FILE__), "../vendor/bundler_gems/environment")
load File.join(File.dirname(__FILE__), "../vendor/bundler_gems/gems/rails-2.3.4/bin/rails")
View
2 bin/rake
@@ -1,3 +1,3 @@
-#!/usr/bin/env ruby
+#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.join(File.dirname(__FILE__), "../vendor/bundler_gems/environment")
load File.join(File.dirname(__FILE__), "../vendor/bundler_gems/gems/rake-0.8.7/bin/rake")
View
2 bin/rg
@@ -1,3 +1,3 @@
-#!/usr/bin/env ruby
+#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.join(File.dirname(__FILE__), "../vendor/bundler_gems/environment")
load File.join(File.dirname(__FILE__), "../vendor/bundler_gems/gems/redgreen-1.2.2/bin/rg")
View
2 bin/s3sh
@@ -1,3 +1,3 @@
-#!/usr/bin/env ruby
+#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.join(File.dirname(__FILE__), "../vendor/bundler_gems/environment")
load File.join(File.dirname(__FILE__), "../vendor/bundler_gems/gems/aws-s3-0.6.2/bin/s3sh")
View
2 bin/tt
@@ -1,3 +1,3 @@
-#!/usr/bin/env ruby
+#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require File.join(File.dirname(__FILE__), "../vendor/bundler_gems/environment")
load File.join(File.dirname(__FILE__), "../vendor/bundler_gems/gems/treetop-1.4.2/bin/tt")
View
8 config/environment.rb
@@ -1,20 +1,20 @@
RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
+require File.join(File.dirname(__FILE__), *%w[.. vendor bundler_gems environment])
require File.join(File.dirname(__FILE__), 'boot')
-require "#{RAILS_ROOT}/vendor/bundler_gems/environment"
+
+Bundler.require_env
Rails::Initializer.run do |config|
config.time_zone = 'UTC'
config.action_mailer.delivery_method = :smtp
+ config.frameworks -= [:active_resource]
end
-Bundler.require_env
-
DO_NOT_REPLY = "donotreply@gemcutter.org"
require 'lib/indexer'
require 'lib/core_ext/string'
-require 'clearance/sessions_controller'
require 'rdoc/markup/simple_markup'
require 'rdoc/markup/simple_markup/to_html'
View
BIN vendor/bundler_gems/cache/delayed_job-1.8.4.gem
Binary file not shown.
View
BIN vendor/bundler_gems/cache/gchartrb-0.8.gem
Binary file not shown.
View
BIN vendor/bundler_gems/cache/sinatra-0.9.4.gem
Binary file not shown.
View
73 vendor/gems/gchartrb-0.8/.specification
@@ -1,73 +0,0 @@
---- !ruby/object:Gem::Specification
-name: gchartrb
-version: !ruby/object:Gem::Version
- version: "0.8"
-platform: ruby
-authors:
-- Deepak Jois
-autorequire:
-bindir: bin
-cert_chain: []
-
-date: 2008-03-19 00:00:00 -04:00
-default_executable:
-dependencies: []
-
-description: "Visit http://code.google.com/p/gchartrb to track development regarding gchartrb. == FEATURES: * Provides an object oriented interface in Ruby to create Google Chart URLs for charts. == INSTALL: === Ruby Gem:"
-email: deepak.jois@gmail.com
-executables: []
-
-extensions: []
-
-extra_rdoc_files:
-- History.txt
-- Manifest.txt
-- README.txt
-files:
-- CREDITS
-- History.txt
-- Manifest.txt
-- README.txt
-- Rakefile
-- TODO
-- lib/example.rb
-- lib/google_chart.rb
-- lib/google_chart/bar_chart.rb
-- lib/google_chart/base.rb
-- lib/google_chart/line_chart.rb
-- lib/google_chart/pie_chart.rb
-- lib/google_chart/scatter_chart.rb
-- lib/google_chart/venn_diagram.rb
-- lib/google_chart/financial_line_chart.rb
-- lib/test.rb
-has_rdoc: true
-homepage: http://code.google.com/p/gchartrb
-licenses: []
-
-post_install_message:
-rdoc_options:
-- --main
-- README.txt
-require_paths:
-- lib
-required_ruby_version: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: "0"
- version:
-required_rubygems_version: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: "0"
- version:
-requirements: []
-
-rubyforge_project: gchartrb
-rubygems_version: 1.3.5
-signing_key:
-specification_version: 2
-summary: Ruby Wrapper for the Google Chart API
-test_files: []
-
View
6 vendor/gems/gchartrb-0.8/CREDITS
@@ -1,6 +0,0 @@
-Will Fitzgerald - http://www.entish.org/willwhim
-Bryan Donovan
-Aseem Tandon
-Diomedes <alakazoom@gmail.com>
-Aaron Blohowiak
-Jack Nutting
View
69 vendor/gems/gchartrb-0.8/History.txt
@@ -1,69 +0,0 @@
-== 0.8 / 2008-03-20
-
-* Fixed Rakefile to process URL correctly (Thanks Aaron Blohowiak)
-* Fixed Axis error due to typo in base.rb (Thanks Jack Nutting)
-
-== 0.7 / 2008-02-04
-
-* Added fill area feature
-* Added to_escaped_url method for encoding the URLs properly
-* Fixed bug where wrong variable name was being used in method
-
-== 0.6 / 2008-01-27
-
-* Added experimental support for undocumented Financial Line Chart (lfi)
-* Added line style support (thanks diomedes)
-* Added support for customisable width and spacing in bar charts
-
-== 0.5.5 / 2008-01-23
-
-* Fixed a bug related to multiple datasets using extended encoding
-
-== 0.5.4 / 2008-01-07
-
-* Fixed a bug related to data encoding in Stacked Charts
-* Fixed a bug in which title font and title font size values were being ignored
-* Fixed a bug where shape markers and range markers were overriding each other
-
-== 0.5.3 / 2007-12-19
-
-* Added support for shape markers
-* Added support for block based idiomatic ruby syntax
-
-== 0.5.2 / 2007-12-14
-
-* Added support for title color via title_color attribute
-* Added support for vertical and horizontal range markers using the range_marker method
-* Removed show_labels from base.rb and added it only for pie charts
-
-== 0.5.1 / 2007-12-12
-
-* Added support for max_value method to specify maximum values to plot against
-
-== 0.5 / 2007-12-12
-
-* Added Scatter Chart Support
-* Documentation Updates
-
-== 0.4.1 / 2007-12-12
-
-* Removed some spurious debug statements
-
-== 0.4 / 2007-12-12
-
-* Fixed issue when all data points are 0 in Line XY Chart (Thanks Cedric)
-* Proper calculation of max values for Line XY chart (Thanks Bryan Donovan)
-
-== 0.3 / 2007-12-11
-
-* Google changed Pie chart implementation to disable legends. Fixed in API.
-
-== 0.2 / 2007-12-11
-
-* Removed hoe dependency
-* Doc fixes
-
-== 0.1 / 2007-12-11
-
-* Initial Release
-* RDoc documentation
View
16 vendor/gems/gchartrb-0.8/Manifest.txt
@@ -1,16 +0,0 @@
-CREDITS
-History.txt
-Manifest.txt
-README.txt
-Rakefile
-TODO
-lib/example.rb
-lib/google_chart.rb
-lib/google_chart/bar_chart.rb
-lib/google_chart/base.rb
-lib/google_chart/line_chart.rb
-lib/google_chart/pie_chart.rb
-lib/google_chart/scatter_chart.rb
-lib/google_chart/venn_diagram.rb
-lib/google_chart/financial_line_chart.rb
-lib/test.rb
View
188 vendor/gems/gchartrb-0.8/README.txt
@@ -1,188 +0,0 @@
-= gchartrb
-http://code.google.com/p/gchartrb
-
-== DESCRIPTION:
-
-gchartrb is a Ruby wrapper around the Google Chart API, located at http://code.google.com/apis/chart/
-
-Visit http://code.google.com/p/gchartrb to track development regarding gchartrb.
-
-== FEATURES:
-
-* Provides an object oriented interface in Ruby to create Google Chart URLs for charts.
-
-== INSTALL:
-
-=== Ruby Gem:
-
- sudo gem install gchartrb
-
-=== Source Code:
-
-Download the latest release from http://code.google.com/p/gchartrb/downloads/list
-
-=== Subversion
-
- svn checkout http://gchartrb.googlecode.com/svn/trunk/ gchartrb-read-only
-
-== Problems/TODO
-The following features are pending :
-
-* Line Styles
-* Fill Area
-
-However, you can still make use of the API to insert arbitrary parameters
-
- # Plotting a sparklines chart (using extra params)
- GoogleChart::LineChart.new('100x50', nil, false) do |sparklines|
- sparklines.data "Test", [4,3,2,4,6,8,10]
- sparklines.show_legend = false
- sparklines.axis :x, :labels => [] # Empty labels
- sparklines.axis :y, :labels => [] # Empty labels
- puts sparklines.to_url(:chxs => "0,000000,10,0,_|1,000000,10,0,_")
- end
-
-== SYNOPSIS:
-
- require 'rubygems'
- require 'google_chart'
-
- # Pie Chart
- GoogleChart::PieChart.new('320x200', "Pie Chart",false) do |pc|
- pc.data "Apples", 40
- pc.data "Banana", 20
- pc.data "Peach", 30
- pc.data "Orange", 60
- puts "\nPie Chart"
- puts pc.to_url
-
- # Pie Chart with no labels
- pc.show_labels = false
- puts "\nPie Chart (with no labels)"
- puts pc.to_url
- end
-
-
- # Line Chart
- GoogleChart::LineChart.new('320x200', "Line Chart", false) do |lc|
- lc.data "Trend 1", [5,4,3,1,3,5,6], '0000ff'
- lc.show_legend = true
- lc.data "Trend 2", [1,2,3,4,5,6], '00ff00'
- lc.data "Trend 3", [6,5,4,3,2,1], 'ff0000'
- lc.axis :y, :range => [0,6], :color => 'ff00ff', :font_size => 16, :alignment => :center
- lc.axis :x, :range => [0,6], :color => '00ffff', :font_size => 16, :alignment => :center
- lc.grid :x_step => 100.0/6.0, :y_step => 100.0/6.0, :length_segment => 1, :length_blank => 0
- puts "\nLine Chart"
- puts lc.to_url
- end
-
- # Bar Chart
- GoogleChart::BarChart.new('800x200', "Bar Chart", :vertical, false) do |bc|
- bc.data "Trend 1", [5,4,3,1,3,5], '0000ff'
- bc.data "Trend 2", [1,2,3,4,5,6], 'ff0000'
- bc.data "Trend 3", [6,5,4,4,5,6], '00ff00'
- puts "\nBar Chart"
- puts bc.to_url
- end
-
- # Line XY Chart
- line_chart_xy = GoogleChart::LineChart.new('320x200', "Line XY Chart", true) do |lcxy|
- lcxy.data "Trend 1", [[1,1], [2,2], [3,3], [4,4]], '0000ff'
- lcxy.data "Trend 2", [[4,5], [2,2], [1,1], [3,4]], '00ff00'
- puts "\nLine XY Chart (inside a block)"
- puts lcxy.to_url
- end
-
- # Venn Diagram
- # Supply three vd.data statements of label, size, color for circles A, B, C
- # Then, an :intersections with four values:
- # the first value specifies the area of A intersecting B
- # the second value specifies the area of B intersecting C
- # the third value specifies the area of C intersecting A
- # the fourth value specifies the area of A intersecting B intersecting C
- GoogleChart::VennDiagram.new("320x200", 'Venn Diagram') do |vd|
- vd.data "Blue", 100, '0000ff'
- vd.data "Green", 80, '00ff00'
- vd.data "Red", 60, 'ff0000'
- vd.intersections 30,30,30,10
- puts "\nVenn Diagram"
- puts vd.to_url
- end
-
- # Scatter Chart
- GoogleChart::ScatterChart.new('320x200',"Scatter Chart") do |sc|
- sc.data "Scatter Set", [[1,1,], [2,2], [3,3], [4,4]]
- sc.max_value [5,5] # Setting the max value
- sc.axis :x, :range => [0,5]
- sc.axis :y, :range => [0,5], :labels => [0,1,2,3,4,5]
- sc.point_sizes [10,15,30,55] # Optional
- puts "\nScatter Chart"
- puts sc.to_url
- end
-
-
- GoogleChart::LineChart.new('320x200', "Line Chart", false) do |lc|
- lc.data "Trend 1", [5,4,3,1,3,5,6], '0000ff'
- lc.show_legend = true
- lc.data "Trend 2", [1,2,3,4,5,6], '00ff00'
- lc.data "Trend 3", [6,5,4,3,2,1], 'ff0000'
- lc.axis :y, :range => [0,6], :color => 'ff00ff', :font_size => 16, :alignment => :center
- lc.axis :x, :range => [0,6], :color => '00ffff', :font_size => 16, :alignment => :center
- lc.grid :x_step => 100.0/6.0, :y_step => 100.0/6.0, :length_segment => 1, :length_blank => 0
- puts "\nLine Chart"
- end
-
- # Solid fill
- line_chart_xy.fill(:background, :solid, {:color => 'fff2cc'})
- line_chart_xy.fill(:chart, :solid, {:color => 'ffcccc'})
- puts "\nLine Chart with Solid Fill"
- puts line_chart_xy.to_url
-
- # Gradient fill
- line_chart_xy.fill :background, :gradient, :angle => 0, :color => [['76A4FB',1],['ffffff',0]]
- line_chart_xy.fill :chart, :gradient, :angle => 0, :color => [['76A4FB',1], ['ffffff',0]]
- puts "\nLine Chart with Gradient Fill"
- puts line_chart_xy.to_url
-
- # Stripes Fill
- line_chart_xy.fill :chart, :stripes, :angle => 90, :color => [['76A4FB',0.2], ['ffffff',0.2]]
- puts "\nLine Chart with Stripes Fill"
- puts line_chart_xy.to_url
-
- puts "\nLine Chart with range markers and shape markers"
- GoogleChart::LineChart.new('320x200', "Line Chart", false) do |lc|
- lc.title_color = 'ff00ff'
- lc.data "Trend 1", [5,4,3,1,3,5,6], '0000ff'
- lc.data "Trend 2", [1,2,3,4,5,6], '00ff00'
- lc.data "Trend 3", [6,5,4,3,2,1], 'ff0000'
- lc.max_value 10 # Setting max value for simple line chart
- lc.range_marker :horizontal, :color => 'E5ECF9', :start_point => 0.1, :end_point => 0.5
- lc.range_marker :vertical, :color => 'a0bae9', :start_point => 0.1, :end_point => 0.5
- # Draw an arrow shape marker against lowest value in dataset
- lc.shape_marker :arrow, :color => '000000', :data_set_index => 0, :data_point_index => 3, :pixel_size => 10
- puts lc.to_url
- end
-== LICENSE:
-
-(The MIT License)
-
-Copyright (c) 2007 Deepak Jois
-
-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.
View
43 vendor/gems/gchartrb-0.8/Rakefile
@@ -1,43 +0,0 @@
-# -*- ruby -*-
-
-require 'rubygems'
-require 'hoe'
-require './lib/google_chart.rb'
-
-class Hoe
- def extra_deps; @extra_deps.reject { |x| Array(x).first == "hoe" } end
-end # copied from the Rakefile of the sup project
-
-Hoe.new('gchartrb', "0.8") do |p|
- p.rubyforge_name = 'gchartrb'
- p.author = 'Deepak Jois'
- p.email = 'deepak.jois@gmail.com'
- p.summary = 'Ruby Wrapper for the Google Chart API'
- p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
- p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
- p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
- p.remote_rdoc_dir = ''
-end
-
-
-RDOC_OPTS = [
- '--quiet',
- '--title', 'gchartrb API',
- '--main', 'README.txt',
- '--charset', 'utf-8',
- '--inline-source',
- '--tab-width', '2',
- '--line-numbers',
-]
-
-Rake::RDocTask.new do |rdoc|
- rdoc.rdoc_dir = 'doc/'
- rdoc.options = RDOC_OPTS
- rdoc.main = "README.txt"
- rdoc.rdoc_files.add [
- 'README.txt',
- 'History.txt',
- 'lib/**/*.rb'
- ]
-end
-# vim: syntax=Ruby
View
23 vendor/gems/gchartrb-0.8/TODO
@@ -1,23 +0,0 @@
-TODO List (Features)
-====================
-* Line Styles DONE
-* Customisable Width for bar charts DONE
-* Fill Area DONE
-* Download Image
-
-* Friendly Color Values
-* Easy calculations for Stuff that is needed
-
-TODO List (Other)
-=================
-* Create an alternate git repository
-
-Code Level Improvements
-=======================
-* Automate upload to google code
-* Write tests that render different kinds of graphs
-* Use splats instead of attribute accessors to provide a neater API (?)
-* Clean up encoding, especially the handling of 'missing' values
-* Improved error handling and reporting for things
- * Number of labels and number of postions in axis must be the same (?)
- * Axis styles need to be specified in a certain way
View
78 vendor/gems/gchartrb-0.8/lib/example.rb
@@ -1,78 +0,0 @@
-require 'google_chart'
-
-# Some examples from http://24ways.org/2007/tracking-christmas-cheer-with-google-charts
-
-# Pie Chart
-pc = GoogleChart::PieChart.new("600x300", "Food and Drinks Consumed Christmas 2007")
-pc.data "Egg nog", 10, '00AF33'
-pc.data "Christmas Ham", 20, '4BB74C'
-pc.data "Milk (not including egg nog)", 8, 'EE2C2C'
-pc.data "Cookies", 25, 'CC3232'
-pc.data "Roasted Chestnuts", 5, '33FF33'
-pc.data "Chocolate", 3, '66FF66'
-pc.data "Various Other Beverages", 15, '9AFF9A'
-pc.data "Various Other Foods", 9, 'C1FFC1'
-pc.data "Snacks", 5, 'CCFFCC'
-puts pc
-
-# Line Chart
-x_axis_labels = (1..31).to_a.collect do |v|
- if [1,6,25,26,31].member?(v)
- if v == 1
- "Dec 1st"
- elsif v == 31
- "Dec 31st"
- elsif v
- "#{v}th"
- end
- else
- nil
- end
-end
-
-y_axis_labels = (0..10).to_a.collect do |v|
- val = 10 * v
- if val ==50 or val == 100
- val.to_s
- else
- nil
- end
-end
-
-series_1_y = [30,45,20,50,15,80,60,70,40,55,80]
-series_2_y = [50,10,30,55,60]
-
-series_1_x = [1,6,8,10,18,23,25,26,28,29,31]
-series_2_x = [1,4,6,9,11]
-
-series_1_xy = []
-series_2_xy = []
-
-series_1_x.each_with_index do |v,i|
- series_1_xy[i] = [v-1, series_1_y[i] ]
-end
-
-series_2_x.each_with_index do |v,i|
- series_2_xy[i] = [v-1, series_2_y[i ] ]
-end
-
-lcxy = GoogleChart::LineChart.new('800x300', "Projected Christmas Cheer for 2007", true)
-lcxy.data "2006", series_1_xy, '458B00'
-lcxy.data "2007", series_2_xy, 'CD2626'
-lcxy.max_value [30,100]
-lcxy.data_encoding = :text
-lcxy.axis :x, :labels => x_axis_labels
-lcxy.axis :y, :labels => y_axis_labels
-lcxy.grid :x_step => 3.333, :y_step => 10, :length_segment => 1, :length_blank => 3
-puts lcxy.to_url
-
-
-# Plotting a sparklines chart
-sparklines = GoogleChart::LineChart.new('100x40', nil, false)
-sparklines.data "Test", [4,3,2,4,6,8,10]
-sparklines.show_legend = false
-sparklines.axis :x, :labels => []
-sparklines.axis :y, :labels => []
-puts sparklines.to_url(:chxs => "0,000000,10,0,_|1,000000,10,0,_")
-
-
View
11 vendor/gems/gchartrb-0.8/lib/google_chart.rb
@@ -1,11 +0,0 @@
-%w(
- base
- pie_chart
- line_chart
- bar_chart
- venn_diagram
- scatter_chart
- financial_line_chart
-).each do |filename|
- require File.dirname(__FILE__) + "/google_chart/#{filename}"
-end
View
90 vendor/gems/gchartrb-0.8/lib/google_chart/bar_chart.rb
@@ -1,90 +0,0 @@
-require File.dirname(__FILE__) + '/base'
-module GoogleChart
- # Generates a Bar Chart. You can specify the alignment(horizontal or vertical) and whether you want the bars to be grouped or stacked
- # ==== Examples
- # bc = GoogleChart::BarChart.new('800x200', "Bar Chart", :vertical, false)
- # bc.data "Trend 1", [5,4,3,1,3,5], '0000ff'
- class BarChart < Base
-
- attr_accessor :alignment, :stacked
-
- # Specify the
- # * +chart_size+ in WIDTHxHEIGHT format
- # * +chart_title+ as a string
- # * +alignment+ as either <tt>:vertical</tt> or <tt>:horizontal</tt>
- # * +stacked+ should be +true+ if you want the bars to be stacked, false otherwise
- def initialize(chart_size='300x200', chart_title=nil, alignment=:vertical, stacked=false) # :yield: self
- super(chart_size, chart_title)
- @alignment = alignment
- @stacked = stacked
- set_chart_type
- self.show_legend = true
- yield self if block_given?
- end
-
- # Set the alignment to either <tt>:vertical</tt> or <tt>:horizontal</tt>
- def alignment=(value)
- @alignment = value
- set_chart_type
- end
-
- # If you want the bar chart to be stacked, set the value to <tt>true</tt>, otherwise set the value to <tt>false</tt> to group it.
- def stacked=(value)
- @stacked = value
- set_chart_type
- end
-
- # Defines options for bar width, spacing between bars and between groups of bars. Applicable for bar charts.
- # [+options+] : Options for the style, specifying things like line thickness and lengths of the line segment and blank portions
- #
- # ==== Options
- # * <tt>:bar_width</tt>, Bar width in pixels
- # * <tt>:bar_spacing</tt> (optional), space between bars in a group
- # * <tt>:group_spacing</tt> (optional), space between groups
- def width_spacing_options(options={})
- options_str = "#{options[:bar_width]}"
- options_str += ",#{options[:bar_spacing]}" if options[:bar_spacing]
- options_str += ",#{options[:group_spacing]}" if options[:bar_spacing] and options[:group_spacing]
- @bar_width_spacing_options = options_str
- end
-
- def process_data
- if @stacked # Special handling of max value for stacked
- unless @max_data # Unless max_data is explicitly set
- @max_data = @data.inject([]) do |sum_arr, series|
- series.each_with_index do |v,i|
- if sum_arr[i] == nil
- sum_arr[i] = v
- else
- sum_arr[i] += v
- end
- end
- sum_arr
- end.max
- end
- end
-
- if @data.size > 1
- join_encoded_data(@data.collect { |series|
- encode_data(series, max_data_value)
- })
- else
- encode_data(@data.flatten,max_data_value)
- end
- end
-
- private
- def set_chart_type
- # Set chart type
- if alignment == :vertical and stacked == false
- self.chart_type = :bvg
- elsif alignment == :vertical and stacked == true
- self.chart_type = :bvs
- elsif alignment == :horizontal and stacked == false
- self.chart_type = :bhg
- elsif alignment == :horizontal and stacked == true
- self.chart_type = :bhs
- end
- end
- end
-end
View
536 vendor/gems/gchartrb-0.8/lib/google_chart/base.rb
@@ -1,536 +0,0 @@
-require 'uri'
-
-module GoogleChart
- class Base
- BASE_URL = "http://chart.apis.google.com/chart?"
-
- SIMPLE_ENCODING = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'.split('');
- COMPLEX_ENCODING_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.'.split('');
- @@complex_encoding = []
- COMPLEX_ENCODING_ALPHABET.each_with_index do |outer,index_outer|
- COMPLEX_ENCODING_ALPHABET.each_with_index do |inner, index_inner|
- @@complex_encoding[index_outer * 64 + index_inner] = outer + inner
- end
- end
-
- SHAPE_MARKERS = {:arrow => "a",
- :cross => "c",
- :diamond => "d",
- :circle => "o",
- :square => "s",
- :vline_segment => "v",
- :vline_full => "V",
- :hline_full => "h",
- :x => "x"
- }
-
- DEFAULT_LINE_STYLE = '1'
-
- # Size of the chart in WIDTHxHEIGHT format
- attr_accessor :chart_size
-
- # Type of the chart. Usually, you do not need to set this yourself
- attr_accessor :chart_type
-
- # Chart title
- attr_accessor :chart_title
-
- # RRGGBB hex value for the color of the title
- attr_accessor :title_color
-
- # Font size of the title
- attr_accessor :title_font_size
-
- # Data encoding to use. Can be one of <tt>:simple</tt>, <tt>:text</tt> or <tt>:extended</tt> (see http://code.google.com/apis/chart/#chart_data)
- attr_accessor :data_encoding
-
- # A hash of the params used to construct the URL
- attr_accessor :params
-
- # Set to <tt>true</tt> or <tt>false</tt> to show or hide the chart legend. Not applicable for Scatter Chart.
- attr_accessor :show_legend
-
- def initialize(chart_size, chart_title)
- self.params = Hash.new
- @labels = []
- @data = []
- @colors = []
- @axis = []
- @markers = []
- @line_styles = []
- self.chart_size = chart_size
- self.chart_title = chart_title
- self.data_encoding = :simple
- self.show_legend = true
- end
-
- # Generates the URL string that can be used to retrieve the graph image in PNG format.
- # Use this after assigning all the properties to the graph
- # You can pass in additional params as a hash for features that may not have been implemented
- # For e.g
- # lc = GoogleChart::LineChart.new('320x200', "Line Chart", false)
- # lc.data "Trend 1", [5,4,3,1,3,5,6], '0000ff'
- # lc.data "Trend 2", [1,2,3,4,5,6], '00ff00'
- # lc.data "Trend 3", [6,5,4,3,2,1], 'ff0000'
- # puts lc.to_url({:chm => "000000,0,0.1,0.11"}) # Single black line as a horizontal marker
- def to_url(extras={})
- prepare_params
- params.merge!(extras)
- query_string = params.map { |k,v| "#{k}=#{URI.escape(v.to_s).gsub(/%20/,'+').gsub(/%7C/,'|')}" }.join('&')
- BASE_URL + query_string
- end
-
- # Generates a fully encoded URL string that can be used to retrieve the graph image in PNG format.
- # For less verbose URLs, use the <tt>to_url</tt> method. Use this only if you are doing further
- # processing with the URLs, like passing the URL to a method for downloading the images
- #
- # Use this after assigning all the properties to the graph
- # You can pass in additional params as a hash for features that may not have been implemented
- # For e.g
- # lc = GoogleChart::LineChart.new('320x200', "Line Chart", false)
- # lc.data "Trend 1", [5,4,3,1,3,5,6], '0000ff'
- # lc.data "Trend 2", [1,2,3,4,5,6], '00ff00'
- # lc.data "Trend 3", [6,5,4,3,2,1], 'ff0000'
- # puts lc.to_escaped_url({:chm => "000000,0,0.1,0.11"}) # Single black line as a horizontal marker
- def to_escaped_url(extras={})
- prepare_params
- params.merge!(extras)
- query_string = params.map { |k,v| "#{k}=#{URI.escape(v.to_s)}" }.join('&')
- BASE_URL + query_string
- end
-
- # Adds the data to the chart, according to the type of the graph being generated.
- #
- # [+name+] is a string containing a label for the data.
- # [+value+] is either a number or an array of numbers containing the data. Pie Charts and Venn Diagrams take a single number, but other graphs require an array of numbers
- # [+color+ (optional)] is a hexadecimal RGB value for the color to represent the data
- #
- # ==== Examples
- #
- # for GoogleChart::LineChart (normal)
- # lc.data "Trend 1", [1,2,3,4,5], 'ff00ff'
- #
- # for GoogleChart::LineChart (XY chart)
- # lc.data "Trend 2", [[4,5], [2,2], [1,1], [3,4]], 'ff00ff'
- #
- # for GoogleChart::PieChart
- # lc.data "Apples", 5, 'ff00ff'
- # lc.data "Oranges", 7, '00ffff'
- def data(name, value, color=nil)
- @data << value
- @labels << name
- @colors << color if color
- end
-
- # Allows (optional) setting of a max value for the chart, which will be used for data encoding and axis plotting.
- # The value to pass depends on the type of chart
- # * For Line Chart and Bar Charts it should be a single integer or float value
- # * For Scatter Charts and Line XY Charts, you MUST pass an array containing the maximum values for X and Y
- #
- # ==== Examples
- # For bar charts
- # bc.max_value 5 # 5 will be used to calculate the relative encoding values
- # For scatter chart
- # sc.max_value [5,6] # 5 is the max x value and 6 is the max y value
- #
- # Note : MAKE SURE you are passing the right values otherwise an exception will be raised
- def max_value(value)
- if [:lxy, :s].member?(self.chart_type) and value.is_a?(Array)
- @max_x = value.first
- @max_y = value.last
- elsif [:lc,:bhg,:bhs,:bvg,:bvs] and (value.is_a?(Integer) or value.is_a?(Float))
- @max_data = value
- else
- raise "Invalid max value for this chart type"
- end
- end
-
- # Adds a background or chart fill. Call this option twice if you want both a background and a chart fill
- # [+bg_or_c+] Can be one of <tt>:background</tt> or <tt>:chart</tt> depending on the kind of fill requested
- # [+type+] Can be one of <tt>:solid</tt>, <tt>:gradient</tt> or <tt>:stripes</tt>
- # [+options+] : Options depend on the type of fill selected above
- #
- # ==== Options
- # For <tt>:solid</tt> type
- # * A <tt>:color</tt> option which specifies the RGB hex value of the color to be used as a fill. For e.g <tt>lc.fill(:chart, :solid, {:color => 'ffcccc'})</tt>
- #
- # For <tt>:gradient</tt> type
- # * An <tt>:angle</tt>, which is the angle of the gradient between 0(horizontal) and 90(vertical)
- # * A <tt>:color</tt> option which is a 2D array containing the colors and an offset each, which specifies at what point the color is pure where: 0 specifies the right-most chart position and 1 the left-most. e,g <tt>lc.fill :background, :gradient, :angle => 0, :color => [['76A4FB',1],['ffffff',0]]</tt>
- #
- # For <tt>:stripes</tt> type
- # * An <tt>:angle</tt>, which is the angle of the stripe between 0(horizontal) and 90(vertical)
- # * A <tt>:color</tt> option which is a 2D array containing the colors and width value each, which must be between 0 and 1 where 1 is the full width of the chart. for e.g <tt>lc.fill :chart, :stripes, :angle => 90, :color => [ ['76A4FB',0.2], ['ffffff',0.2] ]</tt>
- def fill(bg_or_c, type, options = {})
- case bg_or_c
- when :background
- @background_fill = "bg," + process_fill_options(type, options)
- when :chart
- @chart_fill = "c," + process_fill_options(type, options)
- end
- end
-
- # Adds an axis to the graph. Not applicable for Pie Chart (GoogleChart::PieChart) or Venn Diagram (GoogleChart::VennDiagram)
- #
- # [+type+] is a symbol which can be one of <tt>:x</tt>, <tt>:y</tt>, <tt>:right</tt>, <tt>:top</tt>
- # [+options+] is a hash containing the options (see below)
- #
- # ==== Options
- # Not all the options are mandatory.
- # [<tt>:labels</tt>] An array containing the labels for the axis
- # [<tt>:positions</tt>] An Array containing the positions for the labels
- # [<tt>:range</tt>] An array containing 2 elements, the start value and end value
- #
- # axis styling options have to be specified as follows
- # [<tt>:color</tt>] Hexadecimal RGB value for the color to represent the data for the axis labels
- # [<tt>:font_size</tt>] Font size of the labels in pixels
- # [<tt>:alignment</tt>] can be one of <tt>:left</tt>, <tt>:center</tt> or <tt>:right</tt>
- #
- # ==== Examples
- # lc.axis :y, :range => [0,6], :color => 'ff00ff', :font_size => 16, :alignment => :center
- #
- def axis(type, options = {})
- raise "Illegal axis type" unless [:x, :y, :right, :top].member?(type)
- @axis << [type, options]
- end
-
- # Adds a grid to the graph. Applicable only for Line Chart (GoogleChart::LineChart) and Scatter Chart (GoogleChart::ScatterChart)
- #
- # [+options+] is a hash containing the options (see below)
- #
- # === Options
- # [<tt>:xstep</tt>] X axis step size
- # [<tt>:ystep</tt>] Y axis step size
- # [<tt>:length_segment</tt> (optional)] Length of the line segement. Useful with the :length_blank value to have dashed lines
- # [<tt>:length_blank</tt> (optional)] Length of the blank segment. use 0 if you want a solid grid
- #
- # === Examples
- # lc.grid :x_step => 5, :y_step => 5, :length_segment => 1, :length_blank => 0
- #
- def grid(options={})
- @grid_str = "#{options[:x_step].to_f},#{options[:y_step].to_f}"
- if options[:length_segment] or options[:length_blank]
- @grid_str += ",#{options[:length_segment].to_f},#{options[:length_blank].to_f}"
- end
- end
-
- # Defines a horizontal or vertical range marker. Applicable for line charts and vertical charts
- #
- # [+alignment+] can be <tt>:horizontal</tt> or <tt>:vertical</tt>
- # [+options+] specifies the color, start point and end point
- #
- # ==== Options
- # [<tt>:color</tt>] RRGGBB hex value for the color of the range marker
- # [<tt>:start_point</tt>] position on the x-axis/y-axis at which the range starts where 0.00 is the left/bottom and 1.00 is the right/top
- # [<tt>:end_point</tt>] position on the x-axis/y-axis at which the range ends where 0.00 is the left/bottom and 1.00 is the right/top
- #
- # ==== Examples
- # lc.range_marker :horizontal, :color => 'E5ECF9', :start_point => 0.1, :end_point => 0.5
- # lc.range_marker :vertical, :color => 'a0bae9', :start_point => 0.1, :end_point => 0.5
- def range_marker(alignment, options={})
- raise "Invalid alignment specified" unless [:horizontal, :vertical].member?(alignment)
- str = (alignment == :horizontal ) ? "r" : "R"
- str += ",#{options[:color]},0,#{options[:start_point]},#{options[:end_point]}"
- @markers << str
- end
-
- # Defines a shape marker. Applicable for line charts and scatter plots
- #
- # [+type+] can be <tt>:arrow</tt>, <tt>:cross</tt>, <tt>:diamond</tt>, <tt>:circle</tt>, <tt>:square</tt>, <tt>:vline_segment</tt>, <tt>:vline_full</tt>, <tt>:hline_full</tt>, <tt>:x</tt>
- # [+options+] specifies the color, data set index, data point index and size in pixels
- #
- # ==== Options
- # [<tt>:color</tt>] RRGGBB hex value for the color of the range marker
- # [<tt>:data_set_index</tt>] the index of the line on which to draw the marker. This is 0 for the first data set, 1 for the second and so on.
- # [<tt>:data_point_index</tt>] is a floating point value that specifies on which data point of the data set the marker will be drawn. This is 0 for the first data point, 1 for the second and so on. Specify a fraction to interpolate a marker between two points.
- # [<tt>:size</tt>] is the size of the marker in pixels.
- #
- # ==== Examples
- # lcxy.shape_marker :circle, :color => "000000", :data_set_index => 1, :data_point_index => 2, :pixel_size => 10
- # lcxy.shape_marker :cross, :color => "E5ECF9", :data_set_index => 0, :data_point_index => 0.5, :pixel_size => 10
- def shape_marker(type, options={})
- raise "Invalid shape marker type specified" unless SHAPE_MARKERS.has_key?(type)
- shape_marker_str = "#{SHAPE_MARKERS[type]},#{options[:color]},#{options[:data_set_index]},#{options[:data_point_index]},#{options[:pixel_size]}"
- @markers << shape_marker_str
- end
-
- # Defines a Fill area. Applicable for line charts only
- #
- # [+color+] is the color of the fill area
- # [+start_index+] is the index of the line at which the fill starts. This is 0 for the first data set, 1 for the second and so on.
- # [+end_index+] is the index of the line at which the fill ends.
- #
- # ==== Examples
- # # Fill Area (Multiple Datasets)
- # lc = GoogleChart::LineChart.new('320x200', "Line Chart", false) do |lc|
- # lc.show_legend = false
- # lc.data "Trend 1", [5,5,6,5,5], 'ff0000'
- # lc.data "Trend 2", [3,3,4,3,3], '00ff00'
- # lc.data "Trend 3", [1,1,2,1,1], '0000ff'
- # lc.data "Trend 4", [0,0,0,0,0], 'ffffff'
- # lc.fill_area '0000ff',2,3
- # lc.fill_area '00ff00',1,2
- # lc.fill_area 'ff0000',0,1
- # end
- # puts "\nFill Area (Multiple Datasets)"
- # puts lc.to_url
- #
- # # Fill Area (Single Dataset)
- # lc = GoogleChart::LineChart.new('320x200', "Line Chart", false) do |lc|
- # lc.show_legend = false
- # lc.data "Trend 1", [5,5,6,5,5], 'ff0000'
- # lc.fill_area 'cc6633', 0, 0
- # end
- # puts "\nFill Area (Single Dataset)"
- # puts lc.to_url
- #
- def fill_area(color, start_index, end_index)
- if (start_index == 0 and end_index == 0)
- @markers << "B,#{color},0,0,0"
- else
- @markers << "b,#{color},#{start_index},#{end_index},0"
- end
- end
-
- protected
-
- def prepare_params
- params.clear
- set_size
- set_type
- set_colors
- set_fill_options
- add_axis unless @axis.empty?
- add_grid
- add_data
- add_line_styles unless @line_styles.empty?
- set_bar_width_spacing_options if @bar_width_spacing_options
- add_markers unless @markers.empty?
- add_labels(@labels) if [:p, :p3].member?(self.chart_type)
- add_legend(@labels) if show_legend
- add_title if chart_title.to_s.length > 0
- end
-
- def process_fill_options(type, options)
- case type
- when :solid
- "s,#{options[:color]}"
- when :gradient
- "lg,#{options[:angle]}," + options[:color].collect { |o| "#{o.first},#{o.last}" }.join(",")
- when :stripes
- "ls,#{options[:angle]}," + options[:color].collect { |o| "#{o.first},#{o.last}" }.join(",")
- end
-
- end
-
- def set_type
- params.merge!({:cht => chart_type})
- end
-
- def set_size
- params.merge!({:chs => chart_size})
- end
-
- def set_colors
- params.merge!({:chco => @colors.collect{|c| c.downcase}.join(",") }) if @colors.size > 0
- end
-
- def set_fill_options
- fill_opt = [@background_fill, @chart_fill].compact.join("|")
- params.merge!({:chf => fill_opt}) if fill_opt.length > 0
- end
-
- def add_labels(labels)
- params.merge!({:chl => labels.collect{|l| l.to_s}.join("|") }) if self.show_labels
- end
-
- def add_legend(labels)
- params.merge!({:chdl => labels.collect{ |l| l.to_s}.join("|")})
- end
-
- def add_title
- params.merge!({:chtt => chart_title})
- params.merge!({:chts => title_color}) if title_color
- params.merge!({:chts => "#{title_color},#{title_font_size}"}) if title_color and title_font_size
- end
-
- def add_axis
- chxt = []
- chxl = []
- chxp = []
- chxr = []
- chxs = []
- # Process params
- @axis.each_with_index do |axis, idx|
- # Find axis type
- case axis.first
- when :x
- chxt << "x"
- when :y
- chxt << "y"
- when :top
- chxt << "t"
- when :right
- chxt << "r"
- end
-
- # Axis labels
- axis_opts = axis.last
-
- if axis_opts[:labels]
- chxl[idx] = "#{idx}:|" + axis_opts[:labels].join("|")
- end
-
- # Axis positions
- if axis_opts[:positions]
- chxp[idx] = "#{idx}," + axis_opts[:positions].join(",")
- end
-
- # Axis range
- if axis_opts[:range]
- chxr[idx] = "#{idx},#{axis_opts[:range].first},#{axis_opts[:range].last}"
- end
-
- # Axis Styles
- if axis_opts[:color] or axis_opts[:font_size] or axis_opts[:alignment]
- if axis_opts[:alignment]
- alignment = case axis_opts[:alignment]
- when :center
- 0
- when :left
- -1
- when :right
- 1
- else
- nil
- end
- end
- chxs[idx] = "#{idx}," + [axis_opts[:color], axis_opts[:font_size], alignment].compact.join(",")
- end
- end
-
- # Add to params hash
- params.merge!({ :chxt => chxt.join(",") }) unless chxt.empty?
- params.merge!({ :chxl => chxl.compact.join("|") }) unless chxl.compact.empty?
- params.merge!({ :chxp => chxp.compact.join("|") }) unless chxp.compact.empty?
- params.merge!({ :chxr => chxr.compact.join("|") }) unless chxr.compact.empty?
- params.merge!({ :chxs => chxs.compact.join("|") }) unless chxs.compact.empty?
- end
-
- def add_grid
- params.merge!({ :chg => @grid_str }) if @grid_str
- end
-
- def add_line_styles
- 0.upto(@line_styles.length - 1) { |i|
- @line_styles[i] = DEFAULT_LINE_STYLE unless @line_styles[i]
- }
- params.merge!({:chls => @line_styles.join("|")})
- end
-
- def set_bar_width_spacing_options
- params.merge!({:chbh => @bar_width_spacing_options})
- end
-
- def add_markers
- params.merge!({:chm => @markers.join("|")})
- end
-
- def add_data
- converted_data = process_data
- case data_encoding
- when :simple
- converted_data = "s:" + converted_data
- when :text
- converted_data = "t:" + converted_data
- when :extended
- converted_data = "e:" + converted_data
- else
- raise "Illegal Encoding Specified"
- end
- params.merge!({:chd => converted_data})
- end
-
- def encode_data(values, max_value=nil)
- case data_encoding
- when :simple
- simple_encode(values, max_value)
- when :text
- text_encode(values, max_value)
- when :extended
- extended_encode(values, max_value)
- else
- raise "Illegal Encoding Specified"
- end
- end
-
- def simple_encode(values, max_value=nil)
- alphabet_length = 61
- max_value = values.max unless max_value
-
- chart_data = values.collect do |val|
- if val.to_i >=0
- if max_value == 0
- SIMPLE_ENCODING[0]
- else
- SIMPLE_ENCODING[(alphabet_length * val / max_value).to_i]
- end
- else
- "_"
- end
- end
-
- return chart_data.join('')
- end
-
- def text_encode(values, max_value=nil)
- max_value = values.max unless max_value
- values.inject("") { |sum, v|
- if max_value == 0
- sum += "0,"
- else
- sum += ( "%.1f" % (v*100/max_value) ) + ","
- end
- }.chomp(",")
- end
-
- def extended_encode(values, max_value)
- max_value = values.max unless max_value
- values.collect { |v|
- if max_value == 0
- @@complex_encoding[0]
- else
- @@complex_encoding[(v * 4095/max_value).to_i]
- end
- }.join('')
- end
-
- def join_encoded_data(encoded_data)
- encoded_data.join((self.data_encoding == :simple or self.data_encoding == :extended) ? "," : "|")
- end
-
- def max_data_value
- @max_data or @data.flatten.max
- end
-
- def max_x_value
- @max_x or x_data.flatten.max
- end
-
- def max_y_value
- @max_y or y_data.flatten.max
- end
-
- def x_data
- @data.collect do |series|
- series.collect { |val| val.first }
- end
- end
-
- def y_data
- @data.collect do |series|
- series.collect { |val| val.last }
- end
- end
- end
-end
View
31 vendor/gems/gchartrb-0.8/lib/google_chart/financial_line_chart.rb
@@ -1,31 +0,0 @@
-require File.dirname(__FILE__) + '/base'
-module GoogleChart
-
- # Generates a Financial Line Chart. This feature is UNDOCUMENTED and EXPERIMENTAL.
- # For a sample usage, visit (right at the bottom) http://24ways.org/2007/tracking-christmas-cheer-with-google-charts
- #
- # ==== Examples
- # flc = GoogleChart::FinancialLineChart.new do |chart|
- # chart.data "", [3,10,20,37,40,25,68,75,89,99], "ff0000"
- # end
- # puts flc.to_url
- #
- class FinancialLineChart < Base
-
- # Specify the
- # * +chart_size+ in WIDTHxHEIGHT format
- # * +chart_title+ as a string
- def initialize(chart_size='100x15', chart_title=nil) # :yield: self
- super(chart_size, chart_title)
- self.chart_type = :lfi
- self.show_legend = false
- yield self if block_given?
- end
-
- def process_data
- join_encoded_data(@data.collect { |series|
- encode_data(series, max_data_value)
- })
- end
- end
-end
View
79 vendor/gems/gchartrb-0.8/lib/google_chart/line_chart.rb
@@ -1,79 +0,0 @@
-require File.dirname(__FILE__) + '/base'
-module GoogleChart
-
- # Generates a Line chart. An option can be passed that allows you to create a Line XY Chart
- #
- # ==== Examples
- #
- # # Line Chart
- # lc = GoogleChart::LineChart.new('320x200', "Line Chart", false)
- # lc.data "Trend 1", [5,4,3,1,3,5,6], '0000ff'
- # lc.data "Trend 2", [1,2,3,4,5,6], '00ff00'
- # lc.data "Trend 3", [6,5,4,3,2,1], 'ff0000'
- # lc.axis :y, :range => [0,6], :color => 'ff00ff', :font_size => 16, :alignment => :center
- # lc.axis :x, :range => [0,6], :color => '00ffff', :font_size => 16, :alignment => :center
- #
- # # Line XY Chart
- # lcxy = GoogleChart::LineChart.new('320x200', "Line XY Chart", true)
- # lcxy.data "Trend 1", [[1,1], [2,2], [3,3], [4,4]], '0000ff'
- # lcxy.data "Trend 2", [[4,5], [2,2], [1,1], [3,4]], '00ff00'
- # puts lcxy.to_url
- class LineChart < Base
- attr_accessor :is_xy
-
- # Specify the
- # * +chart_size+ in WIDTHxHEIGHT format
- # * +chart_title+ as a string
- # * +is_xy+ is <tt>false</tt> by default. Set it to <tt>true</tt> if you want to plot a Line XY chart
- def initialize(chart_size='300x200', chart_title=nil, is_xy=false) # :yield: self
- super(chart_size, chart_title)
- self.is_xy = is_xy
- @line_styles = []
- yield self if block_given?
- end
-
- # Pass in <tt>true</tt> here to create a Line XY.
- #
- # Note: This must be done before passing in any data to the chart
- def is_xy=(value)
- @is_xy = value
- if value
- self.chart_type = :lxy
- else
- self.chart_type = :lc
- end
- end
-
- # Defines a line style. Applicable for line charts.
- # [+data_set_index+] Can be one of <tt>:background</tt> or <tt>:chart</tt> depending on the kind of fill requested
- # [+options+] : Options for the style, specifying things like line thickness and lengths of the line segment and blank portions
- #
- # ==== Options
- # * <tt>:line_thickness</tt> (mandatory) option which specifies the thickness of the line segment in pixels
- # * <tt>:length_segment</tt>, which specifies the length of the line segment
- # * <tt>:length_blank</tt>, which specifies the lenght of the blank segment
- def line_style(data_set_index, options={})
- @line_styles[data_set_index] = "#{options[:line_thickness]}"
- @line_styles[data_set_index] += ",#{options[:length_segment]},#{options[:length_blank]}" if options[:length_segment]
- end
-
- def process_data
- if self.is_xy or @data.size > 1
- if self.is_xy # XY Line graph data series
- encoded_data = []
- @data.size.times { |i|
- # Interleave X and Y co-ordinate data
- encoded_data << join_encoded_data([encode_data(x_data[i],max_x_value), encode_data(y_data[i],max_y_value)])
- }
- join_encoded_data(encoded_data)
- else # Line graph multiple data series
- join_encoded_data(@data.collect { |series|
- encode_data(series, max_data_value)
- })
- end
- else
- encode_data(@data.flatten, max_data_value)
- end
- end
- end
-end
View
33 vendor/gems/gchartrb-0.8/lib/google_chart/pie_chart.rb
@@ -1,33 +0,0 @@
-require File.dirname(__FILE__) + '/base'
-module GoogleChart
- class PieChart < Base
-
- # set to <tt>true</tt> or <tt>false</tt> to indicate if this is a 3d chart
- attr_accessor :is_3d
-
- # set to <tt>true</tt> or <tt>false</tt> to show or hide pie chart labels
- attr_accessor :show_labels
-
- # Initializes a Pie Chart object with a +chart_size+ and +chart_title+. Specify <tt>is_3d</tt> as +true+ to generate a 3D Pie chart
- def initialize(chart_size='300x200', chart_title=nil, is_3d = false) # :yield: self
- super(chart_size, chart_title)
- self.is_3d = is_3d
- self.show_legend = false
- self.show_labels = true
- yield self if block_given?
- end
-
- # Set this value to <tt>true</tt> if you want the Pie Chart to be rendered as a 3D image
- def is_3d=(value)
- if value
- self.chart_type = :p3
- else
- self.chart_type = :p
- end
- end
-
- def process_data
- encode_data(@data, max_data_value)
- end
- end
-end
View
38 vendor/gems/gchartrb-0.8/lib/google_chart/scatter_chart.rb
@@ -1,38 +0,0 @@
-require File.dirname(__FILE__) + '/base'
-module GoogleChart
-
- # Generates a Scatter chart.
- #
- # ==== Example
- # sc = GoogleChart::ScatterChart.new('320x200',"Scatter Chart")
- # sc.data "Scatter Set", [[1,1,], [2,2], [3,3], [4,4]]
- # sc.point_sizes [10,15,30,55]
- # puts sc.to_url
- class ScatterChart < Base
-
- # Initializes the Scatter Chart with a +chart_size+ (in WIDTHxHEIGHT format) and a +chart_title+
- def initialize(chart_size='300x200', chart_title=nil) # :yield: self
- super(chart_size, chart_title)
- self.chart_type = :s
- self.show_legend = false
- @point_sizes = []
- yield self if block_given?
- end
-
- def process_data
- # Interleave X and Y co-ordinate data
- encoded_data = join_encoded_data([encode_data(x_data[0],max_x_value), encode_data(y_data[0],max_y_value)])
- # Add point sizes data if it exists
- unless @point_sizes.empty?
- encoded_data = join_encoded_data([encoded_data, encode_data(@point_sizes)])
- end
- return encoded_data
- end
-
- # Specify the data point sizes of the Scatter chart (optional). The data point sizes are scaled with this data set.
- def point_sizes(values)
- @point_sizes = values
- end
-
- end
-end
View
36 vendor/gems/gchartrb-0.8/lib/google_chart/venn_diagram.rb
@@ -1,36 +0,0 @@
-require File.dirname(__FILE__) + '/base'
-module GoogleChart
- # Generates a Venn Diagram.
- #
- # Supply three vd.data statements of label, size, color for circles A, B, C. Then, intersections with four values:
- # * the first value specifies the area of A intersecting B
- # * the second value specifies the area of B intersecting C
- # * the third value specifies the area of C intersecting A
- # * the fourth value specifies the area of A intersecting B intersecting C
- #
- # vd = GoogleChart::VennDiagram.new("320x200", 'Venn Diagram')
- # vd.data "Blue", 100, '0000ff'
- # vd.data "Green", 80, '00ff00'
- # vd.data "Red", 60, 'ff0000'
- # vd.intersections 30,30,30,10
- # puts vd.to_url
- class VennDiagram < Base
-
- # Initializes the Venn Diagram with a +chart_size+ (in WIDTHxHEIGHT format) and a +chart_title+
- def initialize(chart_size='300x200', chart_title=nil) # :yield: self
- super(chart_size, chart_title)
- self.chart_type = :v
- @intersections = []
- yield self if block_given?
- end
-
- def process_data
- encode_data(@data + @intersections)
- end
-
- # Specify the intersections of the circles in the Venn Diagram. See the Rdoc for class for sample
- def intersections(*values)
- @intersections = values
- end
- end
-end
View
202 vendor/gems/gchartrb-0.8/lib/test.rb
@@ -1,202 +0,0 @@
-require 'google_chart'
-
-# Pie Chart
-GoogleChart::PieChart.new('320x200', "Pie Chart",false) do |pc|
- pc.data "Apples", 40
- pc.data "Banana", 20
- pc.data "Peach", 30
- pc.data "Orange", 60
- puts "\nPie Chart"
- puts pc.to_url
-
- # Pie Chart with no labels
- pc.show_labels = false
- puts "\nPie Chart (with no labels)"
- puts pc.to_url
-end
-
-
-# Line Chart
-GoogleChart::LineChart.new('320x200', "Line Chart", false) do |lc|
- lc.data "Trend 1", [5,4,3,1,3,5,6], '0000ff'
- lc.show_legend = true
- lc.data "Trend 2", [1,2,3,4,5,6], '00ff00'
- lc.data "Trend 3", [6,5,4,3,2,1], 'ff0000'
- lc.axis :y, :range => [0,6], :color => 'ff00ff', :font_size => 16, :alignment => :center
- lc.axis :x, :range => [0,6], :color => '00ffff', :font_size => 16, :alignment => :center
- lc.grid :x_step => 100.0/6.0, :y_step => 100.0/6.0, :length_segment => 1, :length_blank => 0
- puts "\nLine Chart"
- puts lc.to_url
-end
-
-# Bar Chart
-GoogleChart::BarChart.new('800x200', "Bar Chart", :vertical, false) do |bc|
- bc.data "Trend 1", [5,4,3,1,3,5], '0000ff'
- bc.data "Trend 2", [1,2,3,4,5,6], 'ff0000'
- bc.data "Trend 3", [6,5,4,4,5,6], '00ff00'
- bc.width_spacing_options :bar_width => 5, :bar_spacing => 2, :group_spacing => 10
- puts "\nBar Chart"
- puts bc.to_url
-end
-
-# Line XY Chart
-line_chart_xy = GoogleChart::LineChart.new('320x200', "Line XY Chart", true) do |lcxy|
- lcxy.data "Trend 1", [[1,1], [2,2], [3,3], [4,4]], '0000ff'
- lcxy.data "Trend 2", [[4,5], [2,2], [1,1], [3,4]], '00ff00'
- puts "\nLine XY Chart (inside a block)"
- puts lcxy.to_url
-end
-
-# Venn Diagram
-# Supply three vd.data statements of label, size, color for circles A, B, C
-# Then, an :intersections with four values:
-# the first value specifies the area of A intersecting B
-# the second value specifies the area of B intersecting C
-# the third value specifies the area of C intersecting A
-# the fourth value specifies the area of A intersecting B intersecting C
-GoogleChart::VennDiagram.new("320x200", 'Venn Diagram') do |vd|
- vd.data "Blue", 100, '0000ff'
- vd.data "Green", 80, '00ff00'
- vd.data "Red", 60, 'ff0000'
- vd.intersections 30,30,30,10
- puts "\nVenn Diagram"
- puts vd.to_url
-end
-
-# Scatter Chart
-GoogleChart::ScatterChart.new('320x200',"Scatter Chart") do |sc|
- sc.data "Scatter Set", [[1,1,], [2,2], [3,3], [4,4]]
- sc.max_value [5,5] # Setting the max value
- sc.axis :x, :range => [0,5]
- sc.axis :y, :range => [0,5], :labels => [0,1,2,3,4,5]
- sc.point_sizes [10,15,30,55] # Optional
- puts "\nScatter Chart"
- puts sc.to_url
-end
-
-# Grid Fills
-GoogleChart::LineChart.new('320x200', "Line Chart", false) do |lc|
- lc.data "Trend 1", [5,4,3,1,3,5,6], '0000ff'
- lc.show_legend = true
- lc.data "Trend 2", [1,2,3,4,5,6], '00ff00'
- lc.data "Trend 3", [6,5,4,3,2,1], 'ff0000'
- lc.axis :y, :range => [0,6], :color => 'ff00ff', :font_size => 16, :alignment => :center
- lc.axis :x, :range => [0,6], :color => '00ffff', :font_size => 16, :alignment => :center
- lc.grid :x_step => 100.0/6.0, :y_step => 100.0/6.0, :length_segment => 1, :length_blank => 0
- puts "\nLine Chart"
- puts lc.to_url
-end
-
-# Solid fill
-line_chart_xy.fill(:background, :solid, {:color => 'fff2cc'})
-line_chart_xy.fill(:chart, :solid, {:color => 'ffcccc'})
-puts "\nLine Chart with Solid Fill"
-puts line_chart_xy.to_url
-
-# Gradient fill
-line_chart_xy.fill :background, :gradient, :angle => 0, :color => [['76A4FB',1],['ffffff',0]]
-line_chart_xy.fill :chart, :gradient, :angle => 0, :color => [['76A4FB',1], ['ffffff',0]]
-puts "\nLine Chart with Gradient Fill"
-puts line_chart_xy.to_url
-
-# Stripes Fill
-line_chart_xy.fill :chart, :stripes, :angle => 90, :color => [['76A4FB',0.2], ['ffffff',0.2]]
-puts "\nLine Chart with Stripes Fill"
-puts line_chart_xy.to_url
-
-# Range and Shape Markers
-puts "\nLine Chart with range markers and shape markers"
-GoogleChart::LineChart.new('320x200', "Line Chart", false) do |lc|
- lc.title_color = 'ff00ff'
- lc.data "Trend 1", [5,4,3,1,3,5,6], '0000ff'
- lc.data "Trend 2", [1,2,3,4,5,6], '00ff00'
- lc.data "Trend 3", [6,5,4,3,2,1], 'ff0000'
- lc.max_value 10 # Setting max value for simple line chart
- lc.range_marker :horizontal, :color => 'E5ECF9', :start_point => 0.1, :end_point => 0.5
- lc.range_marker :vertical, :color => 'a0bae9', :start_point => 0.1, :end_point => 0.5
- # Draw an arrow shape marker against lowest value in dataset
- lc.shape_marker :arrow, :color => '000000', :data_set_index => 0, :data_point_index => 3, :pixel_size => 10
- puts lc.to_url
-end
-
-# Bryan Error condition
-lcxy = GoogleChart::LineChart.new('320x200', "Line XY Chart", true)
-lcxy.data 'A', [[0, 32], [1, 15], [2, 23], [3, 18], [4, 41], [5, 53]],'0000ff'
-lcxy.data 'B', [[0, 73], [1, 0], [2, 28], [3, 0], [4, 333], [5, 0]], '00ff00'
-lcxy.data 'C', [[0, 22], [1, 26], [2, 14], [3, 33], [4, 17], [5, 7]], 'ff0000'
-lcxy.data 'D', [[0, 4], [1, 39], [2, 0], [3, 5], [4, 11], [5, 14]], 'cc00ff'
-puts "\nBryan Error Condition"
-puts lcxy.to_url
-
-# Stacked Chart error
-stacked = GoogleChart::BarChart.new('320x200', "Stacked Chart", :vertical, true)
-stacked.data_encoding = :text
-stacked.data "Trend 1", [60,80,20], '0000ff'
-stacked.data "Trend 2", [50,5,100], 'ff0000'
-stacked.axis :y, :range => [0,120]
-stacked.title_color='ff0000'
-stacked.title_font_size=18
-puts "\nStacked Chart with colored title"
-puts stacked.to_url
-
-# Encoding Error (Bar Chart)
-bc = GoogleChart::BarChart.new('800x350', nil, :vertical, true) do |chart|
- chart.data_encoding = :extended
-
- chart.data "2^i", (0..8).to_a.collect{|i| 2**i}, "ff0000"
- chart.data "2.1^i", (0..8).to_a.collect{|i| 2.1**i}, "00ff00"
- chart.data "2.2^i", (0..8).to_a.collect{|i| 2.2**i}, "0000ff"
- max = 2.2**8
-
- chart.show_legend = true
- chart.axis :y, :range => [0,max], :font_size => 16, :alignment => :center
- chart.axis :x, :labels => (0..8).to_a, :font_size => 16, :alignment => :center
-end
-
-puts "\nBar chart encoding error test"
-puts bc.to_url
-
-# Financial Line Chart (Experimental)
-flc = GoogleChart::FinancialLineChart.new do |chart|
- chart.data "", [3,10,20,37,40,25,68,75,89,99], "ff0000"
-end
-puts "\nFinancial Line Chart or Sparklines (EXPERIMENTAL)"
-puts flc.to_url
-
-# Line Style
-lc = GoogleChart::LineChart.new('320x200', "Line Chart", false) do |lc|
- lc.data "Trend 1", [5,4,3,1,3,5], '0000ff'
- lc.data "Trend 2", [1,2,3,4,5,6], '00ff00'
- lc.data "Trend 3", [6,5,4,3,2,1], 'ff0000'
- lc.line_style 0, :length_segment => 3, :length_blank => 2, :line_thickness => 3
- lc.line_style 1, :length_segment => 1, :length_blank => 2, :line_thickness => 1
- lc.line_style 2, :length_segment => 2, :length_blank => 1, :line_thickness => 5
-end
-puts "\nLine Styles"
-puts lc.to_url
-
-puts "\nLine Styles (encoded URL)"
-puts lc.to_escaped_url
-
-# Fill Area (Multiple Datasets)
-lc = GoogleChart::LineChart.new('320x200', "Line Chart", false) do |lc|
- lc.show_legend = false
- lc.data "Trend 1", [5,5,6,5,5], 'ff0000'
- lc.data "Trend 2", [3,3,4,3,3], '00ff00'
- lc.data "Trend 3", [1,1,2,1,1], '0000ff'
- lc.data "Trend 4", [0,0,0,0,0], 'ffffff'
- lc.fill_area '0000ff',2,3
- lc.fill_area '00ff00',1,2
- lc.fill_area 'ff0000',0,1
-end
-puts "\nFill Area (Multiple Datasets)"
-puts lc.to_url
-
-# Fill Area (Single Datasets)
-lc = GoogleChart::LineChart.new('320x200', "Line Chart", false) do |lc|
- lc.show_legend = false
- lc.data "Trend 1", [5,5,6,5,5], 'ff0000'
- lc.fill_area 'cc6633', 0, 0
-end
-puts "\nFill Area (Single Dataset)"
-puts lc.to_url

0 comments on commit 69689e8

Please sign in to comment.