class Plotrb::Mark::MarkProperty
Constants
- VISUAL_PROPERTIES
@!attributes x
@return [ValueRef] the first (left-most) x-coordinate
@!attributes x2
@return [ValueRef] the second (right-most) x-coordinate
@!attributes width
@return [ValueRef] the width of the mark
@!attributes y
@return [ValueRef] the first (top-most) y-coordinate
@!attributes y2
@return [ValueRef] the second (bottom-most) y-coordinate
@!attributes height
@return [ValueRef] the height of the mark
@!attributes opacity
@return [ValueRef] the overall opacity
@!attributes fill
@return [ValueRef] the fill color
@!attributes fill_opacity
@return [ValueRef] the fill opacity
@!attributes stroke
@return [ValueRef] the stroke color
@!attributes stroke_width
@return [ValueRef] the stroke width in pixels
@!attributes stroke_opacity
@return [ValueRef] the stroke opacity
@!attributes stroke_dash
@return [ValueRef] alternating stroke, space lengths for creating dashed or dotted lines
@!attributes stroke_dash_offset
@return [ValueRef] the offset into which to begin the stroke dash
Attributes
data[R]
Public Class Methods
new(type, data=nil, &block)
click to toggle source
# File lib/plotrb/marks.rb, line 202 def initialize(type, data=nil, &block) define_single_val_attributes *VISUAL_PROPERTIES self.singleton_class.class_eval { alias_method :x_start, :x alias_method :left, :x alias_method :x_end, :x2 alias_method :right, :x2 alias_method :y_start, :y alias_method :top, :y alias_method :y_end, :y2 alias_method :bottom, :y2 } @data = data self.send(type) self.instance_eval(&block) if block_given? end
Private Instance Methods
arc()
click to toggle source
# File lib/plotrb/marks.rb, line 251 def arc # @!attribute inner_radius # @return [ValueRef] the inner radius of the arc in pixels # @!attribute outer_radius # @return [ValueRef] the outer radius of the arc in pixels # @!attribute start_angle # @return [ValueRef] the start angle of the arc in radians # @!attribute end_angle # @return [ValueRef] the end angle of the arc in radians attrs = [:inner_radius, :outer_radius, :start_angle, :end_angle] add_attributes *attrs define_single_val_attributes *attrs end
area()
click to toggle source
# File lib/plotrb/marks.rb, line 265 def area # @!attribute interpolate # @return [ValueRef] the line interpolation method to use # @!attribute tension # @return [ValueRef] the tension parameter for the interpolation attrs = [:interpolate, :tension] add_attributes *attrs define_single_val_attributes *attrs end
attribute_post_processing()
click to toggle source
# File lib/plotrb/marks.rb, line 221 def attribute_post_processing end
define_single_val_attribute(method)
click to toggle source
# File lib/plotrb/marks.rb, line 326 def define_single_val_attribute(method) define_singleton_method(method) do |*args, &block| if block val = ::Plotrb::Mark::MarkProperty::ValueRef. new(@data, *args, &block) self.instance_variable_set("@#{method}", val) else case args.size when 0 self.instance_variable_get("@#{method}") when 1 val = ::Plotrb::Mark::MarkProperty::ValueRef.new(@data, args[0]) self.instance_variable_set("@#{method}", val) else raise ArgumentError end end self end end
define_single_val_attributes(*method)
click to toggle source
# File lib/plotrb/marks.rb, line 347 def define_single_val_attributes(*method) method.each { |m| define_single_val_attribute(m) } end
group()
click to toggle source
# File lib/plotrb/marks.rb, line 229 def group # no additional attributes end
image()
click to toggle source
# File lib/plotrb/marks.rb, line 285 def image # @!attribute url # @return [ValueRef] the url from which to retrieve the image # @!attribute align # @return [ValueRef] the horizontal alignment of the image # @!attribute baseline # @return [ValueRef] the vertical alignment of the image attrs = [:url, :align, :baseline] add_attributes *attrs define_single_val_attributes *attrs end
line()
click to toggle source
# File lib/plotrb/marks.rb, line 275 def line # @!attribute interpolate # @return [ValueRef] the line interpolation method to use # @!attribute tension # @return [ValueRef] the tension parameter for the interpolation attrs = [:interpolate, :tension] add_attributes *attrs define_single_val_attributes *attrs end
path()
click to toggle source
# File lib/plotrb/marks.rb, line 243 def path # @!attribute path # @return [ValueRef] the path definition in SVG path string attrs = [:path] add_attributes *attrs define_single_val_attribute *attrs end
rect()
click to toggle source
# File lib/plotrb/marks.rb, line 225 def rect # no additional attributes end
symbol()
click to toggle source
# File lib/plotrb/marks.rb, line 233 def symbol # @!attribute size # @return [ValueRef] the pixel area of the symbol # @!attribute shape # @return [ValueRef] the symbol shape attrs = [:size, :shape] add_attributes *attrs define_single_val_attributes *attrs end
text()
click to toggle source
# File lib/plotrb/marks.rb, line 297 def text # @!attribute text # @return [ValueRef] the text to display # @!attribute align # @return [ValueRef] the horizontal alignment of the text # @!attribute baseline # @return [ValueRef] the vertical alignment of the text # @!attribute dx # @return [ValueRef] the horizontal margin between text label and its # anchor point # @!attribute dy # @return [ValueRef] the vertical margin between text label and its # anchor point # @!attribute angle # @return [ValueRef] the rotation angle of the text in degrees # @!attribute font # @return [ValueRef] the font of the text # @!attribute font_size # @return [ValueRef] the font size # @!attribute font_weight # @return [ValueRef] the font weight # @!attribute font_style # @return [ValueRef] the font style attrs = [:text, :align, :baseline, :dx, :dy, :angle, :font, :font_size, :font_weight, :font_style] add_attributes *attrs define_single_val_attributes *attrs end