diagram

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector interface {
	Connect(start, end *Node, opts ...EdgeOption) Connector
	ConnectByID(start, end string, opts ...EdgeOption) Connector
}

type Diagram

type Diagram struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) (*Diagram, error)

func (*Diagram) Add

func (d *Diagram) Add(ns ...*Node) *Diagram

func (*Diagram) Close

func (d *Diagram) Close() error

func (*Diagram) Connect

func (d *Diagram) Connect(start, end *Node, opts ...EdgeOption) *Diagram

func (*Diagram) ConnectByID

func (d *Diagram) ConnectByID(start, end string, opts ...EdgeOption) *Diagram

func (*Diagram) Edges

func (d *Diagram) Edges() []*Edge

func (*Diagram) Group

func (d *Diagram) Group(g *Group) *Diagram

func (*Diagram) Groups

func (d *Diagram) Groups() []*Group

func (*Diagram) Nodes

func (d *Diagram) Nodes() []*Node

func (*Diagram) Render

func (d *Diagram) Render() error

type DiagramDirection

type DiagramDirection string
const (
	TopToBottom DiagramDirection = "TB"
	BottomToTop DiagramDirection = "BT"
	LeftToRight DiagramDirection = "LR"
	RightToLeft DiagramDirection = "RL"
)

func Directions

func Directions() []DiagramDirection

type Edge

type Edge struct {
	Options EdgeOptions
	// contains filtered or unexported fields
}

func NewEdge

func NewEdge(start, end string, opts ...EdgeOption) *Edge

func (*Edge) End

func (e *Edge) End() string

func (*Edge) ID

func (e *Edge) ID() string

func (*Edge) Start

func (e *Edge) Start() string

type EdgeOption

type EdgeOption func(*EdgeOptions)

func Bidirectional

func Bidirectional() EdgeOption

func Forward

func Forward() EdgeOption

func Reverse

func Reverse() EdgeOption

type EdgeOptions

type EdgeOptions struct {
	Label      string
	Color      string
	Forward    bool
	Reverse    bool
	Font       Font
	Style      string
	Attributes map[string]string
}

func DefaultEdgeOptions

func DefaultEdgeOptions(opts ...EdgeOption) EdgeOptions

type Font

type Font struct {
	Name  string
	Size  float64
	Color string
}

type Group

type Group struct {
	// contains filtered or unexported fields
}

func NewGroup

func NewGroup(name string, opts ...GroupOption) *Group

func (*Group) Add

func (g *Group) Add(nodes ...*Node) *Group

func (*Group) BackgroundColor

func (g *Group) BackgroundColor(c string) *Group

func (*Group) Children

func (g *Group) Children() []*Group

func (*Group) Connect

func (g *Group) Connect(start, end *Node, opts ...EdgeOption) *Group

func (*Group) ConnectAllFrom

func (g *Group) ConnectAllFrom(start string, opts ...EdgeOption) *Group

func (*Group) ConnectAllTo

func (g *Group) ConnectAllTo(end string, opts ...EdgeOption) *Group

func (*Group) ConnectByID

func (g *Group) ConnectByID(start, end string, opts ...EdgeOption) *Group

func (*Group) Edges

func (g *Group) Edges() []*Edge

func (*Group) Group

func (g *Group) Group(ng *Group) *Group

func (*Group) ID

func (g *Group) ID() string

func (*Group) Label

func (g *Group) Label(l string) *Group

func (*Group) NewGroup

func (g *Group) NewGroup(name string, opts ...GroupOption) *Group

func (*Group) Nodes

func (g *Group) Nodes() []*Node

type GroupOption

type GroupOption func(*GroupOptions)

func BackgroundColor

func BackgroundColor(c string) GroupOption

func GroupLabel

func GroupLabel(l string) GroupOption

func IndexedBackground

func IndexedBackground(idx int) GroupOption

type GroupOptions

type GroupOptions struct {
	Label           string
	LabelJustify    string
	Direction       string
	PenColor        string
	BackgroundColor string
	Shape           string
	Style           string
	Font            Font
	Attributes      map[string]string
}

func DefaultGroupOptions

func DefaultGroupOptions(opts ...GroupOption) GroupOptions

type Node

type Node struct {
	Options NodeOptions
	// contains filtered or unexported fields
}

func NewNode

func NewNode(opts ...NodeOption) *Node

func (*Node) ID

func (n *Node) ID() string

func (*Node) Label

func (n *Node) Label(l string) *Node

type NodeOption

type NodeOption func(*NodeOptions)

func FixedSize

func FixedSize(b bool) NodeOption

func Height

func Height(h float64) NodeOption

func Icon

func Icon(i string) NodeOption

func ImageScale

func ImageScale(b bool) NodeOption

func LabelLocation

func LabelLocation(l string) NodeOption

func Name

func Name(n string) NodeOption

func NodeLabel

func NodeLabel(l string) NodeOption

func NodeShape

func NodeShape(s string) NodeOption

func NodeStyle

func NodeStyle(s string) NodeOption

func Provider

func Provider(p string) NodeOption

func SetFontOptions

func SetFontOptions(f Font) NodeOption

func Width

func Width(w float64) NodeOption

type NodeOptions

type NodeOptions struct {
	Name          string
	Label         string
	Provider      string
	Image         string
	ImageScale    bool
	Shape         string
	Style         string
	FixedSize     bool
	Width         float64
	Height        float64
	LabelLocation string
	Font          Font
	Attributes    map[string]string
}

func DefaultNodeOptions

func DefaultNodeOptions(opts ...NodeOption) NodeOptions

type Option

type Option func(*Options)

func Direction

func Direction(d string) Option

func Filename

func Filename(f string) Option

func Label

func Label(l string) Option

func LabelJustify

func LabelJustify(j string) Option

func PenColor

func PenColor(c string) Option

func Shape

func Shape(s string) Option

func Style

func Style(s string) Option

func WithAttribute

func WithAttribute(name, value string) Option

func WithAttributes

func WithAttributes(attrs map[string]string) Option

type OptionSet

type OptionSet []NodeOption

func MergeOptionSets

func MergeOptionSets(sets ...OptionSet) OptionSet

type Options

type Options struct {
	Name       string
	FileName   string
	OutFormat  string
	Direction  string
	CurveStyle string
	Show       bool
	Label      string
	Pad        float64
	Splines    string
	NodeSep    float64
	RankSep    float64
	Font       Font
	Attributes map[string]string
}

func DefaultOptions

func DefaultOptions(opts ...Option) Options

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL