Class: Squid::AxisLabel
- Inherits:
-
Object
- Object
- Squid::AxisLabel
- Defined in:
- lib/squid/axis_label.rb
Instance Attribute Summary collapse
-
#align ⇒ Object
readonly
Returns the value of attribute align.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(label:, y:, align:, width:) ⇒ AxisLabel
constructor
A new instance of AxisLabel.
Constructor Details
#initialize(label:, y:, align:, width:) ⇒ AxisLabel
Returns a new instance of AxisLabel.
11 12 13 |
# File 'lib/squid/axis_label.rb', line 11 def initialize(label:, y:, align:, width:) @label, @y, @align, @width = label, y, align, width end |
Instance Attribute Details
#align ⇒ Object (readonly)
Returns the value of attribute align.
9 10 11 |
# File 'lib/squid/axis_label.rb', line 9 def align @align end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
9 10 11 |
# File 'lib/squid/axis_label.rb', line 9 def label @label end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
9 10 11 |
# File 'lib/squid/axis_label.rb', line 9 def width @width end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
9 10 11 |
# File 'lib/squid/axis_label.rb', line 9 def y @y end |
Class Method Details
.for(axis, height:, align:) ⇒ Object
3 4 5 6 7 |
# File 'lib/squid/axis_label.rb', line 3 def self.for(axis, height:, align:) height.step(0, -height/(axis.labels.size-1).to_f).map.with_index do |y, i| new y: y, label: axis.labels[i], align: align, width: axis.width end end |