Browse Source

Added Line test to ruby test script.

Minor syntax fixes to line.py.
pull/8/head
jaraco 17 years ago
parent
commit
63b0f7a005
  1. 3
      lib/SVG/Line.py
  2. 18
      test/testing.rb

3
lib/SVG/Line.py

@ -199,7 +199,7 @@ class Line(SVG.Graph):
line_path, line_path,
area_path, area_path,
'Z' 'Z'
) ))
p.setAttribute('d', d) p.setAttribute('d', d)
p.setAttribute('class', 'fill%(line_n)s' % vars()) p.setAttribute('class', 'fill%(line_n)s' % vars())
self.graph.appendChild(p) self.graph.appendChild(p)
@ -220,6 +220,7 @@ class Line(SVG.Graph):
cy = str(self.graph_height - value*field_height), cy = str(self.graph_height - value*field_height),
r = '2.5', r = '2.5',
) )
)
circle.setAttribute('class', 'dataPoint%(line_n)s' % vars()) circle.setAttribute('class', 'dataPoint%(line_n)s' % vars())
self.graph.appendChild(circle) self.graph.appendChild(circle)
self.make_datapoint_text( self.make_datapoint_text(

18
test/testing.rb

@ -94,3 +94,21 @@ f = File.new('Pie.rb.svg', 'w')
f.write(g.burn()) f.write(g.burn())
f.close() f.close()
require 'SVG/Graph/Line'
g = SVG::Graph::Line.new( {
:scale_integers=>true,
:area_fill=>true,
:width=>640,
:height=>480,
:fields=>fields,
:graph_title=>'Question 7',
:show_graph_title=>true,
:no_css=>false
})
g.add_data({:data=>[-2,3,1,3,1], :title=>'Female'})
g.add_data({:data=>[0,2,1,5,4], :title=>'Male'})
f = File.new('Line.rb.svg', 'w')
f.write(g.burn())
f.close()

Loading…
Cancel
Save