Class: MotionPlot::DataLabel
- Inherits:
-
Object
- Object
- MotionPlot::DataLabel
- Defined in:
- lib/motion-plot/utilities/data_label.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#annotation ⇒ Object
Returns the value of attribute annotation.
Instance Method Summary collapse
- #annotation_for(value, atCoordinate: coordinate, plotSpace: plot_space) ⇒ Object
- #annotation_text_style(value) ⇒ Object
- #displacement ⇒ Object
-
#initialize(options = {}) ⇒ DataLabel
constructor
A new instance of DataLabel.
- #style ⇒ Object
Constructor Details
Instance Attribute Details
#annotation ⇒ Object
Returns the value of attribute annotation.
8 9 10 |
# File 'lib/motion-plot/utilities/data_label.rb', line 8 def annotation @annotation end |
Instance Method Details
#annotation_for(value, atCoordinate: coordinate, plotSpace: plot_space) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/motion-plot/utilities/data_label.rb', line 23 def annotation_for(value, atCoordinate: coordinate, plotSpace: plot_space) @annotation = CPTPlotSpaceAnnotation.alloc.initWithPlotSpace(plot_space, anchorPlotPoint:coordinate) @annotation.contentLayer = annotation_text_style(value) @annotation.displacement = @attributes[:displacement] @annotation end |
#annotation_text_style(value) ⇒ Object
31 32 33 |
# File 'lib/motion-plot/utilities/data_label.rb', line 31 def annotation_text_style(value) CPTTextLayer.alloc.initWithText(value.to_s, style:style) end |
#displacement ⇒ Object
19 20 21 |
# File 'lib/motion-plot/utilities/data_label.rb', line 19 def displacement @attributes[:displacement] end |
#style ⇒ Object
15 16 17 |
# File 'lib/motion-plot/utilities/data_label.rb', line 15 def style TextStyle.cpt_text_style(@style) end |