fix for issues/56
This commit is contained in:
parent
a0ea012903
commit
f72f7fd57b
4 changed files with 43 additions and 1 deletions
|
|
@ -30,7 +30,26 @@ func drawChart(res http.ResponseWriter, req *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
func drawChartRegression(res http.ResponseWriter, req *http.Request) {
|
||||
pie := chart.PieChart{
|
||||
Width: 512,
|
||||
Height: 512,
|
||||
Values: []chart.Value{
|
||||
{Value: 5, Label: "Blue"},
|
||||
{Value: 2, Label: "Two"},
|
||||
{Value: 1, Label: "One"},
|
||||
},
|
||||
}
|
||||
|
||||
res.Header().Set("Content-Type", chart.ContentTypeSVG)
|
||||
err := pie.Render(chart.SVG, res)
|
||||
if err != nil {
|
||||
fmt.Printf("Error rendering pie chart: %v\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/", drawChart)
|
||||
http.HandleFunc("/reg", drawChartRegression)
|
||||
log.Fatal(http.ListenAndServe(":8080", nil))
|
||||
}
|
||||
|
|
|
|||
17
_examples/pie_chart/reg.svg
Normal file
17
_examples/pie_chart/reg.svg
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512">
|
||||
<path d="M 256 256
|
||||
L 507 256
|
||||
A 251 251 225.00 1 1 79 79
|
||||
L 256 256
|
||||
Z" style="stroke-width:5;stroke:rgba(255,255,255,1.0);fill:rgba(106,195,203,1.0)"/>
|
||||
<path d="M 256 256
|
||||
L 79 79
|
||||
A 251 251 90.00 0 1 433 79
|
||||
L 256 256
|
||||
Z" style="stroke-width:5;stroke:rgba(255,255,255,1.0);fill:rgba(42,190,137,1.0)"/>
|
||||
<path d="M 256 256
|
||||
L 433 79
|
||||
A 251 251 45.00 0 1 507 256
|
||||
L 256 256
|
||||
Z" style="stroke-width:5;stroke:rgba(255,255,255,1.0);fill:rgba(110,128,139,1.0)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 565 B |
Loading…
Add table
Add a link
Reference in a new issue