Module

Hylograph.Flow.Render.Layout

Package
purescript-hylograph-flow-render
Repository
afcondon/purescript-hylograph-flow-render

The door 0.2 came in by: layout metrics widths projection, which is the Sankey engine run on a picture with no words and no groups, and the names 0.2 imported from here.

Since 0.3 the layout is pluggable, and this module holds none of it:

  • Hylograph.Flow.Render.Engine is what any engine makes (Layout, placed nodes with their ports, placed edges with their routes, outlines, the direction), what every engine is told (Picture), and an engine as a value (Engine, Promise, run);
  • Hylograph.Flow.Render.Route is an edge's route as data;
  • Hylograph.Flow.Render.Sankey is the Sankey engine, with Metrics and Widths as its own configuration.

Everything here is one of theirs under the name it had, so that code written for 0.2 that calls layout and reads boxes still compiles. For words, open groups or another engine: run engine picture projection.

#layout Source

layout :: forall wire. Metrics -> Widths wire -> Projection wire -> Layout wire

The Sankey engine's layout of a projection with no words set and no group outlined: run (sankey metrics widths) plainPicture.

Re-exports from Hylograph.Flow.Render.Engine

#Side Source

data Side

A side of a box.

Constructors

Instances

#Promise Source

data Promise wire

A law that holds of some engines' layouts and not of every layout; an engine lists the ones it keeps. What each says exactly is in Hylograph.Flow.Render.Laws.

  • FlowsForward: an edge not turned back runs with the flow, and where the projection has no cycle no edge is turned back.
  • LayersAligned: the nodes of one layer stand in one line across the flow.
  • RoutesOrthogonal: every route is straight legs along the axes.
  • WidthsConserved: every route is a ribbon as broad as its quantity says, and at each node the ribbons of a side stand in the node, beside one another, and the node is as tall as the broader side.

Constructors

#PortFlow Source

data PortFlow

Which of a node's ports a name is among: its inputs or its outputs.

Constructors

Instances

#Point Source

type Point = { x :: Number, y :: Number }

#PlacedPort Source

type PlacedPort = { along :: Number, flow :: PortFlow, name :: PortName, side :: Side }

A port with a place. along: how far along side it is, in pixels from the side's top (a left or right side) or its left end (a top or bottom side).

#PlacedOutline Source

type PlacedOutline = { box :: Box, depth :: Int, group :: GroupId, header :: Number, members :: Array Int, name :: String, parent :: Maybe GroupId }

An open group's outline. name: the group's, from the grouping. header: the height of the strip at the top of box that is kept for the name. depth: how many outlines it is inside; parent: the nearest. members: the indices of the nodes inside it, however deep.

#PlacedNode Source

type PlacedNode = { box :: Box, index :: Int, layer :: Maybe Int, node :: Node, ports :: Array PlacedPort, words :: Maybe SetWords }

index: the node's place in the projection. layer: its layer in the whole picture, where the engine gave it one (see the module's header). words: what is written in it, as set, where the picture said (Picture.words); Nothing where it did not. ports: the ports the engine gave a place; none for an item, which has none.

#PlacedEdge Source

type PlacedEdge wire = { course :: Course, edge :: Edge wire, index :: Int, route :: Route }

index: the edge's place in the projection. edge: the projection's own, with the wires it stands for, so what is known of a wire can be shown on it. route: the line it is drawn along, from its source to its target.

#Picture Source

type Picture = { groups :: Maybe Groups, lettering :: Lettering, outline :: OutlineMetrics, words :: Maybe (Node -> Words) }

What every engine is told beside the projection. words: what is written in each node, for the engine to wrap to the breadth it gives the node and make room for; Nothing leaves every node as tall as the engine makes it and its label to the tree, on one line. groups: the open groups to outline; Nothing for none.

#OutlineMetrics Source

type OutlineMetrics = { header :: Number, padding :: Number }

padding: from an outline to what is in it. header: the strip for the group's name.

#Layout Source

type Layout wire = { direction :: Direction, edges :: Array (PlacedEdge wire), height :: Number, nodes :: Array PlacedNode, outlines :: Array PlacedOutline, width :: Number }

Nodes and edges in the projection's order. An edge with an end that is no node of the projection has no place and is left out (project makes none). Outlines outermost first, so drawn in order an outline is over the one that holds it; none unless the picture told of groups.

#Groups Source

type Groups = { closed :: Set GroupId, grouping :: Array Grouping }

The grouping, and the groups that are closed: what collapse was given to make the flow that was projected. Every other group is open.

#Engine Source

newtype Engine wire

A layout engine: what it is called, what it promises of every layout it makes, and the making.

Constructors

#Direction Source

data Direction

Which way the flow runs in a layout: its layers are columns (LeftToRight) or rows (TopDown).

Constructors

Instances

#Course Source

data Course

Forward: with the flow. Backward: an edge the engine turned back to close a cycle (a scan reading what it wrote).

Constructors

Instances

#Box Source

type Box = { height :: Number, width :: Number, x :: Number, y :: Number }

#run Source

run :: forall wire. Engine wire -> Picture -> Projection wire -> Layout wire

An engine's layout of a projection.

#portPoint Source

portPoint :: Box -> PlacedPort -> Point

Where on the picture a port of a box is.

#plainPicture Source

plainPicture :: Picture

No words set and no group outlined.

#openPaths Source

openPaths :: Groups -> { nameOf :: GroupId -> String, pathOf :: ElementKey -> Array GroupId }

The open groups a drawn element is in, outermost first, and every group's name. A step is where Member puts it and an item where Holds does; a closed group's step and its summary are in the groups their group is in; an item a closed group holds that is drawn all the same (an open step writes it) is in the open groups over that group. An element no group holds is in none.

Re-exports from Hylograph.Flow.Render.Sankey

#Widths Source

data Widths wire

How wide an edge is. Plain: every edge one unit, drawn as a hairline. Sankey: the caller reads the width from the edge, which carries what its wires carry (wires: one for a wire, more where the edge crosses undrawn elements, and which of them is the quantity is the domain's to say). A width that is not a positive number is drawn as nothing.

Constructors

#Metrics Source

type Metrics = { hairline :: Number, layerGap :: Number, nodeBreadth :: Number, nodeGap :: Number, restHeight :: Number, unit :: Number }

unit: pixels to one unit of width. hairline: the stroke of a plain edge. nodeBreadth: a node's extent along the flow. layerGap: between one layer and the next. nodeGap: between two nodes of a layer. restHeight: how tall a node is that no edge gives a height.

#widthOf Source

widthOf :: forall wire. Widths wire -> Edge wire -> Number

An edge's width in units under a choice of widths.

#sankey Source

sankey :: forall wire. Metrics -> Widths wire -> Engine wire

The Sankey engine at a scale and a choice of widths.

#defaultMetrics Source