Skip to content

Commit 9b53a2a

Browse files
add util AddTraces
1 parent ff317fc commit 9b53a2a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

graph_objects/plotly.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ type Fig struct {
1212
Config *Config `json:"config,omitempty"`
1313
}
1414

15+
func (fig *Fig) AddTraces(traces ...Trace) {
16+
fig.Data = append(fig.Data, traces...)
17+
}
18+
1519
// This section is to workaround the omitempty for json serialization.
1620

1721
type Bool *bool

graph_objects/plotly.tmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ type Fig struct {
1414
Config *Config `json:"config,omitempty"`
1515
}
1616

17+
func (fig *Fig) AddTraces(traces ...Trace) {
18+
fig.Data = append(fig.Data, traces...)
19+
}
1720

1821
// This section is to workaround the omitempty for json serialization.
1922

0 commit comments

Comments
 (0)