tweaks
This commit is contained in:
parent
da41605882
commit
92edbcad44
131
README.md
131
README.md
|
@ -103,75 +103,76 @@ In order to map the series to an alternate axis make sure to set the `YAxis` pro
|
||||||
|
|
||||||
```go
|
```go
|
||||||
graph := chart.Chart{
|
graph := chart.Chart{
|
||||||
Title: stock.Name,
|
Title: stock.Name,
|
||||||
TitleStyle: chart.Style{
|
TitleStyle: chart.Style{
|
||||||
Show: false,
|
Show: false,
|
||||||
},
|
},
|
||||||
Width: width,
|
Width: width,
|
||||||
Height: height,
|
Height: height,
|
||||||
XAxis: chart.XAxis{
|
XAxis: chart.XAxis{
|
||||||
Style: chart.Style{
|
Style: chart.Style{
|
||||||
Show: true,
|
Show: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
YAxis: chart.YAxis{
|
YAxis: chart.YAxis{
|
||||||
Style: chart.Style{
|
Style: chart.Style{
|
||||||
Show: true,
|
Show: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Series: []chart.Series{
|
Series: []chart.Series{
|
||||||
chart.TimeSeries{
|
chart.TimeSeries{
|
||||||
Name: "vea",
|
Name: "vea",
|
||||||
XValues: vx,
|
XValues: vx,
|
||||||
YValues: vy,
|
YValues: vy,
|
||||||
Style: chart.Style{
|
Style: chart.Style{
|
||||||
Show: true,
|
Show: true,
|
||||||
StrokeColor: chart.GetDefaultSeriesStrokeColor(0),
|
StrokeColor: chart.GetDefaultSeriesStrokeColor(0),
|
||||||
FillColor: chart.GetDefaultSeriesStrokeColor(0).WithAlpha(64),
|
FillColor: chart.GetDefaultSeriesStrokeColor(0).WithAlpha(64),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
chart.TimeSeries{
|
chart.TimeSeries{
|
||||||
Name: "spy",
|
Name: "spy",
|
||||||
XValues: cx,
|
XValues: cx,
|
||||||
YValues: cy,
|
YValues: cy,
|
||||||
YAxis: chart.YAxisSecondary, // key (!)
|
YAxis: chart.YAxisSecondary, // key (!)
|
||||||
Style: chart.Style{
|
Style: chart.Style{
|
||||||
Show: true,
|
Show: true,
|
||||||
StrokeColor: chart.GetDefaultSeriesStrokeColor(1),
|
StrokeColor: chart.GetDefaultSeriesStrokeColor(1),
|
||||||
FillColor: chart.GetDefaultSeriesStrokeColor(1).WithAlpha(64),
|
FillColor: chart.GetDefaultSeriesStrokeColor(1).WithAlpha(64),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
chart.AnnotationSeries{
|
||||||
|
Name: fmt.Sprintf("%s - Last Value", "vea"),
|
||||||
|
Style: chart.Style{
|
||||||
|
Show: true,
|
||||||
|
StrokeColor: chart.GetDefaultSeriesStrokeColor(0),
|
||||||
|
},
|
||||||
|
Annotations: []chart.Annotation{
|
||||||
|
chart.Annotation{
|
||||||
|
X: float64(vx[len(vx)-1].Unix()),
|
||||||
|
Y: vy[len(vy)-1],
|
||||||
|
Label: fmt.Sprintf("%s - %s", "vea", chart.FloatValueFormatter(vy[len(vy)-1])),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
chart.AnnotationSeries{
|
},
|
||||||
Name: fmt.Sprintf("%s - Last Value", "vea"),
|
chart.AnnotationSeries{
|
||||||
Style: chart.Style{
|
Name: fmt.Sprintf("%s - Last Value", "goog"),
|
||||||
Show: true,
|
Style: chart.Style{
|
||||||
StrokeColor: chart.GetDefaultSeriesStrokeColor(0),
|
Show: true,
|
||||||
},
|
StrokeColor: chart.GetDefaultSeriesStrokeColor(1),
|
||||||
Annotations: []chart.Annotation{
|
},
|
||||||
chart.Annotation{
|
YAxis: chart.YAxisSecondary, // key (!)
|
||||||
X: float64(vx[len(vx)-1].Unix()),
|
Annotations: []chart.Annotation{
|
||||||
Y: vy[len(vy)-1],
|
chart.Annotation{
|
||||||
Label: fmt.Sprintf("%s - %s", "vea", chart.FloatValueFormatter(vy[len(vy)-1])),
|
X: float64(cx[len(cx)-1].Unix()),
|
||||||
},
|
Y: cy[len(cy)-1],
|
||||||
},
|
Label: fmt.Sprintf("%s - %s", "goog", chart.FloatValueFormatter(cy[len(cy)-1])),
|
||||||
},
|
|
||||||
chart.AnnotationSeries{
|
|
||||||
Name: fmt.Sprintf("%s - Last Value", "goog"),
|
|
||||||
Style: chart.Style{
|
|
||||||
Show: true,
|
|
||||||
StrokeColor: chart.GetDefaultSeriesStrokeColor(1),
|
|
||||||
},
|
|
||||||
YAxis: chart.YAxisSecondary, // key (!)
|
|
||||||
Annotations: []chart.Annotation{
|
|
||||||
chart.Annotation{
|
|
||||||
X: float64(cx[len(cx)-1].Unix()),
|
|
||||||
Y: cy[len(cy)-1],
|
|
||||||
Label: fmt.Sprintf("%s - %s", "goog", chart.FloatValueFormatter(cy[len(cy)-1])),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
graph.Render(chart.PNG, buffer)
|
||||||
```
|
```
|
||||||
|
|
||||||
# Design Philosophy
|
# Design Philosophy
|
||||||
|
|
Loading…
Reference in New Issue
Block a user