source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/layout/pack.rb
Ruby
bsd-2-clause
241
master
9,374
module Rubyvis class Layout # Alias for Rubyvis::Layout::Indent def self.Pack Rubyvis::Layout::Pack end # Implements a hierarchical layout using circle-packing. The meaning of # the exported mark prototypes changes slightly in the space-filling # implementation:<ul> # # <li><tt>...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/layout/stack.rb
Ruby
bsd-2-clause
241
master
9,856
module Rubyvis class Layout # Alias for Rubyvis::Layout::Stack def self.Stack Rubyvis::Layout::Stack end # Implements a layout for stacked visualizations, ranging from simple # stacked bar charts to more elaborate "streamgraphs" composed of stacked # areas. Stack layouts uses lengt...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/layout/grid.rb
Ruby
bsd-2-clause
241
master
3,552
module Rubyvis class Layout # Alias for Rubyvis::Layout::Grid def self.Grid Rubyvis::Layout::Grid end # Implements a grid layout with regularly-sized rows and columns. The # number of rows and columns are determined from their respective # properties. For example, the 2&times;3 arr...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/layout/indent.rb
Ruby
bsd-2-clause
241
master
2,793
module Rubyvis class Layout # Alias for Rubyvis::Layout::Indent def self.Indent Rubyvis::Layout::Indent end # Implements a hierarchical layout using the indent algorithm. This # layout implements a node-link diagram where the nodes are presented in # preorder traversal, and nodes are in...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/layout/partition.rb
Ruby
bsd-2-clause
241
master
8,061
module Rubyvis class Layout # Alias for Rubyvis::Layout::Partition def self.Partition Rubyvis::Layout::Partition end # Implemeents a hierarchical layout using the partition (or sunburst, # icicle) algorithm. This layout provides both node-link and space-filling # implementations of parti...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/layout/hierarchy.rb
Ruby
bsd-2-clause
241
master
7,816
module Rubyvis class Layout # Alias for Rubyvis::Layout::Hierarchy def self.Hierarchy Rubyvis::Layout::Hierarchy end # Represents an abstract layout for hierarchy diagrams. This class is a # specialization of Rubyvis::Layout::Network, providing the basic structure # for both hierarchical...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/layout/cluster.rb
Ruby
bsd-2-clause
241
master
7,367
module Rubyvis class Layout # Alias for Rubyvis::Layout::Cluster def self.Cluster Rubyvis::Layout::Cluster end # Implements a hierarchical layout using the cluster (or dendrogram) # algorithm. This layout provides both node-link and space-filling # implementations of cluster diagrams. I...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/layout/tree.rb
Ruby
bsd-2-clause
241
master
7,770
module Rubyvis class Layout # Alias for Rubyvis::Layout::Tree def self.Tree Rubyvis::Layout::Tree end # Implements a node-link tree diagram using the Reingold-Tilford "tidy" # tree layout algorithm. The specific algorithm used by this layout is based on # <a href="http://citeseer.ist.ps...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/layout/network.rb
Ruby
bsd-2-clause
241
master
13,435
module Rubyvis class Layout # Alias for Rubyvis::Layout::Network def self.Network Rubyvis::Layout::Network end # Represents an abstract layout for network diagrams. This class # provides the basic structure for both node-link diagrams (such as # force-directed graph layout) and space-f...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/layout/horizon.rb
Ruby
bsd-2-clause
241
master
6,042
module Rubyvis class Layout # Alias for Rubyvis::Layout::Horizon def self.Horizon Rubyvis::Layout::Horizon end # Implements a horizon layout, which is a variation of a single-series # area chart where the area is folded into multiple bands. Color is used to # encode band, allowing t...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/scene/svg_panel.rb
Ruby
bsd-2-clause
241
master
4,637
module Rubyvis module SvgScene def self.panel(scenes) puts " -> panel: #{scenes.inspect}" if $DEBUG g=scenes._g #e=(g.nil?) ? nil : g.elements[1] e=(g.nil?) ? nil : g.get_element(1) if g #e=g.elements[1] e=g.get_element(1) end scenes.each_with_index do |s...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/scene/svg_image.rb
Ruby
bsd-2-clause
241
master
733
module Rubyvis module SvgScene def self.image(scenes) #e=scenes._g.elements[1] e=scenes._g.get_element(1) scenes.each_with_index do |s,i| next unless s.visible e=self.fill(e,scenes,i) if s.image raise "Not implemented yet" else e = self.expect(...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/scene/svg_label.rb
Ruby
bsd-2-clause
241
master
1,890
module Rubyvis module SvgScene def self.label(scenes) #e=scenes._g.elements[1] e=scenes._g.get_element(1) scenes.each_with_index do |s,i| next unless s.visible fill=s.text_style next if(fill.opacity==0 or s.text.nil?) x=0 y=0 dy=0 anchor='s...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/scene/svg_dot.rb
Ruby
bsd-2-clause
241
master
2,090
module Rubyvis module SvgScene def self.dot(scenes) #e = scenes._g.elements[1] e=scenes._g.get_element(1) scenes.each_with_index {|s,i| s = scenes[i]; # visible */ next if !s.visible fill = s.fill_style stroke = s.stroke_style next if (fill.opacity==0 a...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/scene/svg_scene.rb
Ruby
bsd-2-clause
241
master
5,501
require 'rubyvis/scene/svg_panel' require 'rubyvis/scene/svg_bar' require 'rubyvis/scene/svg_rule' require 'rubyvis/scene/svg_label' require 'rubyvis/scene/svg_line' require 'rubyvis/scene/svg_dot' require 'rubyvis/scene/svg_area' require 'rubyvis/scene/svg_wedge' require 'rubyvis/scene/svg_image' require 'rubyvis/scen...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/scene/svg_wedge.rb
Ruby
bsd-2-clause
241
master
2,036
module Rubyvis module SvgScene def self.wedge(scenes) #e=scenes._g.elements[1] e=scenes._g.get_element(1) scenes.each_with_index do |s,i| next unless s.visible fill=s.fill_style stroke=s.stroke_style next if(fill.opacity==0.0 and stroke.opacity==0.0) # /* ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/scene/svg_curve.rb
Ruby
bsd-2-clause
241
master
10,060
module Rubyvis::SvgScene class PathBasis #:nodoc: def initialize(p0,p1,p2,p3) @p0=p0 @p1=p1 @p2=p2 @p3=p3 end attr_accessor :p0,:p1,:p2,:p3 # # Matrix to transform basis (b-spline) control points to bezier control # points. Derived from FvD 11.2.8. # d...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/scene/svg_bar.rb
Ruby
bsd-2-clause
241
master
985
module Rubyvis module SvgScene def self.bar(scenes) #e=scenes._g.elements[1] e=scenes._g.get_element(1) scenes.each_with_index do |s,i| next unless s.visible fill=s.fill_style stroke=s.stroke_style next if(fill.opacity==0 and stroke.opacity==0) e=SvgScene....
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/scene/svg_area.rb
Ruby
bsd-2-clause
241
master
6,437
module Rubyvis module SvgScene def self.area(scenes) #e = scenes._g.elements[1] e=scenes._g.get_element(1) return e if scenes.size==0 s=scenes[0] # segmented return self.area_segment(scenes) if (s.segmented) # visible return e if (!s.visible) fill = s.fill_st...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/scene/svg_line.rb
Ruby
bsd-2-clause
241
master
5,890
module Rubyvis module SvgScene def self.line(scenes) #e=scenes._g.elements[1] e=scenes._g.get_element(1) return e if (scenes.size < 2) s = scenes[0] # segmented */ return self.line_segment(scenes) if (s.segmented) #/* visible */ return e if (!s.visible) fill ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/scene/svg_rule.rb
Ruby
bsd-2-clause
241
master
764
module Rubyvis module SvgScene def self.rule(scenes) #e=scenes._g.elements[1] e=scenes._g.get_element(1) scenes.each_with_index do |s,i| next unless s.visible stroke=s.stroke_style next if(stroke.opacity==0.0) e=SvgScene.expect(e,'line', { "shape-renderi...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/mark/anchor.rb
Ruby
bsd-2-clause
241
master
3,446
module Rubyvis # Alias por Rubyvis::Anchor.new(target) def self.Anchor(target) Rubyvis::Anchor.new(target) end # Represents an anchor on a given mark. An anchor is itself a mark, but # without a visual representation. It serves only to provide useful default # properties that can be inherited by other m...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/mark/shorcut_methods.rb
Ruby
bsd-2-clause
241
master
10,043
class Rubyvis::Mark ## # :section: RBP Api ## # Create a new Mark method shorcut. def self.mark_method(name, mark) #:nodoc: define_method(name) do |*args,&block| opts=args[0] opts||=Hash.new if opts[:anchor] base=anchor(opts[:anchor]) else base=self end ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/mark/bar.rb
Ruby
bsd-2-clause
241
master
2,709
module Rubyvis # Alias for Rubyvis::Bar def self.Bar Rubyvis::Bar end # Represents a bar: an axis-aligned rectangle that can be stroked and # filled. Bars are used for many chart types, including bar charts, histograms # and Gantt charts. Bars can also be used as decorations, for example to draw a ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/mark/wedge.rb
Ruby
bsd-2-clause
241
master
4,280
module Rubyvis # Alias for Rubyvis::Wedge def self.Wedge Rubyvis::Wedge end class Wedge < Mark def type "wedge" end @properties=Mark.properties.dup attr_accessor_dsl :start_angle, :end_angle, :angle, :inner_radius, :outer_radius, :line_width, [:stroke_style, lambda {|d| Rubyvis.co...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/mark/dot.rb
Ruby
bsd-2-clause
241
master
5,697
module Rubyvis # Alias por Rubyvis::Dot def self.Dot Rubyvis::Dot end # Represents a dot; a dot is simply a sized glyph centered at a given # point that can also be stroked and filled. The <tt>size</tt> property is # proportional to the area of the rendered glyph to encourage meaningful visual # encod...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/mark/label.rb
Ruby
bsd-2-clause
241
master
4,247
module Rubyvis # Alias for Rubyvis::Label def self.Label Rubyvis::Label end # Represents a text label, allowing textual annotation of other marks or # arbitrary text within the visualization. The character data must be plain # text (unicode), though the text can be styled using the {@link #font} # pro...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/mark/image.rb
Ruby
bsd-2-clause
241
master
3,268
module Rubyvis def self.Image Rubyvis::Image end class Image < Bar def type "image" end @properties=Bar.properties.dup attr_accessor :_image def initialize(opts=Hash.new) super(opts) @_image=nil end ## # :attr: url # The URL of the image to display. The se...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/mark/line.rb
Ruby
bsd-2-clause
241
master
6,521
module Rubyvis # Alias for Rubyvis::Line def self.Line Rubyvis::Line end # Provides methods pertinents to line like marks. module LinePrototype # :nodoc: include AreaPrototype def line_anchor(name) anchor=area_anchor(name).text_align(lambda {|d| {'left'=>'right', 'bottom'...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/mark/rule.rb
Ruby
bsd-2-clause
241
master
783
module Rubyvis # Alias for Rubyvis::Rule def self.Rule Rubyvis::Rule end class Rule < Mark include LinePrototype @properties=Mark.properties.dup attr_accessor_dsl :width, :height, :line_width, [:stroke_style, lambda {|d| Rubyvis.color(d)}], :stroke_dasharray def self.defaults Rule.new....
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/mark/area.rb
Ruby
bsd-2-clause
241
master
7,258
module Rubyvis # Alias for Rubyvis::Area def self.Area Rubyvis::Area end # Provides methods pertinents to area like-marks. module AreaPrototype # :nodoc: def fixed { :line_width=> true, :line_join=> true, :stroke_style=> true, :fill_style=> true, :segment...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/mark/panel.rb
Ruby
bsd-2-clause
241
master
3,292
module Rubyvis # Alias for Rubyvis::Panel def self.Panel Rubyvis::Panel end class Panel < Bar def type "panel" end @properties=Bar.properties.dup attr_accessor_dsl :transform, :overflow, :canvas, :view_box attr_accessor :children, :root def initialize @children=[] ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/format/number.rb
Ruby
bsd-2-clause
241
master
3,356
module Rubyvis module Format class Number def initialize @mini = 0 @maxi = Infinity # default maximum integer digits @mins = 0.0 # mini, including group separators @minf = 0.0 # default minimum fraction digits @maxf = 0.0 # default maximum fraction digits @max...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
lib/rubyvis/format/date.rb
Ruby
bsd-2-clause
241
master
532
require 'date' module Rubyvis module Format class Date attr_reader :pattern def initialize(pattern) @pattern=pattern #@pad=Rubyvis::Format.pad end def format(d) d.strftime(pattern) end def format_lambda pat=pattern lambda {|d| ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/rule_spec.rb
Ruby
bsd-2-clause
241
master
1,127
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Rule do include Rubyvis::GeneralSpec it "should have correct properties" do props=[:antialias, :bottom, :cursor, :data, :events, :height, :id, :left, :line_width, :reverse, :right, :stroke_style, :stroke_dasharray, :title, :to...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/area_spec.rb
Ruby
bsd-2-clause
241
master
6,360
require File.expand_path(File.dirname(__FILE__)+"/../lib/rspec/expectations/differ.rb") require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Area do include Rubyvis::GeneralSpec it "should have correct properties" do props=[:antialias, :bottom, :cursor, :data, :events, :fill_styl...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/javascript_behaviour_spec.rb
Ruby
bsd-2-clause
241
master
2,308
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe "Javascript compatibility" do it "extends Proc with js_apply and js_call" do f=lambda {|a,b| a+b} expect(f).to respond_to(:js_apply) expect(f).to respond_to(:js_call) end it "lambdas should respond correctly to js_call with sa...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/dom_spec.rb
Ruby
bsd-2-clause
241
master
6,603
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Dom do it "should map correctly" do map={ :a=>{:aa=>1, :ab=>{:aba=>2} }, :b=>4, :c=>{:ca=>5} } dom_map=Rubyvis::Dom.new(map) root=dom_map.root.sort {|a,b| a.node_name...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/scale_linear_spec.rb
Ruby
bsd-2-clause
241
master
4,853
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Scale::Linear do if Rubyvis::JohnsonLoader.available? context "direct protovis API comparison" do before(:all) do @rt= Rubyvis::JohnsonLoader.new().runtime end before do @h=280 @h_dom=...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/scale_spec.rb
Ruby
bsd-2-clause
241
master
256
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Scale do it "should return a correct numeric interpolator" do i=Rubyvis::Scale.interpolator(0,20) expect(i[10]).to eq(200) expect(i[20]).to eq(400) end end
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/mark_spec.rb
Ruby
bsd-2-clause
241
master
790
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Mark do it "should have correct properties" do props=[:antialias, :bottom, :cursor, :data, :events, :id, :left, :reverse, :right, :title, :top, :visible].inject({}) {|ac, v| ac[v]=true; ac} expect(Rubyvis::Mark.properties).to...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/layout_indent_spec.rb
Ruby
bsd-2-clause
241
master
1,615
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Layout::Indent do include Rubyvis::LayoutSpec it "should have correct properties" do props=[:antialias, :bottom, :breadth, :canvas, :cursor, :data, :depth, :events, :fill_style, :height, :id, :left, :line_width, :links, :nodes...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/layout_horizon_spec.rb
Ruby
bsd-2-clause
241
master
2,053
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Layout::Horizon do include Rubyvis::LayoutSpec it "should have correct properties" do props=[:antialias, :background_style, :bands, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :left, :line_width, :...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/vector_spec.rb
Ruby
bsd-2-clause
241
master
1,033
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Vector do before do @x1,@x2,@y1,@y2=rand(10)+1,rand(10)+1,rand(10)+1,rand(10)+1 @v1=Rubyvis::Vector.new(@x1,@y1) @v2=Rubyvis::Vector.new(@x2,@y2) end it "should return the same as Rubyvis.vector" do expect(Rubyvis...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/scale_log_spec.rb
Ruby
bsd-2-clause
241
master
3,884
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Scale::Log do if Rubyvis::JohnsonLoader.available? context "direct protovis API comparison" do before(:all) do @rt= Rubyvis::JohnsonLoader.new("/data/LogScale.js").runtime end before do @h=280...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/wedge_spec.rb
Ruby
bsd-2-clause
241
master
1,908
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Wedge do include Rubyvis::GeneralSpec it "should have correct properties" do props=[:angle, :antialias, :bottom, :cursor, :data, :end_angle, :events, :fill_style, :id, :inner_radius, :left, :line_width, :outer_radius, :reverse...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/nest_spec.rb
Ruby
bsd-2-clause
241
master
1,838
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Nest do before do @data=[ { :year=>2010, :city=>'London',:value=>1}, { :year=>2010, :city=>'France',:value=>2}, { :year=>2011, :city=>'London',:value=>5}, { :year=>2011, :city=>'France',:value=>6}, ] end it ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/scale_ordinal_spec.rb
Ruby
bsd-2-clause
241
master
3,000
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Scale::Ordinal do if Rubyvis::JohnsonLoader.available? context "direct protovis API comparison" do before(:all) do @rt= Rubyvis::JohnsonLoader.new("/data/OrdinalScale.js").runtime end before do ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/spec_helper.rb
Ruby
bsd-2-clause
241
master
7,284
$:.unshift(File.dirname(__FILE__)+"/../lib") begin require 'simplecov' SimpleCov.start do add_filter "/spec/" add_group "Libraries", "lib" end rescue LoadError end require 'rspec' require 'rspec/mocks' #require 'spec/autorun' require 'rubyvis' require 'pp' require 'nokogiri' RSpec::Expectations.configura...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/anchor_spec.rb
Ruby
bsd-2-clause
241
master
4,375
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Anchor do include Rubyvis::GeneralSpec it "should have correct properties" do props=[:antialias, :bottom, :cursor, :data, :events, :id, :left, :name, :reverse, :right, :title, :top, :visible].inject({}) {|ac, v| ac[v]=true...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/layout_tree_spec.rb
Ruby
bsd-2-clause
241
master
1,978
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Layout::Treemap do include Rubyvis::LayoutSpec it "should have correct properties" do props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :left, :line_width, :links, :mode, :nodes, :order, :...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/scale_linear_datetime_spec.rb
Ruby
bsd-2-clause
241
master
2,335
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe "Rubyvis::Scale::Linear with dates" do it "should be created as Javascript" do h=280 y = Rubyvis.Scale.linear(Time.utc(2010,1,1), Time.utc(2010,2,1)) end before do @bd=Time.utc(2010,1,1) @ed=Time.utc(2010,2,1) ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/layout_arc_spec.rb
Ruby
bsd-2-clause
241
master
2,120
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Layout::Arc do include Rubyvis::LayoutSpec it "should have correct properties" do props=[:antialias, :bottom, :canvas, :cursor, :data, :directed, :events, :fill_style, :height, :id, :left, :line_width, :links, :nodes, :orient, ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/layout_matrix_spec.rb
Ruby
bsd-2-clause
241
master
1,772
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Layout::Matrix do include Rubyvis::LayoutSpec it "should have correct properties" do props=[:antialias, :bottom, :canvas, :cursor, :data, :directed, :events, :fill_style, :height, :id, :left, :line_width, :links, :nodes, :ov...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/dot_spec.rb
Ruby
bsd-2-clause
241
master
1,314
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Dot do include Rubyvis::GeneralSpec it "should have correct properties" do props=[:antialias, :bottom, :cursor, :data, :events, :fill_style, :id, :left, :line_width, :reverse, :right, :shape, :shape_angle, :shape_radius, :...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/internal_spec.rb
Ruby
bsd-2-clause
241
master
6,592
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe "Rubyvis module methods" do describe "from pv.js" do it "method identify should always return the same value" do f=Rubyvis.identity a="a" expect(f.js_call(a, 5)).to eq(5) end it "method index should return index ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/layout_partition_spec.rb
Ruby
bsd-2-clause
241
master
1,454
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Layout::Partition do include Rubyvis::LayoutSpec it "subclass Fill should have correct properties" do props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :inner_radius, :left, :line_width, :...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/label_spec.rb
Ruby
bsd-2-clause
241
master
1,968
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Label do it "should have correct properties" do props=[:antialias, :bottom, :cursor, :data, :events, :font, :font_family, :font_style, :font_variant, :font_weight, :font_size, :id, :left, :reverse, :right, :text, :text_align, :...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/layout_cluster_spec.rb
Ruby
bsd-2-clause
241
master
1,889
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Layout::Cluster do include Rubyvis::LayoutSpec it "should have correct properties" do props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style,:group, :height, :id, :inner_radius, :left, :line_width, :links, ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/layout_grid_spec.rb
Ruby
bsd-2-clause
241
master
1,322
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Layout::Grid do include Rubyvis::LayoutSpec it "should have correct properties" do props=[:antialias, :bottom, :canvas, :cols, :cursor, :data, :events, :fill_style, :height, :id, :left, :line_width, :overflow, :reverse, :right...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/flatten_spec.rb
Ruby
bsd-2-clause
241
master
2,260
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Flatten do before do @data={ "Genesis"=>{ "Live"=>{ "Genesis Live"=>1973, "Seconds Out"=>1977 }, "Studio"=>{ "Nursery Cryme"=>1971, "Foxtrot"=>1972 } ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/layout_treemap_spec.rb
Ruby
bsd-2-clause
241
master
1,305
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Layout::Treemap do include Rubyvis::LayoutSpec it "should have correct properties" do props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :left, :line_width, :links, :mode, :nodes, :order, :...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/panel_spec.rb
Ruby
bsd-2-clause
241
master
1,805
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Panel do before do @h=200 @w=200 @vis = Rubyvis.Panel.new.width(@w).height(@h).view_box("0 0 #{@w} #{@h}") end it "should have correct properties" do props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/layout_stack_spec.rb
Ruby
bsd-2-clause
241
master
5,280
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Layout::Stack do include Rubyvis::LayoutSpec it "should have correct properties" do props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :layers, :left, :line_width, :offset, :order, :orient,...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/readme_spec.rb
Ruby
bsd-2-clause
241
master
865
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe "Rubyvis Readme" do it "should work with RBP API" do vis=nil expect { vis = Rubyvis::Panel.new do width 150 height 150 bar do data [1, 1.2, 1.7, 1.5, 0.7, 0.3] width 20 height {|d| d * 80...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/bar_spec.rb
Ruby
bsd-2-clause
241
master
2,988
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Bar do it "should have correct properties" do props=[:antialias, :bottom, :cursor, :data, :events, :fill_style, :height, :id, :left, :line_width, :reverse, :right, :stroke_style, :title, :top, :visible, :width].inject({}) {|ac,...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/layout_pack_spec.rb
Ruby
bsd-2-clause
241
master
1,423
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Layout::Pack do include Rubyvis::LayoutSpec it "should have correct properties" do props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :left, :line_width, :links, :nodes, :order, :overflow...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/line_spec.rb
Ruby
bsd-2-clause
241
master
7,847
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Line do include Rubyvis::GeneralSpec it "should have correct properties" do props=[:antialias, :bottom, :cursor, :data, :eccentricity, :events, :fill_style, :id, :interpolate, :left, :line_join, :line_width, :reverse, :right, :...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/color_spec.rb
Ruby
bsd-2-clause
241
master
3,912
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe "Rubyvis color methods" do it "should return correct Rubyvis.ramp" do a=Rubyvis.ramp("white","red") expect(a[0]).to eq Rubyvis.color("rgb(255,255,255)") expect(a[0.5]).to eq Rubyvis.color("rgb(255,128,128)") expect(a[1]).to eq...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/histogram_spec.rb
Ruby
bsd-2-clause
241
master
900
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Histogram do describe "bins" do before do data = Rubyvis.range(0, 10, 0.1).map {|x| Math.sin(x) } @hist=Rubyvis::Histogram.new(data) @bins=@hist.bins end it "size should be correct" do ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/issue_22_spec.rb
Ruby
bsd-2-clause
241
master
679
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe "Issue #22 github: Pie chart" do skip "should use bold font" do width=600 height=600 percentages=[10,20,70] radius=10 angle=20 colours="red" labels=%w{a1 a2 a3} vis = Rubyvis::Panel.new.width(width).height...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/image_spec.rb
Ruby
bsd-2-clause
241
master
605
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") describe Rubyvis::Image do include Rubyvis::GeneralSpec it "Rubyvis.Image be the same as Rubyvis::Image" do expect(Rubyvis.Image).to eql Rubyvis::Image end it "should render correctly" do w = 400 h = 400 vis = Rubyvis::...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
spec/ruby_api_spec.rb
Ruby
bsd-2-clause
241
master
1,419
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") shared_examples_for "Ruby API for Rubyvis" do before do @h=200 @w=200 end it "should create a Panel with a block" do expect {@vis = Rubyvis.Panel.new { width @w height @h } }.not_to raise_exception expect(@vis._...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/1_basic/image.rb
Ruby
bsd-2-clause
241
master
388
# = Image # This example shows how to include an image $:.unshift(File.dirname(__FILE__)+"/../../lib") require 'rubyvis' img_url="fixtures/tipsy.gif" vis = pv.Panel.new().width(200).height(200); dot=vis.add(pv.Image) .data([1,2,3,4,5,6]) .bottom(lambda {|d| d*30}) .left(lambda {|d| d*30} ) .width(9)...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/1_basic/2_bar_and_rule.rb
Ruby
bsd-2-clause
241
master
766
# = Inheritance and labels # Second example of Protovis "Getting Started section" # The rule's label inherits the data and bottom property, causing it to appear on the rule and render the value (datum) as text. The bar’s label uses the bottom anchor to tweak positioning, so that the label is centered at the bottom of t...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/1_basic/line.rb
Ruby
bsd-2-clause
241
master
789
# = Line Chart # This line chart is constructed a Line mark. # The second line, inside the first one, is created using an anchor. $:.unshift(File.dirname(__FILE__)+"/../../lib") require 'rubyvis' data = pv.range(0, 10, 0.1).map {|x| OpenStruct.new({:x=> x, :y=> Math.sin(x) + 2+rand()}) } #p data w = 400 h = 200 x ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/1_basic/1a_bar_rbp_api.rb
Ruby
bsd-2-clause
241
master
672
# = First example (RBP API) # This is the RBP API version of "Getting Started" example of Protovis introduction. # On this example we build a bar chart using panel and bar marks. # A mark represents a set of graphical elements that share data and visual encodings. Although marks are simple by themselves, you can combi...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/1_basic/grid.rb
Ruby
bsd-2-clause
241
master
598
# = Grid # A simple heatmap, using a Bar.fill_style to represent # data $:.unshift(File.dirname(__FILE__)+"/../../lib") require 'rubyvis' w = 400 h = 400 vis = pv.Panel.new() .width(w) .height(h) .bottom(0) .left(0) .right(0) .top(0) arrays=10.times.map {|i| 10.times.map {|j| i.quo(10)+j.quo(100)}} ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/1_basic/area_interpolation.rb
Ruby
bsd-2-clause
241
master
1,320
# = Area Interpolation # This example show the 5 types of interpolation available for areas: # * linear # * step-before # * step-after # * basis # * cardinal # # See also "Line Interpolation":line_interpolation.html $:.unshift(File.dirname(__FILE__)+"/../../lib") require 'rubyvis' data = Rubyvis.range(0, 10, 0.5).map...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/1_basic/dot.rb
Ruby
bsd-2-clause
241
master
502
# = Dot and anchors # This example shows how looks differents positions of anchors on dots $:.unshift(File.dirname(__FILE__)+"/../../lib") require 'rubyvis' vis = pv.Panel.new().width(200).height(200); dot=vis.add(pv.Dot) .data([1,2,3,4,5,6]) .bottom(lambda {|d| d*30}) .left(lambda { 20+index*40} ) .s...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/1_basic/1b_bar_pv_api.rb
Ruby
bsd-2-clause
241
master
682
# = First example (Protovis API) # This is the protovis API version of "Getting Started" example of Protovis introduction. # On this example we build a bar chart using panel and bar marks. # A mark represents a set of graphical elements that share data and visual encodings. Although marks are simple by themselves, you...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/1_basic/3_grouped_bars.rb
Ruby
bsd-2-clause
241
master
663
# = Using parent # This example shows how to group bars on groups and use the parent property to identify and color them $:.unshift(File.dirname(__FILE__)+"/../../lib") require 'rubyvis' vis = pv.Panel.new().width(200).height(150); bar= vis.add(pv.Panel).data(["a","b","c","d"]).add(pv.Bar) .data([1,2]) .width...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/1_basic/line_interpolation.rb
Ruby
bsd-2-clause
241
master
1,229
# = Line Interpolation # This example show the 7 types of interpolation available for lines: # * linear # * step-before # * step-after # * polar # * polar-reverse # * basis # * cardinal # # See also "Area Interpolation":area_interpolation.html $:.unshift(File.dirname(__FILE__)+"/../../lib") require 'rubyvis' data = p...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/2_medium/nested_grid.rb
Ruby
bsd-2-clause
241
master
1,191
# = Nested grid # Two level nested grid. The first is created at random with n rows and m columns The second level is a 9x9 grid inside the cell of first level # You can obtain the same result using a grid layout $:.unshift(File.dirname(__FILE__)+"/../../lib") require 'rubyvis' w = 600 h = 600 cs=pv.Colors.category2...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/2_medium/horizon.rb
Ruby
bsd-2-clause
241
master
1,434
# = Horizon # Horizon graphs increase data density while preserving resolution. # While horizon graphs may require learning, they have been found to be more effective than standard line and area plots when chart sizes are small. For more, see "Sizing the Horizon: The Effects of Chart Size and Layering on the Graphical...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/2_medium/censo_agropecuario/census_treemap.rb
Ruby
bsd-2-clause
241
master
1,640
# encoding: UTF-8 # = Censo Agropecuario 2007, Chile: Treemap # This treemap represents farm explotations on Biobío province, Chile. # Colors represent different 'comunas' and bar inside one color # represent different types of explotation $:.unshift(File.dirname(__FILE__)+"/../../../lib") require 'rubyvis' load(File....
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/2_medium/censo_agropecuario/censo_agropecuario_chile_data.rb
Ruby
bsd-2-clause
241
master
3,985
# encoding: UTF-8 $censo = [ {:glosa=>"Alto Bío-Bío", :te=>1, :superficie=>161659.68, :ovinos=>8092, :bovinos=>7736}, {:glosa=>"Alto Bío-Bío", :te=>2, :superficie=>44214.8, :ovinos=>881, :bovinos=>1327}, {:glosa=>"Alto Bío-Bío", :te=>3, :superficie=>0, :ovinos=>45, :bovinos=>45}, {:glosa=>"Alto Bío-Bío", :te=>5, :super...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/2_medium/censo_agropecuario/create_data.rb
Ruby
bsd-2-clause
241
master
286
require 'statsample' a=Statsample::CSV.read('resultset.csv') File.open("censo_agropecuario_chile_data.rb","w") do |fp| fp.puts "# encoding: UTF-8" fp.puts "$censo = [" a.each do |row| fp.puts row.inject({}) {|ac,v| ac[v[0].to_sym]=v[1];ac}.inspect+"," end fp.puts "]" end
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/4_pv_custom/cars/cars_data.rb
Ruby
bsd-2-clause
241
master
61,102
$cars = [ {:name=>"chevrolet chevelle malibu", :mpg=>18, :cylinders=>8, :displacement=>307, :horsepower=>130, :weight=>3504, :acceleration=>12, :year=>70, :origin=>1}, {:name=>"buick skylark 320", :mpg=>15, :cylinders=>8, :displacement=>350, :horsepower=>165, :weight=>3693, :acceleration=>11.5, :year=>70, :origin=>1}, ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/4_pv_custom/cars/cars.rb
Ruby
bsd-2-clause
241
master
2,150
# = Parallel Coordinates # Parallel coordinates is a popular method of visualizing high-dimensional data using dynamic queries. # On static setting, you could choose an attribute and colour each datum which belongs to an attribute differently. On this example, we choose to color :cylinders attribute and highlight the ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/4_pv_custom/crimea/crimea_line.rb
Ruby
bsd-2-clause
241
master
1,395
# = Crimeam War deaths (Grouped bar) # Florence Nightingale used a coxcomb diagram to emphasize the number of deaths due to “preventible or mitigable zymotic diseases”. This graph shows data using a line chart. $:.unshift(File.dirname(__FILE__)+"/../../../lib") require 'rubyvis' require 'ostruct' load(File.dirname(__F...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/4_pv_custom/crimea/crimea_grouped_bar.rb
Ruby
bsd-2-clause
241
master
1,669
# = Crimeam War deaths (Grouped bar) # Florence Nightingale used a coxcomb diagram to emphasize the number of deaths due to “preventible or mitigable zymotic diseases”. This graph shows data using a stacked bar chart. $:.unshift(File.dirname(__FILE__)+"/../../../lib") require 'rubyvis' require 'ostruct' load(File.dirna...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/4_pv_custom/crimea/crimea_data.rb
Ruby
bsd-2-clause
241
master
2,081
$:.unshift(File.dirname(__FILE__)+"/../../lib") require 'rubyvis' require 'ostruct' $causes = ["wounds", "other", "disease"]; $crimea = [ OpenStruct.new({ date: "4/1854", wounds: 0, other: 110, disease: 110 }), OpenStruct.new({ date: "5/1854", wounds: 0, other: 95, disease: 105 }), OpenStruct.new({ date: "6/185...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/4_pv_custom/barley/barley_data.rb
Ruby
bsd-2-clause
241
master
9,013
$barley = [ { yield: 27.00000, variety: "Manchuria", year: 1931, site: "University Farm" }, { yield: 48.86667, variety: "Manchuria", year: 1931, site: "Waseca" }, { yield: 27.43334, variety: "Manchuria", year: 1931, site: "Morris" }, { yield: 39.93333, variety: "Manchuria", year: 1931, site: "Crookston" }, { ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/4_pv_custom/barley/barley.rb
Ruby
bsd-2-clause
241
master
2,827
# = Becker’s Barley # The "Trellis display":http://www.jstor.org/stable/1390777 by Becker et al. helped establish small multiples as a “powerful mechanism for understanding interactions in studies of how a response depends on explanatory variables”. Here we reproduce a trellis of Barley yields from the 1930s, complete ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/4_pv_custom/antibiotics/antibiotics_data.rb
Ruby
bsd-2-clause
241
master
1,739
$antibiotics = ["penicillin", "streptomycin", "neomycin"]; $bacteria = [ {name: "Mycobacterium tuberculosis", penicillin: 800, streptomycin: 5, neomycin: 2, gram: "negative"}, {name: "Salmonella schottmuelleri", penicillin: 10, streptomycin: 0.8, neomycin: 0.09, gram: "negative"}, {name: "Proteus vulgaris", peni...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/4_pv_custom/antibiotics/antibiotics_wedge.rb
Ruby
bsd-2-clause
241
master
4,172
# = Antibiotic Effectiveness : Pie chart # After World War II, antibiotics earned the moniker “wonder drugs” for quickly treating previously-incurable diseases. Data was gathered to determine which drug worked best for each bacterial infection. Comparing drug performance was an enormous aid for practitioners and scient...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/4_pv_custom/antibiotics/antibiotics_scatter.rb
Ruby
bsd-2-clause
241
master
3,206
# = Antibiotic Effectiveness : Scatterplot # After World War II, antibiotics earned the moniker “wonder drugs” for quickly treating previously-incurable diseases. Data was gathered to determine which drug worked best for each bacterial infection. Comparing drug performance was an enormous aid for practitioners and scie...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/6_pv_networks/matrix.rb
Ruby
bsd-2-clause
241
master
2,003
# = Matrix Diagrams # A graph can be represented by an adjacency matrix, where each value in row i and column j corresponds to the link from node i to node j. Given this representation, an obvious visualization then is: show the matrix! Using color or saturation instead of text allows patterns to be perceived rapidly. ...
github
clbustos/rubyvis
https://github.com/clbustos/rubyvis
examples/6_pv_networks/arc.rb
Ruby
bsd-2-clause
241
master
1,317
# = Arc Diagrams # An arc diagram uses a one-dimensional layout of nodes, with circular arcs to represent links. Though an arc diagram may not convey the overall structure of the graph as effectively as a two-dimensional layout, with a good ordering of nodes it is easy to identify cliques and bridges. Further, as with ...