This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://code.google.com/apis/visualization/documentation/gallery/scatterchart.html#Example | |
def scatter_chart | |
@chart = GoogleVisualr::ScatterChart.new | |
@chart.add_column('number', 'Age') | |
@chart.add_column('number', 'Weight') | |
@chart.add_rows(6) | |
@chart.set_value( 0, 0, 8 ) | |
@chart.set_value( 0, 1, 12 ) | |
@chart.set_value( 1, 0, 4 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://code.google.com/apis/visualization/documentation/gallery/motionchart.html#Example | |
def motion_chart | |
@chart = GoogleVisualr::MotionChart.new | |
@chart.add_column('string', 'Fruit' ) | |
@chart.add_column('date' , 'Date' ) | |
@chart.add_column('number', 'Sales' ) | |
@chart.add_column('number', 'Expenses') | |
@chart.add_column('string', 'Location') | |
@chart.add_rows([ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://code.google.com/apis/visualization/documentation/gallery/intensitymap.html | |
def intensity_map | |
@chart = GoogleVisualr::IntensityMap.new | |
@chart.add_column('string', '', 'Country') | |
@chart.add_column('number', 'Population (mil)', 'a') | |
@chart.add_column('number', 'Area (km2)' , 'b') | |
@chart.add_rows(5) | |
@chart.set_value(0, 0, 'CN') | |
@chart.set_value(0, 1, 1324) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://code.google.com/apis/visualization/documentation/gallery/map.html | |
def map | |
@chart = GoogleVisualr::Map.new | |
@chart.add_column('number', 'Lat' ) | |
@chart.add_column('number', 'Lon' ) | |
@chart.add_column('string', 'Name') | |
@chart.add_rows(4) | |
@chart.set_cell(0, 0, 37.4232 ) | |
@chart.set_cell(0, 1, -122.0853 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################## | |
# Table with Arrow Formatter | |
@chart = GoogleVisualr::Table.new | |
@chart.add_column('string', 'Department' ) | |
@chart.add_column('number', 'Revenues Change' ) | |
@chart.add_rows([ | |
['Shoes' , { :v => 12 , :f => '12.0%' }], | |
['Sports' , { :v => -7.3 , :f => '-7.3%' }], | |
['Toys' , { :v => 0 , :f => '0%' }], | |
['Electronics', { :v => -2.1 , :f => '-2.1%' }], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id='chart'></div> | |
<%= @chart.render('chart') %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src='http://www.google.com/jsapi'></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://code.google.com/apis/visualization/documentation/gallery/geomap.html#Example | |
def geomap | |
# Regions Example | |
@chart_regions = GoogleVisualr::GeoMap.new | |
@chart_regions.add_column('string' , 'Country' ) | |
@chart_regions.add_column('number' , 'Popularity') | |
@chart_regions.add_rows(6) | |
@chart_regions.set_value(0, 0, 'Germany' ); | |
@chart_regions.set_value(0, 1, 200); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://code.google.com/apis/chart/interactive/docs/gallery/imagesparkline.html#Example | |
def spark_line | |
data_table = GoogleVisualr::DataTable.new | |
data_table.new_column("number", "Revenue" ) | |
data_table.new_column("number", "Licenses") | |
data_table.add_rows(10) | |
data_table.set_cell(0,0,435) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://code.google.com/apis/chart/interactive/docs/gallery/annotatedtimeline.html#Example | |
def annotated_time_line | |
data_table = GoogleVisualr::DataTable.new | |
data_table.new_column('date' , 'Date') | |
data_table.new_column('number', 'Sold Pencils') | |
data_table.new_column('string', 'title1') | |
data_table.new_column('string', 'text1' ) | |
data_table.new_column('number', 'Sold Pens' ) | |
data_table.new_column('string', 'title2') |