Class pv.Layout.stack
A layout for stacking marks vertically or horizontally, using the cousin instance. This layout is designed to be used for one of the four positional properties in the box model, and changes behavior depending on the property being evaluated:
- bottom: cousin.bottom + cousin.height
- top: cousin.top + cousin.height
- left: cousin.left + cousin.width
- right: cousin.right + cousin.width
new pv.Panel() .width(150).height(150) .add(pv.Panel) .data([[1, 1.2, 1.7, 1.5, 1.7], [.5, 1, .8, 1.1, 1.3], [.2, .5, .8, .9, 1]]) .add(pv.Area) .data(function(d) d) .bottom(pv.Layout.stack()) .height(function(d) d * 40) .left(function() this.index * 35) .root.render();specifies a vertically-stacked area chart.
Defined in: Stack.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Returns a new stack layout.
|
Method Attributes | Method Name and Description |
---|---|
offset(f)
Sets the offset for this stack layout.
|
Class Detail
pv.Layout.stack()
Returns a new stack layout.
- Returns:
- {pv.Layout.stack} a stack property function.
- See:
- pv.Mark#cousin
Method Detail
{pv.Layout.stack}
offset(f)
Sets the offset for this stack layout. The offset can either be specified as a function or as a constant. If a function, the function is invoked in the same context as a normal property function: this refers to the mark, and the arguments are the full data stack. By default the offset is zero.
- Parameters:
- {function} f
- offset function, or constant value.
- Returns:
- {pv.Layout.stack} this.