1- const (
2- STYLE_LINE* = 1
3- STYLE_SCATTER*
4- )
5-
61type (
72 Point* = struct {
83 x, y: real
94 }
105
6+ Kind* = enum {
7+ line = 1
8+ scatter
9+ }
10+
1111 Style* = struct {
12- kind: int
12+ kind: Kind
1313 color: uint32
1414 width: real
1515 }
@@ -54,7 +54,7 @@ fn (s: ^Series) add*(x, y: real) {
5454 s.points = append(s.points, Point{x, y})
5555}
5656
57- fn init*(numSeries: int = 1, kind: int = STYLE_LINE ): Plot {
57+ fn init*(numSeries: int = 1, kind: Kind = .line ): Plot {
5858 plt := Plot{series: make([]Series, numSeries)}
5959
6060 const getDefaultColors = fn (numColors: int): []uint32 {
@@ -77,12 +77,12 @@ fn init*(numSeries: int = 1, kind: int = STYLE_LINE): Plot {
7777
7878 for i := 0; i < numSeries; i++ {
7979 plt.series[i].name = ""
80- plt.series[i].style = Style {kind: kind, color: defaultColors[i], width: 3.0}
80+ plt.series[i].style = {kind: kind, color: defaultColors[i], width: 3.0}
8181 }
8282
83- plt.grid = Grid {xNumLines: 5, yNumLines: 5, color: 0xFF505050, fontSize: 12, visible: true, labelled: true}
84- plt.titles = Titles {x: "", y: "", graph: "", color: plt.grid.color, fontSize: plt.grid.fontSize, visible: true}
85- plt.legend = Legend {visible: true}
83+ plt.grid = {xNumLines: 5, yNumLines: 5, color: 0xFF505050, fontSize: 12, visible: true, labelled: true}
84+ plt.titles = {x: "", y: "", graph: "", color: plt.grid.color, fontSize: plt.grid.fontSize, visible: true}
85+ plt.legend = {visible: true}
8686
8787 return plt
8888}
0 commit comments