Class: MotionPlot::Legend
- Inherits:
-
Object
- Object
- MotionPlot::Legend
- Defined in:
- lib/motion-plot/utilities/legend.rb
Constant Summary collapse
- DEFAULTS =
{ swatch_size: [25.0, 25.0], corner_radius: 5, position: "top", displacement: [0.0, 0.0], fill_color: "FFFFFF" }
Instance Attribute Summary collapse
-
#corner_radius ⇒ Object
Returns the value of attribute corner_radius.
-
#displacement ⇒ Object
Returns the value of attribute displacement.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#fill_color ⇒ Object
Returns the value of attribute fill_color.
-
#number_of_columns ⇒ Object
Returns the value of attribute number_of_columns.
-
#number_of_rows ⇒ Object
Returns the value of attribute number_of_rows.
-
#position ⇒ Object
Returns the value of attribute position.
-
#style ⇒ Object
Returns the value of attribute style.
-
#swatch_size ⇒ Object
Returns the value of attribute swatch_size.
Instance Method Summary collapse
- #cpt_legend(graph) ⇒ Object
- #enabled? ⇒ Boolean
-
#initialize(args = {}) ⇒ Legend
constructor
A new instance of Legend.
Constructor Details
#initialize(args = {}) ⇒ Legend
Returns a new instance of Legend.
14 15 16 17 18 19 20 21 22 |
# File 'lib/motion-plot/utilities/legend.rb', line 14 def initialize(args={}) = DEFAULTS.merge(args) .each_pair {|key, value| send("#{key}=", value) if(respond_to?("#{key}=")) } @style = args[:style] ? Style.new(args[:style]) : Style.new end |
Instance Attribute Details
#corner_radius ⇒ Object
Returns the value of attribute corner_radius.
4 5 6 |
# File 'lib/motion-plot/utilities/legend.rb', line 4 def corner_radius @corner_radius end |
#displacement ⇒ Object
Returns the value of attribute displacement.
4 5 6 |
# File 'lib/motion-plot/utilities/legend.rb', line 4 def displacement @displacement end |
#enabled ⇒ Object
Returns the value of attribute enabled.
4 5 6 |
# File 'lib/motion-plot/utilities/legend.rb', line 4 def enabled @enabled end |
#fill_color ⇒ Object
Returns the value of attribute fill_color.
4 5 6 |
# File 'lib/motion-plot/utilities/legend.rb', line 4 def fill_color @fill_color end |
#number_of_columns ⇒ Object
Returns the value of attribute number_of_columns.
4 5 6 |
# File 'lib/motion-plot/utilities/legend.rb', line 4 def number_of_columns @number_of_columns end |
#number_of_rows ⇒ Object
Returns the value of attribute number_of_rows.
4 5 6 |
# File 'lib/motion-plot/utilities/legend.rb', line 4 def number_of_rows @number_of_rows end |
#position ⇒ Object
Returns the value of attribute position.
4 5 6 |
# File 'lib/motion-plot/utilities/legend.rb', line 4 def position @position end |
#style ⇒ Object
Returns the value of attribute style.
4 5 6 |
# File 'lib/motion-plot/utilities/legend.rb', line 4 def style @style end |
#swatch_size ⇒ Object
Returns the value of attribute swatch_size.
4 5 6 |
# File 'lib/motion-plot/utilities/legend.rb', line 4 def swatch_size @swatch_size end |
Instance Method Details
#cpt_legend(graph) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/motion-plot/utilities/legend.rb', line 32 def cpt_legend(graph) legend = CPTLegend.legendWithGraph(graph) legend.fill = CPTFill.fillWithColor(fill_color.to_color.to_cpt_color) legend.cornerRadius = corner_radius legend.swatchSize = swatch_size legend.textStyle = TextStyle.cpt_text_style(@style) if(@style) p @style legend end |
#enabled? ⇒ Boolean
24 25 26 |
# File 'lib/motion-plot/utilities/legend.rb', line 24 def enabled? enabled end |