wtg

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 18 Imported by: 0

README

Quick start

Given sample.txt with this content

business - cup of tea
public - cup of tea
cup of tea - cup
cup of tea -- tea
cup of tea --- hot water
hot water - water
hot water -- kettle
kettle - power

cup of tea: {
    type: buy
    evolution: |....|....|...x..|.........|
}
water: {
    type: build
    evolution: |....|....|....|....x....|
}
kettle: {
    type: build
    evolution: |....|..x.|....|.........|
}
power: {
    type: outsource
    evolution: |....|....|....x|.........|
}
business: {
    evolution: |....|....|..x.|.......|
}
public: {
    evolution: |....|....|....|.x....|
}
cup: {
    evolution: |....|....|....|.x.......|
}
tea: {
    evolution: |....|....|....|..x......|
}
hot water: {
    evolution: |....|....|....|...x.....|
}

When we execute

cat sample.txt | go run cmd/wtg2svg/main.go > sample.svg

The result is

Howto

First create the value chain

Create your value chain simply in a file (for example vc.txt)

business - cup of tea
public - cup of tea
cup of tea - cup
cup of tea -- tea
cup of tea --- hot water
hot water - water
hot water -- kettle
kettle - power
Test the value chain in dot

cat vc.txt | go run cmd/wtg2dot/main.go | dot -Tsvg > vc_dot.svg

which renders in

Test the value chain in maps

cat vc.txt | go run cmd/wtg2svg/main.go > vc_wardley.svg

which renders in

Create the evolution file

You can use the dump command to generate some boilerplate for the components:

cat vc.txt | go run cmd/dump/main.go | while read line
do
echo "$line: {"
echo "    evolution: |....|....|....|....x....|"
echo "}"
done > evolution.txt

Then adapt the file

Generate the maps

cat vc.txt evolution.txt | go run cmd/wtg2svg/main.go > map.svg

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	VerticalLabelPosition int = -10
	VerticalStep          int = 50
	MaxVisibleHeight      int = 94
)
View Source
var Colors = map[string]color.Color{}/* 144 elements not displayed */
View Source
var ErrEmptyMap = errors.New("no map")

Functions

func SetCoords added in v0.8.0

func SetCoords(m wardleyToGo.Map, withEvolution bool)

SetCoords sets the y anx x axis of the components

func SetLabelAnchor added in v0.9.0

func SetLabelAnchor(m wardleyToGo.Map)

SetLabelCoords sets the label coordinate with simple rules: set anchor to left unless all the the From and To nodes are more advanced on evolution axis

Types

type Inventory added in v0.9.0

type Inventory struct {
	NodeInventory map[string]*wardley.Component
	EdgeInventory []*wardley.Collaboration

	EvolutionStages []svgmap.Evolution
	Title           string
	Documentation   []string
	// contains filtered or unexported fields
}

Inventory is the result of the parsing of the elements it does not create a consolidated map this can be used in an LSP

func NewInventory added in v0.9.0

func NewInventory() *Inventory

func (*Inventory) Run added in v0.9.0

func (inv *Inventory) Run() error

type Parser

type Parser struct {
	WMap            *wardleyToGo.Map
	EvolutionStages []svgmap.Evolution
	ImageSize       image.Rectangle
	MapSize         image.Rectangle
	// InvalidEntries reports any invalid of unkonwn token
	InvalidEntries []error
	Docs           []string
	// contains filtered or unexported fields
}

func NewParser

func NewParser() *Parser

func (*Parser) DumpComponents

func (p *Parser) DumpComponents(w io.Writer)

func (*Parser) Parse

func (p *Parser) Parse(r io.Reader) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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