class CTioga2::Graphics::Legends::LegendLine
A class representing the style of a single legend line (unrelated to a curve)
Attributes
style[RW]
The style of the text, a Styles
.FullTextStyle object.
text[RW]
The text of the line
Public Class Methods
new(text = "", style = {})
click to toggle source
Calls superclass method
CTioga2::Graphics::Legends::LegendItem::new
# File lib/ctioga2/graphics/legends/items.rb, line 105 def initialize(text = "", style = {}) super() @text = text @style = Styles::FullTextStyle.from_hash(style) @style.justification ||= Tioga::FigureConstants::LEFT_JUSTIFIED end
Public Instance Methods
draw(t, legend_style, x, y)
click to toggle source
Draw one single text line.
# File lib/ctioga2/graphics/legends/items.rb, line 114 def draw(t, legend_style, x, y) y = get_baseline_y(t, legend_style, y) @style.draw_text(t, @text, x, y, legend_name) end
size(t, legend_style)
click to toggle source
Computes the size of the line. Height should always be accurate, but width can be 0 sometimes…
# File lib/ctioga2/graphics/legends/items.rb, line 121 def size(t, legend_style) return text_size(t, legend_style) end