MCPcopy Index your code
hub / github.com/gonum/plot / Sankey

Struct Sankey

plotter/sankey.go:24–71  ·  view source on GitHub ↗

A Sankey diagram presents stock and flow data as rectangles representing the amount of each stock and lines between the stocks representing the amount of each flow.

Source from the content-addressed store, hash-verified

22// the amount of each stock and lines between the stocks representing the
23// amount of each flow.
24type Sankey struct {
25 // Color specifies the default fill
26 // colors for the stocks and flows. If Color is not nil,
27 // each stock and flow is rendered filled with Color,
28 // otherwise no fill is performed. Colors can be
29 // modified for individual stocks and flows.
30 Color color.Color
31
32 // StockBarWidth is the widths of the bars representing
33 // the stocks. The default value is 15% larger than the
34 // height of the stock label text.
35 StockBarWidth vg.Length
36
37 // LineStyle specifies the default border
38 // line style for the stocks and flows. Styles can be
39 // modified for individual stocks and flows.
40 LineStyle draw.LineStyle
41
42 // TextStyle specifies the default stock label
43 // text style. Styles can be modified for
44 // individual stocks.
45 TextStyle text.Style
46
47 flows []Flow
48
49 // FlowStyle is a function that specifies the
50 // background color and border line style of the
51 // flow based on its group name. The default
52 // function uses the default Color and LineStyle
53 // specified above for all groups.
54 FlowStyle func(group string) (color.Color, draw.LineStyle)
55
56 // StockStyle is a function that specifies, for a stock
57 // identified by its label and category, the label text
58 // to be printed on the plot (lbl), the style of the text (ts),
59 // the horizontal and vertical offsets for printing the text (xOff and yOff),
60 // the color of the fill for the bar representing the stock (c),
61 // and the style of the outline of the bar representing the stock (ls).
62 // The default function uses the default TextStyle, color and LineStyle
63 // specified above for all stocks; zero horizontal and vertical offsets;
64 // and the stock label as the text to be printed on the plot.
65 StockStyle func(label string, category int) (lbl string, ts text.Style, xOff, yOff vg.Length, c color.Color, ls draw.LineStyle)
66
67 // stocks arranges the stocks by category.
68 // The first key is the category and the seond
69 // key is the label.
70 stocks map[int]map[string]*stock
71}
72
73// StockRange returns the minimum and maximum value on the value axis
74// for the stock with the specified label and category.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected