cloudsmith / graph Goto Github PK
View Code? Open in Web Editor NEWA graphviz rendering package with cascading style sheet support
A graphviz rendering package with cascading style sheet support
The graph package is a java/osgi layout package using graphviz as a rendering engine. The package contains an abstraction of Graph, Vertex and Edge and has a Graph Cascading Style Sheet (GCSS) implementation that makes it easy to separate graph structure from styling information. The package requires graphviz to be installed on the host where the package is running in order to produce PNG, JPG, SVG, (and more formats) output, but can be used to produce .dot output without graphviz binary being present. Configuration is done using google guice.
graphviz makes to distinction between attributes that are useful to inherit and those that are not. As an example, if a label is set on a graph, all subgraphs inherit the same title. The reason for this is that an attribute is effective from the point it is declared in the .dot source until redefined.
The way to solve this is to output such attributes just before the element is being closed - i.e. do this:
graph {
subgraph { }
label="my title";
}
... and not
graph {
label="my title";
subgraph { }
}
Suggested fix is that the styles that should be output at the close should have a marker interface and that the dot renderer should treat these styles differently.
The target attribute is currently not included in the style API. It should be.
The root graph output produces a separate subgraph with the root's content. This is wrong as many of the style attributes do not apply to a subgraph.
To draw an edge between two graphs an edge is required between nodes in the respective graphs with clipping set to the graph edge. In dot notation this is:
compound=true;
subgraph cluster_A {
a;
}
subgraph cluster_B {
b;
}
a -> b [lhead=cluster_B, ltail=cluster_A];
Support for this should be added by introducing the two styles "clipHead" and "clipTail" applicable to Edge. They require a Graph as value.
There seems to be no harm in always having "compound = true" set as a style. If not turned out, clipping at subgraph edge (see #3) has no effect. This is simple to add to the default style configuration.
It is possible to nest tables in graphviz cells. This should be supported by the graph package.
Currently default style information is only output for the root graph and this is done by collecting styles from a default GCSS (defined and passed around in the API for this sole purpose). When producing the output, prototype instance of graph, edge and vertex are created and then styled using the GCSS package - the result is output as the default style.
If the GCSS rules instead were written to only apply to identified instances "org.cloudsmith.graph.prototype.edge" etc. then the style rules could be defined in the same package and it would be possible to use a different set of prototypes for different graphs by using an additional containment rule.
The result is that the generated dot output could be much more compact for certain types of graphs where they currently have to have style information per instance.
Currently a graph is a specialization of vertex. This is based on a misunderstanding that it is possible to have edges between graphs. The result of the following dot code is however not all that useful:
subgraph { a; b; c; } -> subgraph { x; y; z; }
as this produces a cartesian product of edges a->x, a->y, a->z, b->x...
Also not that it is not possible to reference a graph, the graph has to be defined in the edge itself.
Therefor support for adding an edge between graphs should be deprecated.
Also see #3
currently, the style "backgroundColor" results in "fillColor" style being rendered. There needs to be a distinction between the two:
bgColor can be applied to Root graph and Clusters, and fillColor can be applied to Clusters, Nodes, Tables and Cell.
When a cell is empty, graphviz generates an error if a FONT is specified.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.