Dhole

Dhole is a small language for charts and diagrams written as text. You name what to draw on the first line and say what it shows on the lines after; Dhole lays it out and draws it.

flowchart Making tea
Thirsty? [start] -> Boil the kettle -> Tea or coffee?
Tea or coffee? -> Steep the tea: tea
Tea or coffee? -> Brew the coffee: coffee
Steep the tea -> Enjoy [end, good]
Brew the coffee -> Enjoy

The text above, drawn: a flowchart from Thirsty? through Boil the kettle to a question, Tea or coffee?, whose two answers meet again at Enjoy

A diagram written as text is quick to write and easy to change - add a line and the picture makes room for it - and it reads on its own, in a document, a message or a version history. Dhole draws through Divooka's plotting framework, so a Dhole diagram is a chart like any other: it previews on its node, takes a theme, and saves as a picture at any resolution, an SVG, a PDF or a PowerPoint slide.

What it draws

Kind First word Page
Flowchart flowchart Flowcharts
Sequence diagram sequence Sequence diagrams
State diagram state State diagrams
Class diagram class Class diagrams
Entity diagram entity Entity diagrams
Mind map and organisation chart mindmap Mind maps
Timeline timeline Timelines
Gantt chart gantt Gantt charts
Pie, donut, bar, line, scatter and radar charts pie, donut, bar, line, xy, radar Charts
Quadrant chart quadrant Quadrant charts
Sankey diagram sankey Sankey diagrams
Table and board table, kanban Tables and boards

Read in this order

  1. Tutorial - your first diagram in Divooka Compute, from an example to a text of your own.
  2. The language - what every kind shares: the first line, settings, names, labels, attributes, colours, arrows, indentation, several diagrams in one text, and themes.
  3. The page of each kind above, with every word it takes.
  4. Problems - what Dhole says about a text it cannot read as written, and how to mend it.
  5. Examples - the Dhole examples that come with Divooka Compute.
  6. Dhole and Mermaid - for anybody who knows Mermaid: what is the same, what is different, and why.

Dhole in Divooka

Three nodes in the Plotting toolbox, brought by the Data Analytics workload:

  • Draw Dhole, in the Dhole category, takes Dhole text and gives the chart, and on its Problems output each problem in the text as a line. Select it after a run to see the picture in Properties.
  • Describe Dhole, in the Dhole category, takes Dhole text and gives a sentence saying what it draws - A flowchart of 6 steps and 6 arrows. - the words a picture needs for somebody who cannot see it.
  • Write Dhole, in the Dhole Writing category, keeps its text on the node. Double-click it and its card opens with the text on the left and the picture on the right, redrawn a moment after each change, and anything wrong with the text listed under them.

Write Dhole's card: a board written as text on the left, drawn on the right

Draw Dhole's chart goes anywhere a chart goes: into Save Chart to write a PNG, an SVG, a PDF or an Office document, into Set Theme to recolour it, or into a report.

Dhole in code

The package is Divooka.Visualization.Dhole, and the language is specified in Dhole Language.md beside it.

using Divooka.Visualization.Dhole;

DholeResult result = Dhole.Read(text);       // the figure, every problem, and a sentence of what was drawn
foreach (DholeProblem problem in result.Problems)
    Console.WriteLine(problem);               // Line 3, column 7: 'lots' is not a number. Write a number with a dot for its decimals, such as 12.5.
result.Figure?.SavePng("diagram.png", 192);   // or SaveSvg, SavePdf, SavePptx, ToImage

Figure figure = Dhole.Draw(text);              // throws DholeException only when nothing in the text can be drawn

The same text always gives the same picture, on every machine: nothing in Dhole reads the clock, the culture or a random number.

References