Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] RenderContent() not found #418

Closed
f2xb opened this issue Apr 24, 2024 · 1 comment
Closed

[Bug] RenderContent() not found #418

f2xb opened this issue Apr 24, 2024 · 1 comment
Labels
question Further information is requested

Comments

@f2xb
Copy link

f2xb commented Apr 24, 2024

Describe the issue

not work, .RenderContent() is not found

package main

import (
	"github.com/go-echarts/go-echarts/v2/charts"
	"github.com/go-echarts/go-echarts/v2/opts"
	"github.com/go-echarts/snapshot-chromedp/render"
	"math/rand"
)

var (
	itemCnt = 7
	weeks   = []string{"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}
)

func generateBarItems() []opts.BarData {
	items := make([]opts.BarData, 0)
	for i := 0; i < itemCnt; i++ {
		items = append(items, opts.BarData{Value: rand.Intn(300)})
	}
	return items
}

func barTitle() *charts.Bar {
	bar := charts.NewBar()
	bar.SetGlobalOptions(
		charts.WithInitializationOpts(opts.Initialization{
			BackgroundColor: "#FFFFFF",
		}),
		// Don't forget disable the Animation
		charts.WithAnimation(false),
		charts.WithTitleOpts(opts.Title{
			Title:    "title and legend options",
			Subtitle: "go-echarts is an awesome chart library written in Golang",
			Link:     "https://github.com/go-echarts/go-echarts",
			Right:    "40%",
		}),
		charts.WithLegendOpts(opts.Legend{Right: "80%"}),
	)
	bar.SetXAxis(weeks).
		AddSeries("Category A", generateBarItems()).
		AddSeries("Category B", generateBarItems())
	return bar
}

func main() {
	barTitleChart := barTitle()
	barTooltipChart := barTooltip()
	render.MakeChartSnapshot(barTitleChart.RenderContent(), "my-bar-title.png")
}```

### How to reproduce this issue

*

### Other information

_No response_

### go-echarts version

v2.3.3
@f2xb f2xb added the bug Something isn't working label Apr 24, 2024
@f2xb f2xb changed the title [Bug] [Bug] RenderContent() not found Apr 24, 2024
@Koooooo-7
Copy link
Member

Hi @f2xb , plz upgrade to v2.4.0-rc1.

@Koooooo-7 Koooooo-7 added question Further information is requested and removed bug Something isn't working labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants