参考这个案例https://blog.youkuaiyun.com/lildkdkdkjf/article/details/106783264,手痒,改成Golang版:)
先看效果图:
实现原理:
前端Echarts实现:https://echarts.apache.org/zh/index.html,前端就不贴了,在文章最后的地址里下载。
后台Golang实现,用https://github.com/gin-gonic/gin启动一个http服务,加载页面。再用https://github.com/zserge/lorca调用本机的Chrome浏览器访问该页面。用https://github.com/astaxie/beego/orm访问数据库,模拟获取数据。
关键代码:
main.go
package main
import (
"fmt"
"time"
"github.com/go-vgo/ro