|
@@ -42,8 +42,9 @@ type DotNodeAttributes struct {
|
42
|
42
|
// DotConfig contains attributes about how a graph should be
|
43
|
43
|
// constructed and how it should look.
|
44
|
44
|
type DotConfig struct {
|
45
|
|
- Title string // The title of the DOT graph
|
46
|
|
- Labels []string // The labels for the DOT's legend
|
|
45
|
+ Title string // The title of the DOT graph
|
|
46
|
+ LegendURL string // The URL to link to from the legend.
|
|
47
|
+ Labels []string // The labels for the DOT's legend
|
47
|
48
|
|
48
|
49
|
FormatValue func(int64) string // A formatting function for values
|
49
|
50
|
FormatTag func(int64, string) string // A formatting function for numeric tags
|
|
@@ -126,7 +127,15 @@ func (b *builder) addLegend() {
|
126
|
127
|
if len(labels) > 0 {
|
127
|
128
|
title = labels[0]
|
128
|
129
|
}
|
129
|
|
- fmt.Fprintf(b, `subgraph cluster_L { "%s" [shape=box fontsize=16 label="%s\l"] }`+"\n", title, strings.Join(labels, `\l`))
|
|
130
|
+ fmt.Fprintf(b, `subgraph cluster_L { "%s" [shape=box fontsize=16`, title)
|
|
131
|
+ fmt.Fprintf(b, ` label="%s\l"`, strings.Join(labels, `\l`))
|
|
132
|
+ if b.config.LegendURL != "" {
|
|
133
|
+ fmt.Fprintf(b, ` URL="%s" target="_blank"`, b.config.LegendURL)
|
|
134
|
+ }
|
|
135
|
+ if b.config.Title != "" {
|
|
136
|
+ fmt.Fprintf(b, ` tooltip="%s"`, b.config.Title)
|
|
137
|
+ }
|
|
138
|
+ fmt.Fprintf(b, "] }\n")
|
130
|
139
|
}
|
131
|
140
|
|
132
|
141
|
// addNode generates a graph node in DOT format.
|