From: martyntaylor <[email protected]>

---
 lib/scruffy/layers/line.rb |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/lib/scruffy/layers/line.rb b/lib/scruffy/layers/line.rb
index d06bdde..793e8e2 100644
--- a/lib/scruffy/layers/line.rb
+++ b/lib/scruffy/layers/line.rb
@@ -6,24 +6,36 @@ module Scruffy::Layers
   #
   # Line graph.
   class Line < Base
-    
+
+    attr_accessor :show_points
+
+    def initialize(options = {})
+      super(options)
+      @show_points = options[:show_points] != nil ? options[:show_points] : 
true
+    end
+
     # Renders line graph.
     def draw(svg, coords, options={})
       svg.g(:class => 'shadow', :transform => "translate(#{relative(0.5)}, 
#{relative(0.5)})") {
         svg.polyline( :points => stringify_coords(coords).join(' '), :fill => 
'transparent', 
-                      :stroke => 'black', 'stroke-width' => relative(2), 
+                      :stroke => 'black', 'stroke-width' => relative(2),
                       :style => 'fill-opacity: 0; stroke-opacity: 0.35' )
 
-        coords.each { |coord| svg.circle( :cx => coord.first, :cy => 
coord.last + relative(0.9), :r => relative(2), 
-                                          :style => "stroke-width: 
#{relative(2)}; stroke: black; opacity: 0.35;" ) }
+        if @show_points
+          coords.each { |coord| svg.circle( :cx => coord.first, :cy => 
coord.last + relative(0.9), :r => relative(2),
+                                           :style => "stroke-width: 
#{relative(2)}; stroke: black; opacity: 0.35;" ) }
+        end
       }
 
 
-      svg.polyline( :points => stringify_coords(coords).join(' '), :fill => 
'none', 
+      svg.polyline( :points => stringify_coords(coords).join(' '), :fill => 
'none',
                     :stroke => color.to_s, 'stroke-width' => relative(2) )
 
-      coords.each { |coord| svg.circle( :cx => coord.first, :cy => coord.last, 
:r => relative(2), 
+      if @show_points
+        coords.each { |coord| svg.circle( :cx => coord.first, :cy => 
coord.last, :r => relative(2),
                                         :style => "stroke-width: 
#{relative(2)}; stroke: #{color.to_s}; fill: #{color.to_s}" ) }
+      end
     end
+
   end
 end
\ No newline at end of file
-- 
1.7.1.1

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to