44

go-echarts 开源啦

 5 years ago
source link: https://studygolang.com/articles/18159?amp%3Butm_medium=referral
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

vIVjqqq.png!web

go-echarts

:art: The adorable charts library for Golang

在 Golang 这门语言中,目前数据可视化的第三方库还是特别少, go-echarts 的开发就是为了填补这部分的空隙。 Echarts 是百度开源的非常优秀的可视化图表库,凭借着良好的交互性,精巧的图表设计,得到了众多开发者的认可。也有其他语言为其实现了相应语言版本的接口,如 Python 的 pyecharts ,go-echarts 也是借鉴了 pyecharts 的一些设计思想。

:beginner: 安装

$ go get -u github.com/chenjiandongx/go-echarts/...

:sparkles: 特性

  • 简洁的 API 设计,使用如丝滑般流畅
  • 囊括了 20+ 种常见图表,应有尽有
  • 高度灵活的配置项,可轻松搭配出精美的图表
  • 详细的文档和示例,帮助开发者更快的上手项目
  • 多达 400+ 地图,为地理数据可视化提供强有力的支持

:memo: 使用

仅需要几行核心代码就可画出美观的图表

mQBBvu2.png!web

生成的 bar.html 是这样的。Cool!

36jemmu.png!web

当然你也可以使用更加 golang 的方式,利用 net/http

3mQvM33.png!web

打开浏览器访问 http://localhost:8081 也可以看到同样的效果!

:bookmark: Demo

BzEvqyZ.giffyUjArZ.gifMFVjuuR.png!webZrmim2u.gifb2UbEba.png!web2yyaMnv.gifiUjeuam.gifvA3UvyQ.gife2yUfuZ.gif3aMbymm.gifmuqeeer.gifuqiMrmB.png!webrAnumua.gifa2YBjqr.gifa2UFVnm.gifUVZJreV.png!webRN3yEb7.gifb2Yreij.gif6F7vyuf.gifA7Jriuy.gifjMR7j2f.gif

运行 example/main.go 可预览所有示例

$ cd your/gopath/src/github.com/chenjiandongx/go-echarts/example
$ go build .
$ ./example

了解更多文档的内容请访问 go-echarts.chenjiandongx.com


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK