refactor: add examples

This commit is contained in:
vicanso 2021-12-25 09:29:39 +08:00
parent c289ba7cde
commit 6aad7b6067
10 changed files with 231 additions and 46 deletions

28
examples/basic/main.go Normal file
View 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)
}