Class pv.Rule
Extends pv.Mark.
Represents a horizontal or vertical rule. Rules are frequently used for axes and grid lines. For example, specifying only the bottom property draws horizontal rules, while specifying only the left draws vertical rules. Rules can also be used as thin bars. The visual style is controlled in the same manner as lines.
Rules are positioned exclusively the standard box model properties. The following combinations of properties are supported:
Properties | Orientation |
---|---|
left | vertical |
right | vertical |
left, bottom, top | vertical |
right, bottom, top | vertical |
top | horizontal |
bottom | horizontal |
top, left, right | horizontal |
bottom, left, right | horizontal |
left, top, height | vertical |
left, bottom, height | vertical |
right, top, height | vertical |
right, bottom, height | vertical |
left, top, width | horizontal |
left, bottom, width | horizontal |
right, top, width | horizontal |
right, bottom, width | horizontal |
Small rules can be used as tick marks; alternatively, a Dot with the "tick" shape can be used.
See also the Rule guide.
Defined in: Rule.js.
Constructor Attributes | Constructor Name and Description |
---|---|
pv.Rule()
Constructs a new rule with default properties.
|
Field Attributes | Field Name and Description |
---|---|
Default properties for rules.
|
|
The height of the rule, in pixels.
|
|
The width of stroked lines, in pixels; used in conjunction with
strokeStyle to stroke the rule.
|
|
The style of stroked lines; used in conjunction with lineWidth to
stroke the rule.
|
|
The width of the rule, in pixels.
|
- 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 rule anchor with default properties.
|
- Methods borrowed from class pv.Mark:
- add, anchorTarget, cousin, def, event, extend, first, last, mouse, render, sibling
Constructs a new rule with default properties. Rules are not typically constructed directly, but by adding to a panel or an existing mark via pv.Mark#add.
- See:
- pv.Line
Default properties for rules. By default, a single-pixel black line is stroked.
The height of the rule, in pixels. If the bottom position is specified, the rule extends upward from the bottom edge; if the top position is specified, the rule extends downward from the top edge.
The width of stroked lines, in pixels; used in conjunction with strokeStyle to stroke the rule. The default value is 1 pixel.
The style of stroked lines; used in conjunction with lineWidth to stroke the rule. The default value of this property is black.
- See:
- pv.color
The width of the rule, in pixels. If the left position is specified, the rule extends rightward from the left edge; if the right position is specified, the rule extends leftward from the right edge.
Constructs a new rule anchor with default properties. Rules support five different anchors:
- top
- left
- center
- bottom
- right
For consistency with the other mark types, the anchor positions are defined in terms of their opposite edge. For example, the top anchor defines the bottom property, such that a bar added to the top anchor grows upward.
- Parameters:
- {string} name
- the anchor name; either a string or a property function.
- Returns:
- {pv.Anchor}