fixing an issue with forcing the secondary y axis on when there were no series mapped to it.
This commit is contained in:
parent
ae31a618df
commit
50233991ca
2 changed files with 34 additions and 1 deletions
30
examples/stock_analysis.go/main.go
Normal file
30
examples/stock_analysis.go/main.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/wcharczuk/go-chart"
|
||||
)
|
||||
|
||||
func drawChart(res http.ResponseWriter, req *http.Request) {
|
||||
xvalues, yvalues := getMockChartData()
|
||||
|
||||
priceSeries := chart.TimeSeries{
|
||||
XValues: xvalues,
|
||||
YValues: yvalues,
|
||||
}
|
||||
|
||||
graph := chart.Chart{
|
||||
Series: []chart.Series{
|
||||
priceSeries,
|
||||
},
|
||||
}
|
||||
|
||||
res.Header().Set("Content-Type", "image/svg+xml")
|
||||
graph.Render(chart.SVG, res)
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/", drawChart)
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue