lib/ctioga2/graphics/legends/area.rb in ctioga2-0.1 vs lib/ctioga2/graphics/legends/area.rb in ctioga2-0.2

- old
+ new

@@ -14,11 +14,11 @@ require 'ctioga2/utils' require 'ctioga2/log' module CTioga2 - Version::register_svn_info('$Revision: 155 $', '$Date: 2010-06-21 21:41:32 +0200 (Mon, 21 Jun 2010) $') + Version::register_svn_info('$Revision: 285 $', '$Date: 2011-02-22 21:12:47 +0100 (Tue, 22 Feb 2011) $') module Graphics # This module holds all the classes dealing with legends module Legends @@ -84,14 +84,14 @@ t.rescale(@legend_style.scale) t.rescale_text(@legend_style.text_scale) # We make figure coordinates frame coordinates t.set_bounds([0, 1, 1, 0]) - # \todo customize this ! + ## \todo customize this ! x, y = initial_xy(t, container) for item in items - # \todo transform the 0.0 for x into a negative + ## \todo transform the 0.0 for x into a negative # user-specifiable stuff. item.draw(t, @legend_style, x , y) y -= @legend_style.dy.to_figure(t,:y) end end @@ -143,13 +143,10 @@ # # [ plot_margins, legend_margins] # # These arrays can be used as arguments for subframe_margins # or respectively the graph and the legends part of the plot. - # - # This function will *eventually* also work in the case of a - # #legend_type :inside? def partition_frame(t, container) w,h = size(t, container) case @legend_type when :right w = t.convert_figure_to_frame_dx(w) @@ -174,17 +171,17 @@ # inside the legend frame. Depends on a lot of things, # including the type of the legend. def initial_xy(t, container) case @legend_type when :right - l,r,t,b = container.actual_subframe(t).to_frame_margins(t) + l,r,top,b = container.actual_subframe(t).to_frame_margins(t) # Here, we take profit from the fact that frame # coordinates are also figure coordinates within the # legend. - # \todo that won't work in the case of labels on the + ## \todo that won't work in the case of labels on the # right-hand-side. - return [- l/2, 1.0 - t] + return [0, 1.0 - top] when :inside return [0.0, 1.0] else raise "Unimplemented yet..." end