refactor: enhance chart render function
This commit is contained in:
parent
65a1cb11ad
commit
38c4978e44
20 changed files with 665 additions and 462 deletions
|
|
@ -73,6 +73,7 @@ func handler(w http.ResponseWriter, req *http.Request, chartOptions []charts.Cha
|
|||
bytesList := make([][]byte, 0)
|
||||
for _, opt := range chartOptions {
|
||||
opt.Theme = theme
|
||||
opt.Type = charts.ChartOutputSVG
|
||||
d, err := charts.Render(opt)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
|
@ -1055,6 +1056,64 @@ func echartsHandler(w http.ResponseWriter, req *http.Request) {
|
|||
}
|
||||
]
|
||||
}`,
|
||||
`{
|
||||
"title": {
|
||||
"text": "World Population"
|
||||
},
|
||||
"tooltip": {
|
||||
"trigger": "axis",
|
||||
"axisPointer": {
|
||||
"type": "shadow"
|
||||
}
|
||||
},
|
||||
"legend": {},
|
||||
"grid": {
|
||||
"left": "3%",
|
||||
"right": "4%",
|
||||
"bottom": "3%",
|
||||
"containLabel": true
|
||||
},
|
||||
"xAxis": {
|
||||
"type": "value"
|
||||
},
|
||||
"yAxis": {
|
||||
"type": "category",
|
||||
"data": [
|
||||
"Brazil",
|
||||
"Indonesia",
|
||||
"USA",
|
||||
"India",
|
||||
"China",
|
||||
"World"
|
||||
]
|
||||
},
|
||||
"series": [
|
||||
{
|
||||
"name": "2011",
|
||||
"type": "bar",
|
||||
"data": [
|
||||
18203,
|
||||
23489,
|
||||
29034,
|
||||
104970,
|
||||
131744,
|
||||
630230
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "2012",
|
||||
"type": "bar",
|
||||
"data": [
|
||||
19325,
|
||||
23438,
|
||||
31000,
|
||||
121594,
|
||||
134141,
|
||||
681807
|
||||
]
|
||||
}
|
||||
]
|
||||
}`,
|
||||
`{
|
||||
"title": {
|
||||
"text": "Rainfall vs Evaporation",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue