Skip to content
Switch branches/tags


🎨 The adorable charts library for Golang.

Build Status Go Report Card Contributions welcome MIT License GoDoc

If a language can be used to build web scrapers, it definitely needs to provide a graceful data visualization library. --- by dongdong.

In the Golang ecosystem, there are not many choices for data visualization libraries. The development of go-echarts aims to provide a simple yet powerful data visualization library for Golang. Apache ECharts is an outstanding charting and visualization library, it supports adorable chart types and various interactive features. There are many language bindings for Echarts, for example, pyecharts. go-echarts learns from pyecharts and has evolved a lot.


πŸ”° Installation

Classic way to get go-echarts

# this may be a stupid way to use v2 go-echarts without gomod(GO111MODULE=off) because of
# the next generation version management system... 🐢
# if you get a better workaround, please let me know....

$ go get -u
$ cd $go-echarts-project
$ mkdir v2 && mv charts components datasets opts render templates types v2

Use gomod style

$ go get -u


# go.mod


⏳ Version

The go-echarts project is being developed under v2 version and the active codebase is on the master branch now.

v1 and v2 are incompatible which means that you cannot upgrade go-echarts from v1 to v2 smoothly. But I think it is worth trying that new version.

✨ Features

  • Clean and comprehensive API.
  • Visualize your data in 25+ different ways.
  • Highly configurable chart options.
  • Detailed documentation and a rich collection of examples.
  • Visualize your geographical data with 400+ maps.

πŸ“ Usage

It's easy to get started with go-echarts. In this example, we create a simple bar chart with only a few lines of code.

package main

import (


// generate random data for bar chart
func generateBarItems() []opts.BarData {
	items := make([]opts.BarData, 0)
	for i := 0; i < 7; i++ {
		items = append(items, opts.BarData{Value: rand.Intn(300)})
	return items

func main() {
	// create a new bar instance
	bar := charts.NewBar()
	// set some global options like Title/Legend/ToolTip or anything else
		Title:    "My first bar chart generated by go-echarts",
		Subtitle: "It's extremely easy to use, right?",

	// Put data into instance
	bar.SetXAxis([]string{"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}).
		AddSeries("Category A", generateBarItems()).
		AddSeries("Category B", generateBarItems())
	// Where the magic happens
	f, _ := os.Create("bar.html")

And the generated bar.html is rendered as below. Isn't that cool!

Of course we can also start a listening web server with net/http.

package main

import (


// generate random data for line chart
func generateLineItems() []opts.LineData {
	items := make([]opts.LineData, 0)
	for i := 0; i < 7; i++ {
		items = append(items, opts.LineData{Value: rand.Intn(300)})
	return items

func httpserver(w http.ResponseWriter, _ *http.Request) {
	// create a new line instance
	line := charts.NewLine()
	// set some global options like Title/Legend/ToolTip or anything else
		charts.WithInitializationOpts(opts.Initialization{Theme: types.ThemeWesteros}),
			Title:    "Line example in Westeros theme",
			Subtitle: "Line chart rendered by the http server this time",

	// Put data into instance
	line.SetXAxis([]string{"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}).
		AddSeries("Category A", generateLineItems()).
		AddSeries("Category B", generateLineItems()).
		SetSeriesOptions(charts.WithLineChartOpts(opts.LineChart{Smooth: true}))

func main() {
	http.HandleFunc("/", httpserver)
	http.ListenAndServe(":8081", nil)


πŸ”– Gallery

bar boxplot effectScatter funnel gague geo graph heatmap kline line liquid map parallel pie radar scatter wordCloud bar3D line3D sankey scatter3D surface3D themeRiver overlap

For more information, please refer to go-echarts/examples and the GoDoc.

πŸ’‘ Contributing

go-echarts is an open source project and built on the top of other open-source projects, hence we are always very happy to have contributions, whether for typo fix, bug fix or big new features. Please do not ever hesitate to ask a question or send a pull request.

We strongly value documentation and integration with other projects so we are very glad to accept improvements for these aspects.

πŸ˜‰ Authors

Code with ❀️ by chenjiandongx / Koooooo-7 and lovely contributors

πŸ“ƒ License

MIT Β©chenjiandongx