Class Index | File Index

Classes


Class pv.Wedge


Extends pv.Mark.
Represents a wedge, or pie slice. Specified in terms of start and end angle, inner and outer radius, wedges can be used to construct donut charts and polar bar charts as well. If the #angle property is used, the end angle is implied by adding this value to start angle. By default, the start angle is the previously-generated wedge's end angle. This design allows explicit control over the wedge placement if desired, while offering convenient defaults for the construction of radial graphs.

The center point of the circle is positioned using the standard box model. The wedge can be stroked and filled, similar to pv.Bar.

See also the Wedge guide.
Defined in: Wedge.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Constructs a new wedge with default properties.
Field Summary
Field Attributes Field Name and Description
 
The angular span of the wedge, in radians.
 
Default properties for wedges.
 
The end angle of the wedge, in radians.
 
The wedge fill style; if non-null, the interior of the wedge is filled with the specified color.
 
The inner radius of the wedge, in pixels.
 
The width of stroked lines, in pixels; used in conjunction with strokeStyle to stroke the wedge's border.
 
The outer radius of the wedge, in pixels.
 
The start angle of the wedge, in radians.
 
The style of stroked lines; used in conjunction with lineWidth to stroke the wedge's border.
Fields borrowed from class pv.Mark:
bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
Method Summary
Method Attributes Method Name and Description
 
anchor(name)
Constructs a new wedge anchor with default properties.
 
Returns the mid-angle of the wedge, which is defined as half-way between the start and end angles.
 
Returns the mid-radius of the wedge, which is defined as half-way between the inner and outer radii.
<static>  
pv.Wedge.upright(angle)
Returns true if the specified angle is considered "upright", as in, text rendered at that angle would appear upright.
Methods borrowed from class pv.Mark:
add, anchorTarget, def, event, extend, margin, mouse, render
Class Detail
pv.Wedge()
Constructs a new wedge with default properties. Wedges are not typically constructed directly, but by adding to a panel or an existing mark via pv.Mark#add.
Field Detail
{number} angle
The angular span of the wedge, in radians. This property is used if end angle is not specified.

{pv.Wedge} defaults
Default properties for wedges. By default, there is no stroke and the fill style is a categorical color.

{number} endAngle
The end angle of the wedge, in radians. If not specified, the end angle is implied as the start angle plus the #angle.

{string} fillStyle
The wedge fill style; if non-null, the interior of the wedge is filled with the specified color. The default value of this property is a categorical color.
See:
pv.color

{number} innerRadius
The inner radius of the wedge, in pixels. The default value of this property is zero; a positive value will produce a donut slice rather than a pie slice. The inner radius can vary per-wedge.

{number} lineWidth
The width of stroked lines, in pixels; used in conjunction with strokeStyle to stroke the wedge's border.

{number} outerRadius
The outer radius of the wedge, in pixels. This property is required. For pies, only this radius is required; for donuts, the inner radius must be specified as well. The outer radius can vary per-wedge.

{number} startAngle
The start angle of the wedge, in radians. The start angle is measured clockwise from the 3 o'clock position. The default value of this property is the end angle of the previous instance (the Mark#sibling), or -PI / 2 for the first wedge; for pie and donut charts, typically only the #angle property needs to be specified.

{string} strokeStyle
The style of stroked lines; used in conjunction with lineWidth to stroke the wedge's border. The default value of this property is null, meaning wedges are not stroked by default.
See:
pv.color
Method Detail
{pv.Anchor} anchor(name)
Constructs a new wedge anchor with default properties. Wedges support five different anchors:In addition to positioning properties (left, right, top bottom), the anchors support text rendering properties (text-align, text-baseline, textAngle). Text is rendered to appear inside the wedge.
Parameters:
{string} name
the anchor name; either a string or a property function.
Returns:
{pv.Anchor}

{number} midAngle()
Returns the mid-angle of the wedge, which is defined as half-way between the start and end angles.
Returns:
{number} the mid-angle, in radians.
See:
#startAngle
#endAngle

{number} midRadius()
Returns the mid-radius of the wedge, which is defined as half-way between the inner and outer radii.
Returns:
{number} the mid-radius, in pixels.
See:
#innerRadius
#outerRadius

<static> {boolean} pv.Wedge.upright(angle)
Returns true if the specified angle is considered "upright", as in, text rendered at that angle would appear upright. If the angle is not upright, text is rotated 180 degrees to be upright, and the text alignment properties are correspondingly changed.
Parameters:
{number} angle
an angle, in radius.
Returns:
{boolean} true if the specified angle is upright.

Documentation generated by JsDoc Toolkit 2.3.2 on Sun May 30 2010 18:10:25 GMT-0700 (PDT)