Find a file
2021-12-25 09:29:39 +08:00
assets refactor: add examples 2021-12-25 09:29:39 +08:00
examples refactor: add examples 2021-12-25 09:29:39 +08:00
.gitignore test: add test for bar series 2021-12-20 23:16:31 +08:00
axis.go refactor: add examples 2021-12-25 09:29:39 +08:00
axis_test.go test: add test for axis 2021-12-18 20:09:02 +08:00
bar_series.go test: add test for bar series 2021-12-20 23:16:31 +08:00
bar_series_test.go test: add series and legend test 2021-12-21 23:43:36 +08:00
base_series.go test: add series and legend test 2021-12-21 23:43:36 +08:00
base_series_test.go test: add series and legend test 2021-12-21 23:43:36 +08:00
charts.go test: add series and legend test 2021-12-21 23:43:36 +08:00
charts_test.go test: add series and legend test 2021-12-21 23:43:36 +08:00
echarts.go refactor: add examples 2021-12-25 09:29:39 +08:00
echarts_test.go refactor: add examples 2021-12-25 09:29:39 +08:00
go.mod refactor: add examples 2021-12-25 09:29:39 +08:00
go.sum refactor: add examples 2021-12-25 09:29:39 +08:00
legend.go test: add test for legend, series and theme 2021-12-23 23:20:20 +08:00
legend_test.go test: add test for legend, series and theme 2021-12-23 23:20:20 +08:00
LICENSE Initial commit 2021-12-09 20:20:33 +08:00
line_series.go test: add test for legend, series and theme 2021-12-23 23:20:20 +08:00
line_series_test.go test: add test for legend, series and theme 2021-12-23 23:20:20 +08:00
Makefile test: add test for axis 2021-12-18 20:09:02 +08:00
range.go feat: support multi y axis 2021-12-18 09:49:44 +08:00
range_test.go test: add test for legend, series and theme 2021-12-23 23:20:20 +08:00
README.md refactor: add examples 2021-12-25 09:29:39 +08:00
series.go refactor: add examples 2021-12-25 09:29:39 +08:00
series_test.go test: add test for legend, series and theme 2021-12-23 23:20:20 +08:00
theme.go test: add test for legend, series and theme 2021-12-23 23:20:20 +08:00
theme_test.go test: add test for legend, series and theme 2021-12-23 23:20:20 +08:00

go-echarts

Alt

go-chart是golang常用的可视化图表库支持svgpng的输出,Apache ECharts在前端开发中得到众多开发者的认可。go-echarts则是结合两者的方式兼容Apache ECharts的配置参数,简单快捷的生成相似的图表(svgpng)方便插入至Email或分享使用。下面为常用的几种图表截图

支持图表类型

暂仅支持三种的图表类型:line, bar 以及 pie

示例

go-echarts兼容了echarts的参数配置可简单的使用json形式的配置字符串则可快速生成图表。

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)
}