refactor: add examples
This commit is contained in:
parent
c289ba7cde
commit
6aad7b6067
10 changed files with 231 additions and 46 deletions
28
examples/basic/main.go
Normal file
28
examples/basic/main.go
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
charts "github.com/vicanso/echarts"
|
||||
)
|
||||
|
||||
func main() {
|
||||
buf, err := charts.RenderEChartsToPNG(`{
|
||||
"title": {
|
||||
"text": "Line"
|
||||
},
|
||||
"xAxis": {
|
||||
"type": "category",
|
||||
"data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
|
||||
},
|
||||
"series": [
|
||||
{
|
||||
"data": [150, 230, 224, 218, 135, 147, 260]
|
||||
}
|
||||
]
|
||||
}`)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
os.WriteFile("output.png", buf, 0600)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue