class Rubyvis::Area

Represents an area mark: the solid area between two series of connected line segments. Unsurprisingly, areas are used most frequently for area charts.

<p>Just as a line represents a polyline, the Area mark type represents a polygon. However, an area is not an arbitrary polygon; vertices are paired either horizontally or vertically into parallel spans, and each span corresponds to an associated datum. Either the width or the height must be specified, but not both; this determines whether the area is horizontally-oriented or vertically-oriented. Like lines, areas can be stroked and filled with arbitrary colors.

Attributes

fill_style[RW]

The area fill style; if non-null, the interior of the polygon forming the area is filled with the specified color. The default value of this property is a categorical color.

<p>This property is fixed for non-segmented areas. See {@link pv.Mark}.

height[RW]

The height of a given span, in pixels; used for vertical spans. If the height is specified, the width property should be 0 (the default). Either the left or right property should be used to space the spans horizontally, typically as a multiple of the index.

interpolate[RW]

How to interpolate between values. Linear interpolation (“linear”) is the default, producing a straight line between points. For piecewise constant functions (i.e., step functions), either “step-before” or “step-after” can be specified. To draw open uniform b-splines, specify “basis”. To draw cardinal splines, specify “cardinal”; see also Rubyvis::Line#tension

<p>This property is fixed. See {@link pv.Mark}.

line_width[RW]

The width of stroked lines, in pixels; used in conjunction with strokeStyle to stroke the perimeter of the area. Unlike the {@link Line} mark type, the entire perimeter is stroked, rather than just one edge. The default value of this property is 1.5, but since the default stroke style is null, area marks are not stroked by default.

<p>This property is fixed for non-segmented areas. See {@link pv.Mark}.

segmented[RW]

Whether the area is segmented; whether variations in fill style, stroke style, and the other properties are treated as fixed. Rendering segmented areas is noticeably slower than non-segmented areas.

<p>This property is fixed. See {@link pv.Mark}.

stroke_style[RW]

The style of stroked lines; used in conjunction with lineWidth to stroke the perimeter of the area. Unlike the {@link Line} mark type, the entire perimeter is stroked, rather than just one edge. The default value of this property is null, meaning areas are not stroked by default.

<p>This property is fixed for non-segmented areas. See {@link pv.Mark}.

tension[RW]

The tension of cardinal splines; used in conjunction with interpolate(“cardinal”). A value between 0 and 1 draws cardinal splines with the given tension. In some sense, the tension can be interpreted as the “length” of the tangent; a tension of 1 will yield all zero tangents (i.e., linear interpolation), and a tension of 0 yields a Catmull-Rom spline. The default value is 0.7.

<p>This property is fixed. See {@link pv.Mark}.

width[RW]

The width of a given span, in pixels; used for horizontal spans. If the width is specified, the height property should be 0 (the default). Either the top or bottom property should be used to space the spans vertically, typically as a multiple of the index.

Public Class Methods

defaults() click to toggle source
# File lib/rubyvis/mark/area.rb, line 214
def self.defaults
  a= Rubyvis::Colors.category20
  Area.new.mark_extend(Mark.defaults).line_width(1.5).fill_style(lambda {a.scale(self.parent.index)}).interpolate('linear').tension(0.7)
end

Public Instance Methods

anchor(name) click to toggle source
# File lib/rubyvis/mark/area.rb, line 218
def anchor(name)
  area_anchor(name)
end
bind() click to toggle source
# File lib/rubyvis/mark/area.rb, line 208
def bind
  area_bind
end
build_implied(s) click to toggle source
# File lib/rubyvis/mark/area.rb, line 221
def build_implied(s)
  s.height=0 if s.height.nil?
  s.width=0 if s.width.nil?
  mark_build_implied(s)
end
build_instance(s) click to toggle source
# File lib/rubyvis/mark/area.rb, line 211
def build_instance(s)
  area_build_instance(s)
end
type() click to toggle source
# File lib/rubyvis/mark/area.rb, line 205
def type
  'area'
end