Sha256: 5f872c1a92f3d3d104f3d26605b514fa1cb54825ba7e0147dd59d1408790b27d

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require "test/unit"
require "svggraph"

class TestSvgGraph < Test::Unit::TestCase
  def test_bar_line_and_pie
   fields = %w(Jan Feb Mar);
data_sales_02 = [12, 45, 21]
[SVG::Graph::Bar, SVG::Graph::BarHorizontal, SVG::Graph::Line, SVG::Graph::Pie].each do 
	|klass|
graph = klass.new(
:height => 500,
:width => 300,
:fields => fields
)
graph.add_data(
:data => data_sales_02,
:title => 'Sales 2002'
)
out=graph.burn
assert(out=~/Created with SVG::Graph/)
end
  end
  def test_plot
	  
	  projection = [
         6, 11,    0, 5,   18, 7,   1, 11,   13, 9,   1, 2,   19, 0,   3, 13,
         7, 9 
       ]
       actual = [
         0, 18,    8, 15,    9, 4,   18, 14,   10, 2,   11, 6,  14, 12,   
         15, 6,   4, 17,   2, 12
       ]
       
       graph = SVG::Graph::Plot.new({
       	:height => 500,
        	:width => 300,
         :key => true,
         :scale_x_integers => true,
         :scale_y_integerrs => true,
       })
       
       graph.add_data({
       	:data => projection, 
     	  :title => 'Projected',
       })
     
       graph.add_data({
       	:data => actual,
     	  :title => 'Actual',
       })
       
       out=graph.burn()
       assert(out=~/Created with SVG::Graph/)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
svg-graph-1.0.0 test/test_svg_graph.rb