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

Add animation; #246

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

james-zhang-gb
Copy link
Contributor

Add dynamic update option feature;

  • use:SetOptionUpdater() and then send Chart into the chan;

example:

func example() {
	bar := charts.NewBar()
	anime := opts.Anime{
		Animation: true,
	}
	bar.SetGlobalOptions(
		charts.WithTitleOpts(opts.Title{
			Title: "datazoom options(inside)",
		}),
		charts.WithDataZoomOpts(opts.DataZoom{
			Type:  "inside",
			Start: 10,
			End:   50,
		}),
		charts.WithAnimationOpts(anime),
	)

	bar.SetXAxis(weeks).
		AddSeries("Category A", generateBarItems(), charts.WithSeriesAnimationOpts(anime)).
		AddSeries("Category B", generateBarItems(), charts.WithSeriesAnimationOpts(anime))
	updater := bar.SetOptionUpdater()
	go func() {
		for {
			bar.MultiSeries[1].Data = generateBarItems()
			updater <- bar
			time.Sleep(3 * time.Second)
		}
	}()
	page := components.NewPage()
	page.AddCharts(bar)
	// render to any writer
	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		page.Render(w)
	})
	http.ListenAndServe("localhost:8089", nil)
}

james.zhang added 2 commits September 28, 2022 17:30
Add dynamic update option feature;
- use:SetOptionUpdater()
and then send Chart into the chan;
@Koooooo-7 Koooooo-7 added the attention Attention may include breaking changes label Oct 22, 2022
@tabiul
Copy link

tabiul commented Jun 13, 2023

Is there any possibility that is PR will be merged. I need the feature to update graph and it seems this fixes the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attention Attention may include breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants