Maintainer | [email protected] |
---|
Data.GraphViz.Attributes
Contents
Description
This module defines the various attributes that different parts of a GraphViz graph can have. These attributes are based on the documentation found at: http://graphviz.org/doc/info/attrs.html
For more information on usage, etc. please see that document.
A summary of known current constraints/limitations/differences:
- There might still be a few cases where quotes are still not
escaped/parsed correctly; if you find such a situation, please
let me know; however, you should be able to use
String
values directly without having to worry about when quotes are required or extra escaping of quote characters asPrintDot
andParseDot
instances forString
should take care of that for you. - Note that for an edge, in Dot parlance if the edge goes from A to B, then A is the tail node and B is the head node (since A is at the tail end of the arrow).
- When parsing named
Color
values, the entire value entered is kept as-is; this library as yet has no understanding of different color schemes, etc. - ColorList and PointfList are defined as actual lists (but
LayerList
is not). Note that for the ColorAttribute
for node values, only a single Color is valid; edges are allowed multiple colors with one spline/arrow per color in the list (but you must have at least oneColor
in the list). This might be changed in future. - Style is implemented as a list of
StyleItem
values; note that empty lists are not allowed. - A lot of values have a possible value of
none
. These now have custom constructors. In fact, most constructors have been expanded upon to give an idea of what they represent rather than using generic terms. -
PointF
andPoint
have been combined, and feature support for pureInt
-based co-ordinates as well asDouble
ones (i.e. no floating point-only points for Point). The optional!
and third value for Point are not available. -
Rect
uses twoPoint
values to denote the lower-left and top-right corners. - The two
LabelLoc
attributes have been combined. - The defined
LayerSep
is not used to parseLayerRange
orLayerList
; the default ([' ',
) is instead used.:
, '\t'] -
SplineType
has been replaced with[
.Spline
] - Only polygon-based
Shape
s are available. -
PortPos
only has theCompassPoint
option, notPortName[:CompassPoint]
(since record shapes aren't allowed, and parsing HTML-like labels could be problematic). - Not every
Attribute
is fully documented/described. However, all those which have specific allowed values should be covered. - Deprecated
Overlap
algorithms are not defined.
- data Attribute
- = Damping Double
- | K Double
- | URL URL
- | ArrowHead ArrowType
- | ArrowSize Double
- | ArrowTail ArrowType
- | Aspect AspectType
- | Bb Rect
- | BgColor Color
- | Center Bool
- | Charset String
- | ClusterRank ClusterMode
- | Color [Color]
- | ColorScheme String
- | Comment String
- | Compound Bool
- | Concentrate Bool
- | Constraint Bool
- | Decorate Bool
- | DefaultDist Double
- | Dim Int
- | Dimen Int
- | Dir DirType
- | DirEdgeConstraints DEConstraints
- | Distortion Double
- | DPI Double
- | EdgeURL URL
- | EdgeTarget EscString
- | EdgeTooltip EscString
- | Epsilon Double
- | ESep DPoint
- | FillColor Color
- | FixedSize Bool
- | FontColor Color
- | FontName String
- | FontNames String
- | FontPath String
- | FontSize Double
- | Group String
- | HeadURL URL
- | HeadClip Bool
- | HeadLabel Label
- | HeadPort PortPos
- | HeadTarget EscString
- | HeadTooltip EscString
- | Height Double
- | ID Label
- | Image String
- | ImageScale ScaleType
- | Label Label
- | LabelURL URL
- | LabelAngle Double
- | LabelDistance Double
- | LabelFloat Bool
- | LabelFontColor Color
- | LabelFontName String
- | LabelFontSize Double
- | LabelJust Justification
- | LabelLoc VerticalPlacement
- | LabelTarget EscString
- | LabelTooltip EscString
- | Landscape Bool
- | Layer LayerRange
- | Layers LayerList
- | LayerSep String
- | Layout String
- | Len Double
- | Levels Int
- | LevelsGap Double
- | LHead String
- | LPos Point
- | LTail String
- | Margin DPoint
- | MaxIter Int
- | MCLimit Double
- | MinDist Double
- | MinLen Int
- | Mode ModeType
- | Model Model
- | Mosek Bool
- | NodeSep Double
- | NoJustify Bool
- | Normalize Bool
- | Nslimit Double
- | Nslimit1 Double
- | Ordering String
- | Orientation Double
- | OrientationGraph String
- | OutputOrder OutputMode
- | Overlap Overlap
- | OverlapScaling Double
- | Pack Pack
- | PackMode PackMode
- | Pad DPoint
- | Page Point
- | PageDir PageDir
- | PenColor Color
- | PenWidth Double
- | Peripheries Int
- | Pin Bool
- | Pos Pos
- | QuadTree QuadType
- | Quantum Double
- | Rank RankType
- | RankDir RankDir
- | Ranksep Double
- | Ratio Ratios
- | Rects Rect
- | Regular Bool
- | ReMinCross Bool
- | RepulsiveForce Double
- | Root Root
- | Rotate Int
- | SameHead String
- | SameTail String
- | SamplePoints Int
- | SearchSize Int
- | Sep DPoint
- | Shape Shape
- | ShapeFile String
- | ShowBoxes Int
- | Sides Int
- | Size Point
- | Skew Double
- | Smoothing SmoothType
- | SortV Int
- | Splines EdgeType
- | Start StartType
- | Style [StyleItem]
- | StyleSheet String
- | TailURL URL
- | TailClip Bool
- | TailLabel Label
- | TailPort PortPos
- | TailTarget EscString
- | TailTooltip EscString
- | Target EscString
- | Tooltip EscString
- | TrueColor Bool
- | Vertices [Point]
- | ViewPort ViewPort
- | VoroMargin Double
- | Weight Double
- | Width Double
- | Z Double
- type Attributes = [Attribute]
- usedByGraphs :: Attribute -> Bool
- usedBySubGraphs :: Attribute -> Bool
- usedByClusters :: Attribute -> Bool
- usedByNodes :: Attribute -> Bool
- usedByEdges :: Attribute -> Bool
- type EscString = String
- newtype URL = UStr {}
- newtype ArrowType = AType [(ArrowModifier, ArrowShape)]
- data AspectType
- data Rect = Rect Point Point
- data Color
- data ClusterMode
- data DirType
- data DEConstraints
- data DPoint
- data ModeType
- data Model
- data Label
- data Point
- data Overlap
- data LayerRange
- data LayerID
- data LayerList = LL String [(String, String)]
- data OutputMode
- = BreadthFirst
- | NodesFirst
- | EdgesFirst
- data Pack
- = DoPack
- | DontPack
- | PackMargin Int
- data PackMode
- data Pos
- data EdgeType
- = SplineEdges
- | LineEdges
- | NoEdges
- | PolyLine
- | CompoundEdge
- data PageDir
- data Spline = Spline (Maybe Point) (Maybe Point) [Point]
- data QuadType
- data Root
- = IsCentral
- | NotCentral
- | NodeName String
- data RankType
- = SameRank
- | MinRank
- | SourceRank
- | MaxRank
- | SinkRank
- data RankDir
- = FromTop
- | FromLeft
- | FromBottom
- | FromRight
- data Shape
- = BoxShape
- | Polygon
- | Ellipse
- | Circle
- | PointShape
- | Egg
- | Triangle
- | PlainText
- | DiamondShape
- | Trapezium
- | Parallelogram
- | House
- | Pentagon
- | Hexagon
- | Septagon
- | Octagon
- | DoubleCircle
- | DoubleOctagon
- | TripleOctagon
- | InvTriangle
- | InvTrapezium
- | InvHouse
- | MDiamond
- | MSquare
- | MCircle
- | Note
- | Tab
- | Folder
- | Box3D
- | Component
- data SmoothType
- data StartType
- data STStyle
- = RegularStyle
- | SelfStyle
- | RandomStyle
- data StyleItem = SItem StyleName [String]
- data StyleName
- newtype PortPos = PP CompassPoint
- data CompassPoint
- data ViewPort = VP {}
- data FocusType
- data VerticalPlacement
- data ScaleType
- = UniformScale
- | NoScale
- | FillWidth
- | FillHeight
- | FillBoth
- data Justification
- data Ratios
- = AspectRatio Double
- | FillRatio
- | CompressRatio
- | ExpandRatio
- | AutoRatio
- data ArrowShape
- data ArrowModifier = ArrMod {}
- data ArrowFill
- = OpenArrow
- | FilledArrow
- data ArrowSide
- box :: ArrowType
- crow :: ArrowType
- diamond :: ArrowType
- dotArrow :: ArrowType
- inv :: ArrowType
- noArrow :: ArrowType
- normal :: ArrowType
- tee :: ArrowType
- vee :: ArrowType
- oDot :: ArrowType
- invDot :: ArrowType
- invODot :: ArrowType
- oBox :: ArrowType
- oDiamond :: ArrowType
- eDiamond :: ArrowType
- openArr :: ArrowType
- halfOpen :: ArrowType
- emptyArr :: ArrowType
- invEmpty :: ArrowType
- noMods :: ArrowModifier
- openMod :: ArrowModifier
The actual Dot attributes.
These attributes have been implemented in a permissive manner: that is, rather than split them up based on which type of value they are allowed, they have all been included in the one data type, with functions to determine if they are indeed valid for what they're being applied to.
To interpret the Valid for listings:
G
- Valid for Graphs.
C
- Valid for Clusters.
S
- Valid for Sub-Graphs (and also Clusters).
N
- Valid for Nodes.
E
- Valid for Edges.
The Default listings are those that the various GraphViz commands
use if that Attribute
isn't specified (in cases where this is
none, this is equivalent to a Nothing
value; that is, no value
is used). The Parsing Default listings represent what value is
used (i.e. corresponds to True
) when the Attribute
name is
listed on its own in Dot source code.
Constructors
Damping Double | Valid for: G; Default: |
K Double | Valid for: GC; Default: |
URL URL | Valid for: ENGC; Default: none; Notes: svg, postscript, map only |
ArrowHead ArrowType | Valid for: E; Default: |
ArrowSize Double | Valid for: E; Default: |
ArrowTail ArrowType | Valid for: E; Default: |
Aspect AspectType | Valid for: G; Notes: dot only |
Bb Rect | Valid for: G; Notes: write only |
BgColor Color | Valid for: GC; Default: none |
Center Bool | |
Charset String | Valid for: G; Default: |
ClusterRank ClusterMode | Valid for: G; Default: |
Color [Color] | Valid for: ENC; Default: |
ColorScheme String | Valid for: ENCG; Default: |
Comment String | Valid for: ENG; Default: |
Compound Bool | Valid for: G; Default: |
Concentrate Bool | |
Constraint Bool | Valid for: E; Default: |
Decorate Bool | |
DefaultDist Double | Valid for: G; Default: |
Dim Int | Valid for: G; Default: |
Dimen Int | Valid for: G; Default: |
Dir DirType | Valid for: E; Default: |
DirEdgeConstraints DEConstraints | Valid for: G; Default: |
Distortion Double | Valid for: N; Default: |
DPI Double | Valid for: G; Default: |
EdgeURL URL | Valid for: E; Default: |
EdgeTarget EscString | Valid for: E; Default: none; Notes: svg, map only |
EdgeTooltip EscString | Valid for: E; Default: |
Epsilon Double | Valid for: G; Default: |
ESep DPoint | Valid for: G; Default: |
FillColor Color | Valid for: NC; Default: |
FixedSize Bool | |
FontColor Color | Valid for: ENGC; Default: |
FontName String | Valid for: ENGC; Default: |
FontNames String | Valid for: G; Default: |
FontPath String | Valid for: G; Default: system-dependent |
FontSize Double | Valid for: ENGC; Default: |
Group String | Valid for: N; Default: |
HeadURL URL | Valid for: E; Default: |
HeadClip Bool | |
HeadLabel Label | Valid for: E; Default: |
HeadPort PortPos | Valid for: E; Default: |
HeadTarget EscString | Valid for: E; Default: none; Notes: svg, map only |
HeadTooltip EscString | Valid for: E; Default: |
Height Double | Valid for: N; Default: |
ID Label | Valid for: GNE; Default: |
Image String | Valid for: N; Default: |
ImageScale ScaleType | Valid for: N; Default: |
Label Label | Valid for: ENGC; Default: |
LabelURL URL | Valid for: E; Default: |
LabelAngle Double | Valid for: E; Default: |
LabelDistance Double | Valid for: E; Default: |
LabelFloat Bool | |
LabelFontColor Color | Valid for: E; Default: |
LabelFontName String | Valid for: E; Default: |
LabelFontSize Double | Valid for: E; Default: |
LabelJust Justification | Valid for: GC; Default: |
LabelLoc VerticalPlacement | Valid for: GCN; Default: |
LabelTarget EscString | Valid for: E; Default: none; Notes: svg, map only |
LabelTooltip EscString | Valid for: E; Default: |
Landscape Bool | |
Layer LayerRange | Valid for: EN; Default: |
Layers LayerList | Valid for: G; Default: |
LayerSep String | Valid for: G; Default: |
Layout String | Valid for: G; Default: |
Len Double | Valid for: E; Default: |
Levels Int | Valid for: G; Default: |
LevelsGap Double | Valid for: G; Default: |
LHead String | Valid for: E; Default: |
LPos Point | Valid for: EGC; Notes: write only |
LTail String | Valid for: E; Default: |
Margin DPoint | Valid for: NG; Default: device-dependent |
MaxIter Int | Valid for: G; Default: |
MCLimit Double | Valid for: G; Default: |
MinDist Double | Valid for: G; Default: |
MinLen Int | Valid for: E; Default: |
Mode ModeType | Valid for: G; Default: |
Model Model | Valid for: G; Default: |
Mosek Bool | Valid for: G; Default: |
NodeSep Double | Valid for: G; Default: |
NoJustify Bool | |
Normalize Bool | Valid for: G; Default: |
Nslimit Double | Valid for: G; Notes: dot only |
Nslimit1 Double | Valid for: G; Notes: dot only |
Ordering String | Valid for: G; Default: |
Orientation Double | Valid for: N; Default: |
OrientationGraph String | Valid for: G; Default: |
OutputOrder OutputMode | Valid for: G; Default: |
Overlap Overlap | Valid for: G; Default: |
OverlapScaling Double | Valid for: G; Default: |
Pack Pack | Valid for: G; Default: |
PackMode PackMode | Valid for: G; Default: |
Pad DPoint | Valid for: G; Default: |
Page Point | Valid for: G |
PageDir PageDir | Valid for: G; Default: |
PenColor Color | Valid for: C; Default: |
PenWidth Double | Valid for: CNE; Default: |
Peripheries Int | Valid for: NC; Default: shape default (nodes), |
Pin Bool | Valid for: N; Default: |
Pos Pos | Valid for: EN |
QuadTree QuadType | Valid for: G; Default: |
Quantum Double | Valid for: G; Default: |
Rank RankType | Valid for: S; Notes: dot only |
RankDir RankDir | Valid for: G; Default: |
Ranksep Double | Valid for: G; Default: |
Ratio Ratios | Valid for: G |
Rects Rect | Valid for: N; Notes: write only |
Regular Bool | |
ReMinCross Bool | Valid for: G; Default: |
RepulsiveForce Double | Valid for: G; Default: |
Root Root | Valid for: GN; Default: |
Rotate Int | Valid for: G; Default: |
SameHead String | Valid for: E; Default: |
SameTail String | Valid for: E; Default: |
SamplePoints Int | Valid for: N; Default: |
SearchSize Int | Valid for: G; Default: |
Sep DPoint | Valid for: G; Default: |
Shape Shape | Valid for: N; Default: |
ShapeFile String | Valid for: N; Default: |
ShowBoxes Int | Valid for: ENG; Default: |
Sides Int | Valid for: N; Default: |
Size Point | Valid for: G |
Skew Double | Valid for: N; Default: |
Smoothing SmoothType | Valid for: G; Default: |
SortV Int | Valid for: GCN; Default: |
Splines EdgeType | Valid for: G; Parsing Default: |
Start StartType | Valid for: G; Default: |
Style [StyleItem] | Valid for: ENC |
StyleSheet String | Valid for: G; Default: |
TailURL URL | Valid for: E; Default: |
TailClip Bool | |
TailLabel Label | Valid for: E; Default: |
TailPort PortPos | Valid for: E; Default: center |
TailTarget EscString | Valid for: E; Default: none; Notes: svg, map only |
TailTooltip EscString | Valid for: E; Default: |
Target EscString | Valid for: ENGC; Default: none; Notes: svg, map only |
Tooltip EscString | Valid for: NEC; Default: |
TrueColor Bool | Valid for: G; Parsing Default: |
Vertices [Point] | Valid for: N; Notes: write only |
ViewPort ViewPort | Valid for: G; Default: none |
VoroMargin Double | Valid for: G; Default: |
Weight Double | Valid for: E; Default: |
Width Double | Valid for: N; Default: |
Z Double | Valid for: N; Default: |
type Attributes = [Attribute]Source
Validity functions on Attribute
values.
usedByGraphs :: Attribute -> BoolSource
Determine if this Attribute is valid for use with Graphs.
usedBySubGraphs :: Attribute -> BoolSource
Determine if this Attribute is valid for use with SubGraphs.
usedByClusters :: Attribute -> BoolSource
Determine if this Attribute is valid for use with Clusters.
usedByNodes :: Attribute -> BoolSource
Determine if this Attribute is valid for use with Nodes.
usedByEdges :: Attribute -> BoolSource
Determine if this Attribute is valid for use with Edges.
Value types for Attribute
s.
Some Attribute
s (mainly label-like ones) take a String
argument
that allows for extra escape codes. This library doesn't do any
extra checks or special parsing for these escape codes, but usage
of EscString
rather than String
indicates that the GraphViz
tools will recognise these extra escape codes for these
Attribute
s.
The extra escape codes include (note that these are all String
s):
\N
- Replace with the name of the node (for Node
Attribute
s). \G
- Replace with the name of the graph (for Node
Attribute
s) or the name of the graph or cluster, whichever is applicable (for Graph, Cluster and EdgeAttribute
s). \E
- Replace with the name of the edge, formed by the two
adjoining nodes and the edge type (for Edge
Attribute
s). \T
- Replace with the name of the tail node (for Edge
Attribute
s). \H
- Replace with the name of the head node (for Edge
Attribute
s). \L
- Replace with the object's label (for all
Attribute
s).
Also, if the Attribute
in question is Label
, HeadLabel
or
TailLabel
, then \n
, \l
and \r
split the label into lines
centered, left-justified and right-justified respectively.
Dot has a basic grammar of arrow shapes which allows usage of
up to 1,544,761 different shapes from 9 different basic
ArrowShape
s. Note that whilst an explicit list is used in the
definition of ArrowType
, there must be at least one tuple and a
maximum of 4 (since that is what is required by Dot). For more
information, see: http://graphviz.org/doc/info/arrows.html
The 19 basic arrows shown on the overall attributes page have been defined below as a convenience. Parsing of the 5 backward-compatible special cases is also supported.
Constructors
AType [(ArrowModifier, ArrowShape)] |
data AspectType Source
Constructors
RatioOnly Double | |
RatioPassCount Double Int |
data ClusterMode Source
data DEConstraints Source
Only when mode ==
.
IpSep
Constructors
EdgeConstraints | |
NoConstraints | |
HierConstraints |
Constructors
KeepOverlaps | |
RemoveOverlaps | |
ScaleOverlaps | |
ScaleXYOverlaps | |
PrismOverlap (Maybe Int) | Only when sfdp is available, |
CompressOverlap | |
VpscOverlap | |
IpsepOverlap | Only when |
data LayerRange Source
The list represent (Separator, Name)
data OutputMode Source
Constructors
BreadthFirst | |
NodesFirst | |
EdgesFirst |
Constructors
DoPack | |
DontPack | |
PackMargin Int | If non-negative, then packs; otherwise doesn't. |
Controls how (and if) edges are represented.
Constructors
SplineEdges | |
LineEdges | |
NoEdges | |
PolyLine | |
CompoundEdge | fdp only |
Upper-case first character is major order; lower-case second character is minor order.
The number of points in the list must be equivalent to 1 mod 3; note that this is not checked.
Specify the root node either as a Node attribute or a Graph attribute.
Constructors
IsCentral | For Nodes only |
NotCentral | For Nodes only |
NodeName String | For Graphs only |
Constructors
SameRank | |
MinRank | |
SourceRank | |
MaxRank | |
SinkRank |
Constructors
FromTop | |
FromLeft | |
FromBottom | |
FromRight |
Constructors
BoxShape | Has synonyms of rect and rectangle. |
Polygon | |
Ellipse | |
Circle | |
PointShape | |
Egg | |
Triangle | |
PlainText | Has synonym of none. |
DiamondShape | |
Trapezium | |
Parallelogram | |
House | |
Pentagon | |
Hexagon | |
Septagon | |
Octagon | |
DoubleCircle | |
DoubleOctagon | |
TripleOctagon | |
InvTriangle | |
InvTrapezium | |
InvHouse | |
MDiamond | |
MSquare | |
MCircle | |
Note | |
Tab | |
Folder | |
Box3D | |
Component |
data SmoothType Source
It is assumed that at least one of these is Just{}
.
Constructors
StartStyle STStyle | |
StartSeed Int | |
StartStyleSeed STStyle Int |
Constructors
RegularStyle | |
SelfStyle | |
RandomStyle |
Constructors
PP CompassPoint |
data CompassPoint Source
data VerticalPlacement Source
Constructors
UniformScale | |
NoScale | |
FillWidth | |
FillHeight | |
FillBoth |
data Justification Source
Constructors
AspectRatio Double | |
FillRatio | |
CompressRatio | |
ExpandRatio | |
AutoRatio |
Types representing the Dot grammar for ArrowType
.
data ArrowShape Source
data ArrowModifier Source
What modifications to apply to an ArrowShape
.
Constructors
OpenArrow | |
FilledArrow |
Represents which side (when looking towards the node the arrow is pointing to) is drawn.
Default ArrowType
aliases.
The 9 primitive ArrowShape
s.
5 derived Arrows.
5 supported cases for backwards compatibility
ArrowModifier
instances
Apply no modifications to an ArrowShape
.