Diagram
TsgcHTMLComponent_Diagram — renderizza un diagramma di flusso con nodi e frecce come SVG inline, posizionando i nodi a coordinate fisse e collegandoli con frecce etichettate, in Delphi, C++ Builder e .NET.
TsgcHTMLComponent_Diagram — renderizza un diagramma di flusso con nodi e frecce come SVG inline, posizionando i nodi a coordinate fisse e collegandoli con frecce etichettate, in Delphi, C++ Builder e .NET.
Un componente flowchart che emette un <svg> inline autonomo. Aggiungi i nodi a coordinate X/Y, collegali con frecce, quindi leggi la proprietà HTML.
TsgcHTMLComponent_Diagram
Inline <svg> nodes and arrows
Delphi, C++ Builder, .NET
Chiama AddNode per ogni riquadro (con la sua posizione, colore e forma), collegali con Connect, quindi leggi 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
I membri che utilizzerai più spesso.
Nodes (TsgcHTMLDiagramNodes) contiene i riquadri; ogni TsgcHTMLDiagramNode espone NodeID, Text, X, Y, Width, Height, Color e Shape.
AddNode(aID, aText, aX, aY, aColor, aShape) aggiunge un nodo e lo restituisce; aColor è un TsgcHTMLColor, aShape un TsgcHTMLDiagramNodeShape.
TsgcHTMLDiagramNodeShape offre nsRectangle, nsRoundedRect, nsCircle e nsDiamond.
Connections (TsgcHTMLDiagramConnections) contiene le frecce; ogni TsgcHTMLDiagramConnection ha FromNode, ToNode, Label_ e Color.
Connect(aFromID, aToID, aLabel_) disegna una freccia etichettata tra due nodi indicati dal loro NodeID.
DiagramWidth, DiagramHeight e DiagramID dimensionano e identificano l’SVG; HTML restituisce l’<svg> inline con le frecce disegnate dietro i nodi.