Diagram Component — sgcHTML | eSeGeCe

Diagram

TsgcHTMLComponent_Diagram — render a node-and-arrow flow diagram as inline SVG, placing nodes at fixed coordinates and connecting them with labelled arrows, in Delphi, C++ Builder and .NET.

TsgcHTMLComponent_Diagram

A flowchart component that emits a self-contained inline <svg>. Add nodes at X/Y coordinates, connect them with arrows, then read the HTML property.

Component class

TsgcHTMLComponent_Diagram

Renders

Inline <svg> nodes and arrows

Languages

Delphi, C++ Builder, .NET

Add nodes, connect them, render it

Call AddNode for each box (with its position, colour and shape), wire them with Connect, then read HTML.

uses
  sgcHTML_Enums, sgcHTML_Component_Diagram;

var
  oDiagram: TsgcHTMLComponent_Diagram;
begin
  oDiagram := TsgcHTMLComponent_Diagram.Create(nil);
  try
    oDiagram.DiagramWidth := 600;
    oDiagram.DiagramHeight := 300;

    oDiagram.AddNode('start', 'Start', 240, 20, hcSuccess, nsCircle);
    oDiagram.AddNode('work', 'Process', 240, 120, hcPrimary, nsRoundedRect);
    oDiagram.AddNode('done', 'Finish', 240, 220, hcDanger, nsDiamond);

    oDiagram.Connect('start', 'work', 'begin');
    oDiagram.Connect('work', 'done', 'commit');

    WebModule.Response := oDiagram.HTML;   // inline <svg> flow diagram
  finally
    oDiagram.Free;
  end;
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Diagram.hpp

TsgcHTMLComponent_Diagram *oDiagram = new TsgcHTMLComponent_Diagram(NULL);
try
{
  oDiagram->DiagramWidth = 600;
  oDiagram->DiagramHeight = 300;

  oDiagram->AddNode("start", "Start", 240, 20, hcSuccess, nsCircle);
  oDiagram->AddNode("work", "Process", 240, 120, hcPrimary, nsRoundedRect);
  oDiagram->AddNode("done", "Finish", 240, 220, hcDanger, nsDiamond);

  oDiagram->Connect("start", "work", "begin");
  oDiagram->Connect("work", "done", "commit");

  String html = oDiagram->HTML;   // inline <svg> flow diagram
}
__finally
{
  delete oDiagram;
}
using esegece.sgcWebSockets;

var diagram = new TsgcHTMLComponent_Diagram();
diagram.DiagramWidth = 600;
diagram.DiagramHeight = 300;

diagram.AddNode("start", "Start", 240, 20, TsgcHTMLColor.hcSuccess, TsgcHTMLDiagramNodeShape.nsCircle);
diagram.AddNode("work", "Process", 240, 120, TsgcHTMLColor.hcPrimary, TsgcHTMLDiagramNodeShape.nsRoundedRect);
diagram.AddNode("done", "Finish", 240, 220, TsgcHTMLColor.hcDanger, TsgcHTMLDiagramNodeShape.nsDiamond);

diagram.Connect("start", "work", "begin");
diagram.Connect("work", "done", "commit");

string html = diagram.HTML;   // inline <svg> flow diagram

Key properties & methods

The members you reach for most often.

Nodes

Nodes (TsgcHTMLDiagramNodes) holds the boxes; each TsgcHTMLDiagramNode exposes NodeID, Text, X, Y, Width, Height, Color and Shape.

Add a node

AddNode(aID, aText, aX, aY, aColor, aShape) appends a node and returns it; aColor is a TsgcHTMLColor, aShape a TsgcHTMLDiagramNodeShape.

Shapes

TsgcHTMLDiagramNodeShape offers nsRectangle, nsRoundedRect, nsCircle and nsDiamond.

Connections

Connections (TsgcHTMLDiagramConnections) holds the arrows; each TsgcHTMLDiagramConnection has FromNode, ToNode, Label_ and Color.

Connect nodes

Connect(aFromID, aToID, aLabel_) draws a labelled arrow between two nodes referenced by their NodeID.

Canvas & output

DiagramWidth, DiagramHeight and DiagramID size and identify the SVG; HTML returns the inline <svg> with arrows drawn behind the nodes.

Keep exploring

Online HelpFull API reference and usage guide for this component.
All sgcHTML ComponentsBrowse the full feature matrix of 80+ components.
Download Free TrialThe 30-day trial ships the 60.HTML demo projects.
PricingSingle, Team and Site licenses with full source code.
Best value: All-AccessEvery eSeGeCe product, Premium Support included, from €1,059/year.
See All-Access pricing

Ready to Get Started?

Download the free trial and add flow diagrams to your Delphi, C++ Builder or .NET web app.