PivotByAlgorithm

Implementation of the Pivot By algorithm. It is described in:

Ben Shneiderman and Martin Wattenberg. Ordered treemap layouts. IEEE Symposium on Information Visualization, 0:73, 2001.

Complexity: O(n^2), where n is the number of nodes in the tree (depends on the pivot in use).

Constructors

Link copied to clipboard
constructor(type: PivotByAlgorithm.Type = SplitSize())

Types

Link copied to clipboard

The pivot is taken to be the item with the largest area since the largest item is the most difficult to place.

Link copied to clipboard

The pivot is taken to be the middle item of the list since this is more likely to create a balanced layout.

Link copied to clipboard

Selects the pivot that will split L1 and L3 into approximately equal total areas.

Link copied to clipboard
interface Type

Strategy for determining the node to use as a pivot

Properties

Link copied to clipboard
open override val isChildContained: Boolean
Link copied to clipboard
open override val isColorParent: Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val isSpaceFilling: Boolean
Link copied to clipboard
open override val properties: MutableProperties<String?>?

Properties for storing layout algorithm specific options.

Functions

Link copied to clipboard
open override fun <N, Row, Column> breadthFirstLayout(shape: Shape, parent: N, children: Array<N>, sumSizes: Double, horizontalVanishingPoint: Int, verticalVanishingPoint: Int, accessor: TreeMapAccessor<N>, worker: TreeMapWorker?): Boolean

{@inheritDoc}

Link copied to clipboard
fun computeAverageAspectRatio(rectangles: Array<Rectangle2D?>): Double
Link copied to clipboard
open override fun <N, Row, Column> depthFirstLayout(shape: Shape?, parent: N, children: Array<N>, sumSizes: Double, horizontalVanishingPoint: Int, verticalVanishingPoint: Int, accessor: TreeMapAccessor<N>, worker: TreeMapWorker?): Boolean

Arrange the items in the given array to fill the given shape. This is called during the first pass, while traversing the tree from the bottom up.

Link copied to clipboard
open override fun <N, Row, Column> finishLayout(bounds: Rectangle2D?, model: TreeMapModel<N, Row, Column>?, root: N)

Do nothing by default.

Link copied to clipboard
Link copied to clipboard
open override fun isCompatible(shape: Shape?): Boolean

Indicates whether the layout algorithm can handle the given geometry of its parent

Link copied to clipboard
open override fun <N, Row, Column> iterator(model: TreeMapModel<N, Row, Column>, root: N): Iterable<N>

Breadth first traversal by default.

Link copied to clipboard
fun <N, Row, Column> layout(children: Array<N>, bounds: Rectangle2D?, accessor: TreeMapAccessor<N>): Array<Rectangle2D?>

Divide the items in the list, other than P, into three lists, L1, L2, and L3, such that L1 consist of items whose index is less than P and L2 have items having index less than those in L3, and the aspect ratio of RP is as close to 1 as possible.

Link copied to clipboard
open override fun <N, Row, Column> startLayout(bounds: Rectangle2D?, model: TreeMapModel<N, Row, Column>, root: N, worker: TreeMapWorker?)

Do nothing by default.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun <N> tryAlternativeLayouts(children: Array<N>, bounds: Rectangle2D, rectangles: Array<Rectangle2D?>, accessor: TreeMapAccessor<N>): Array<Rectangle2D?>

If number of items is <= 5, lay them either in a pivot, quad, or snake layout. Pick the best layout whose average aspect ratio is closest to 1.