Class: Rubyvis::Label

Inherits:
Mark show all
Defined in:
lib/rubyvis/mark/label.rb

Overview

Represents a text label, allowing textual annotation of other marks or arbitrary text within the visualization. The character data must be plain text (unicode), though the text can be styled using the #font property. If rich text is needed, external HTML elements can be overlaid on the canvas by hand.

<p>Labels are positioned using the box model, similarly to Dot. Thus, a label has no width or height, but merely a text anchor location. The text is positioned relative to this anchor location based on the text_align, text_baseline and text_margin properties. Furthermore, the text may be rotated using text_angle

Instance Attribute Summary

Attributes inherited from Mark

#_properties, #binds, #child_index, #parent, #proto, #root, #scale, #scene, #target

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Mark

#add, #anchor, #area, attr_accessor_dsl, #bar, #bind, #build, #build_implied, #build_instance, #build_properties, #context, #context_apply, #context_clear, #cousin, #delete_index, #dot, #event, #execute, #first, #image, index, #index, index=, #index=, #index_defined?, #initialize, #instance, #instances, #label, #last, #layout_arc, #layout_cluster, #layout_grid, #layout_horizon, #layout_indent, #layout_matrix, #layout_pack, #layout_partition, #layout_partition_fill, #layout_stack, #layout_tree, #layout_treemap, #line, #margin, #mark_anchor, #mark_bind, #mark_build_implied, #mark_build_instance, #mark_build_properties, #mark_extend, mark_method, #panel, #properties, properties, property_method, #property_value, #render, #rule, scene, scene=, #sibling, stack, stack=, #wedge

Constructor Details

This class inherits a constructor from Rubyvis::Mark

Class Method Details

.defaultsObject

Default properties for labels. See the individual properties for the default values.



103
104
105
# File 'lib/rubyvis/mark/label.rb', line 103

def self.defaults
  Label.new.mark_extend(Mark.defaults).events('none').text(Rubyvis.identity).font("10px sans-serif" ).text_angle( 0 ).text_style( 'black' ).text_align( 'left' ).text_baseline( 'bottom' ).text_margin(3)
end

Instance Method Details

#typeObject

Mark type



99
100
101
# File 'lib/rubyvis/mark/label.rb', line 99

def type
  'label'
end