goyalarchit / elm-dagre / Render.StandardDrawers.Attributes

This module provides attributes for configuring draw, svgNodeDrawer and svgEdgeDrawer given in Dagre.Render.

Note : This module uses elm-community/typed-svg, so don't confuse Svg as elm/svg.

Type


type alias Attribute c =
c -> c

Attribute type for Standard Drawers

Attributes Table

Please see the following table that maps which attributes are allowed for which drawers.

| S.No. | Attribute Name       | Node's XLabel  | Node  | Edge  |
|-------|----------------------|----------------|-------|-------|
| 1     | label                | ✅             | ✅    | ✅    |
| 2     | fontSize             | ✅             | ✅    | ✅    |
| 3     | strokeColor          | ✅             | ✅    | ✅    |
| 4     | strokeWidth          | ✅             | ✅    | ✅    |
| 5     | strokeDashArray      | ✅             | ✅    | ✅    |
| 6     | title                | ✅             | ✅    | ✅    |
| 7     | onClick              | ❌             | ✅    | ✅    |
| 8     | style                | ❌             | ✅    | ✅    |
| 9     | fill                 | ✅             | ✅    | ❌    |
| 10    | shape                | ✅             | ✅    | ❌    |
| 11    | xLabels              | ✅             | ✅    | ❌    |
| 12    | arrowHead            | ❌             | ❌    | ✅    |
| 13    | linkStyle            | ❌             | ❌    | ✅    |
| 14    | alpha                | ❌             | ❌    | ✅    |
| 15    | orientLabelAlongEdge | ❌             | ❌    | ✅    |
| 16    | pos                  | ✅             | ❌    | ❌    |

Common Attributes

The following attributes can be used on Node, Node's xLabels and Edge Drawers.

label : (a -> String) -> Attribute { c | label : a -> String }

The following attribute can be used to set label on node/edge/xlabel.

onClick : (a -> msg) -> Attribute { c | onClick : Maybe (a -> msg) }

To add event handlers to Nodes and Edges

fontSize : Basics.Float -> Attribute { c | fontSize : Basics.Float }

To set the font Size for label of a node/edge/xlabel

strokeColor : (a -> Color) -> Attribute { c | strokeColor : a -> Color }

To set the stroke color of a node/edge/xlabel

strokeWidth : (a -> Basics.Float) -> Attribute { c | strokeWidth : a -> Basics.Float }

To set the stroke width of a node/edge/xlabel

strokeDashArray : (a -> String) -> Attribute { c | strokeDashArray : a -> String }

To set the stroke dash array of a node/edge/xlabel

style : (a -> String) -> Attribute { c | style : a -> String }

To add any inline css to path element of the edge, or polygon of node.

title : (a -> String) -> Attribute { c | title : a -> String }

To set the title (appears as a tooltip) of a node/edge/xlabel

EdgeDrawer Attributes

arrowHead : Render.StandardDrawers.Types.ArrowHeadShape -> Attribute (Render.StandardDrawers.ConfigTypes.EdgeDrawerConfig e msg)

This attributes sets the type of arrow head used for drawing the edge. The possible values are None, Triangle, Vee.

linkStyle : Render.StandardDrawers.Types.LinkStyle -> Attribute (Render.StandardDrawers.ConfigTypes.EdgeDrawerConfig e msg)

Set the style used for drawing links. The possible values are polyline and splines

alpha : Basics.Float -> Attribute (Render.StandardDrawers.ConfigTypes.EdgeDrawerConfig e msg)

Set alpha used for drawing the spline using Catmull-Rom

Note: alpha>=0.5 produces centripetal splines , which are useful to avoid self-intersections and overshoots. ref

orientLabelAlongEdge : Basics.Bool -> Attribute (Render.StandardDrawers.ConfigTypes.EdgeDrawerConfig e msg)

To set the label orientation along the curvature of edge

NodeDrawer Attributes

fill : (a -> Color) -> Attribute { c | fill : a -> Color }

To add fill colour to Node and xLabel of node

shape : (Graph.Node n -> Render.StandardDrawers.Types.Shape) -> Attribute { c | shape : Graph.Node n -> Render.StandardDrawers.Types.Shape }

This attributes sets the shape of Node used for drawing the node. The possible values are Circle, Ellipse, Box, RoundedBox.

xLabels : List (Render.Types.NodeAttributes n -> TypedSvg.Core.Svg msg) -> Attribute (Render.StandardDrawers.ConfigTypes.NodeDrawerConfig n msg)

Set the Extra Labels for a node.

xLabelDrawer Attributes

pos : (Graph.Node n -> Basics.Float -> Basics.Float -> ( Basics.Float, Basics.Float )) -> Attribute (Render.StandardDrawers.ConfigTypes.XLabelDrawerConfig n)

Used to set the position of Extra Label relative to the node.