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 {link Bar}.
See also the Wedge guide.
Defined in: Wedge.js.
Constructor Attributes | Constructor Name and Description |
---|---|
pv.Wedge()
Constructs a new wedge with default properties.
|
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, index, left, parent, proto, reverse, right, root, scene, title, top, type, visible
Method Attributes | Method Name and Description |
---|---|
anchor(name)
Constructs a new wedge anchor with default properties.
|
|
midAngle()
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, cousin, def, event, extend, first, last, mouse, render, sibling
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.
The angular span of the wedge, in radians. This property is used if end angle is not specified.
Default properties for wedges. By default, there is no stroke and the fill style is a categorical color.
The end angle of the wedge, in radians. If not specified, the end angle is implied as the start angle plus the #angle.
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
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.
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. 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.
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.
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
Constructs a new wedge anchor with default properties. Wedges support five different anchors:
- outer
- inner
- center
- start
- end
- Parameters:
- {string} name
- the anchor name; either a string or a property function.
- Returns:
- {pv.Anchor}
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
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
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.