Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gvis

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gvis

  • 2.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Gvis

Gem Version : Latest published version on rubygems.org

Build Status Coverage Status Code Climate Current master branch status

Rails plugin that provides a Ruby wrapper for easily loading the Google Visualization API, and simple generation of the javascript required to plot the graphs For a full list of the graphs provided by google's visualization api see the gallery For documentation on how to use each graph type see google's API documentation

Compatiblity

gvis version 2.x - Rails 3.x compatible (And rails 2.x using rails_xss)

gvis version 1.x - Rails 2.x compatible

Installation

Rails 3:

# Gemfile
gem 'gvis', '>= 2.0.0'

Rails 2.X:

# config/environment.rb
config.gem 'gvis', :version => '< 2.0.0'

Then include the GoogleVisualization module in app/helpers/application_helper.rb

module ApplicationHelper
  include GoogleVisualization
end

Load the API, and render any graphs by placing these methods inside your layout

# app/views/layouts/application.html.erb
<head>
	<%= include_visualization_api %>
	<%= render_visualizations %>
	...
</head>

Example

Render desired graphs in the view like this:

# index.html.erb
<% visualization "my_chart", "MotionChart", :width => 600, :height => 400, :html => {:class => "graph_chart"} do |chart| %>
	<%# Add the columns that the graph will have %>
	<% chart.string "Fruit" %>
	<% chart.date "Date" %>
	<% chart.number "Sales" %>
	<% chart.number "Expenses" %>
	<% chart.string "Location" %>

	<%# Add the data %>
	<% chart.add_rows([
		["Apples", Date.new(1998,1,1), 1000,300,'East'],
		["Oranges", Date.new(1998,1,1), 950,200,'West'],
		["Bananas", Date.new(1998,1,1), 300,250,'West'],
		["Apples", Date.new(1998,2,1), 1200,400,'East'],
		["Oranges", Date.new(1998,2,1), 950,150,'West'],
		["Bananas", Date.new(1998,2,1), 788,617,'West']
	]) %>
<% end %>

Copyright (c) 2009 [Jeremy Olliver], released under the MIT license

FAQs

Package last updated on 24 Sep 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc