graphviz-scala_2.13

A Scala Representation for Graphviz files

License

License

MIT
Categories

Categories

Scala Languages
GroupId

GroupId

berlin.softwaretechnik
ArtifactId

ArtifactId

graphviz-scala_2.13
Last Version

Last Version

0.0.7
Release Date

Release Date

Type

Type

jar
Description

Description

graphviz-scala_2.13
A Scala Representation for Graphviz files
Project URL

Project URL

https://github.com/softwaretechnik-berlin/graphviz-scala
Source Code Management

Source Code Management

https://github.com/softwaretechnik-berlin/graphviz-scala

Download graphviz-scala_2.13

How to add to project

<!-- https://jarcasting.com/artifacts/berlin.softwaretechnik/graphviz-scala_2.13/ -->
<dependency>
    <groupId>berlin.softwaretechnik</groupId>
    <artifactId>graphviz-scala_2.13</artifactId>
    <version>0.0.7</version>
</dependency>
// https://jarcasting.com/artifacts/berlin.softwaretechnik/graphviz-scala_2.13/
implementation 'berlin.softwaretechnik:graphviz-scala_2.13:0.0.7'
// https://jarcasting.com/artifacts/berlin.softwaretechnik/graphviz-scala_2.13/
implementation ("berlin.softwaretechnik:graphviz-scala_2.13:0.0.7")
'berlin.softwaretechnik:graphviz-scala_2.13:jar:0.0.7'
<dependency org="berlin.softwaretechnik" name="graphviz-scala_2.13" rev="0.0.7">
  <artifact name="graphviz-scala_2.13" type="jar" />
</dependency>
@Grapes(
@Grab(group='berlin.softwaretechnik', module='graphviz-scala_2.13', version='0.0.7')
)
libraryDependencies += "berlin.softwaretechnik" % "graphviz-scala_2.13" % "0.0.7"
[berlin.softwaretechnik/graphviz-scala_2.13 "0.0.7"]

Dependencies

compile (3)

Group / Artifact Type Version
org.scala-lang.modules : scala-xml_2.13 jar 1.3.0
com.lihaoyi : os-lib_2.13 jar 0.7.1
org.apache.commons : commons-text jar 1.9

Project Modules

There are no modules declared in this project.

Scala Library to Produce Graphviz dot-Files

Maven Central

This library provides a (somewhat) type safe interface into the Graphviz DOT language. It provides a case class representation of the core elements and their attribute.

It isn't a full representation of all legal graphviz files. It doesn't support the assignment of attribute values at arbitrary positions in the code.

Here is an example (full source):

val dotString = Graph(
  attributes = GraphAttributes(fontname = "Helvetica", fontsize = 16),
  nodeDefaults = NodeAttributes(fontname = "Helvetica", fontsize = 16),
  edgeDefaults = EdgeAttributes(fontname = "Helvetica", fontsize = 16),
  elements = Seq(
    Node("A", NodeAttributes(
      shape = none,
      label = Table(
        TableAttributes(color = Color("gray"), border = 0, cellSpacing = 0, cellBorder = 1, cellPadding = 3),
        Seq(
          Seq(Cell(TextList(Seq(Plain("Good "), StyleTag("I", Plain("bye!")))))),
          Seq(Cell(TableCellAttributes(align = Align.Left), StyleTag("B", StyleTag("U", Plain("Hello!"))))),
          Seq(Cell(TableCellAttributes(align = Align.Left), b(u("Hello!"),"No underline."))),
          Seq(Cell(TableCellAttributes(align = Align.Left), textAttr(bold = true, color = Color("#00D000"))("Does this work?"))),
        )))),
    Node("C"),
    SubGraph(attributes = SubgraphAttributes(rank = same), elements = Seq(
      Node("B", NodeAttributes(shape = box, label = new Plain("Two\nLines"))),
      Node("D", NodeAttributes(color = Color("#FF0000"))),
    )),
    Edge("A", "B", EdgeAttributes(label = new Plain("This is a label"))),
    Edge("A", "C"),
    Edge("B", "C"),
    Edge("B", "D", EdgeAttributes(style = dashed)),
  )
).render

This will yield the following output (Click for dot-source):

TODO

  • Implement basic validation.
  • Implement basic graph transformations.
  • Implement more missing attribute types.
  • Some attribute grouping mechanism that works across different kinds of attributes.
  • Separate code that is used to generate code from the graphviz schema from the actual library. |
  • Add support for node port short cut syntax

Done

  • Deploy to maven central.

  • Support for HTML like labels

    • Support font attributes
    • Come up with a nicer model for formatted text.
  • Fix various attribute types e.g. ArrowHead

  • Proper String escaping

  • Convert example into an actual test case.

    |
    
berlin.softwaretechnik

softwaretechnik.berlin

Softwaretechnik – software development team based in Berlin

Versions

Version
0.0.7
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1