lib/ctioga2/graphics/legends/area.rb in ctioga2-0.3 vs lib/ctioga2/graphics/legends/area.rb in ctioga2-0.4
- old
+ new
@@ -14,28 +14,21 @@
require 'ctioga2/utils'
require 'ctioga2/log'
module CTioga2
- Version::register_svn_info('$Revision$', '$Date$')
+ Version::register_svn_info('$Revision: 359 $', '$Date: 2012-12-26 10:45:35 +0100 (Wed, 26 Dec 2012) $')
module Graphics
# This module holds all the classes dealing with legends
module Legends
# This class holds a series of legends for curves.
#
# \todo
#
- # * a legend can be plotted either inside a plot or outside the
- # root object
- #
- # * in case it is plotted outside the root object, the user should
- # be able to choose whether it should be counted in the
- # real-size or not.
- #
# * legends should provide all the kind of things that were in the
# first ctioga, such as background, frames, and so on...
#
# * legends could be organized as columns (especially at the
# bottom of the graph).
@@ -86,9 +79,16 @@
# We make figure coordinates frame coordinates
t.set_bounds([0, 1, 1, 0])
## \todo customize this !
x, y = initial_xy(t, container)
+
+ w,h = *size(t, container)
+ h /= @legend_style.scale * @legend_style.text_scale
+ @legend_style.frame.
+ draw_box_around(t, x, y,
+ x + w, y - h, @legend_style.frame_padding)
+
for item in items
## \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)