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

dynamic symbol size for (effect)scatter type in geo chart #318

Closed
dithmer opened this issue Dec 15, 2023 · 1 comment
Closed

dynamic symbol size for (effect)scatter type in geo chart #318

dithmer opened this issue Dec 15, 2023 · 1 comment
Labels
good first issue Good for newcomers

Comments

@dithmer
Copy link

dithmer commented Dec 15, 2023

Hey everyone!

I was asking myself if it is possible to achieve something like this:
https://echarts.apache.org/examples/en/editor.html?c=geo-svg-scatter-simple

It is an example of a geo chart, with the EffectScatter type, which have dynamic symbolSize values for the series, based on a callback function and the data per point.

Is it possible at the moment? I've already tried something like this

geo.AddSeries("geo", types.ChartEffectScatter, geoData, func(s *charts.SingleSeries) {                                                                                                                                                                                        
  s.SymbolSize = func(params interface{}) interface{} {                                                                                                                                                                                                                     
    return params.([]interface{})[2].(float64) / maxVal * 50                                                                                                                                                                                                              
  }
})

But it just does, that the chart isn't rendered.

Thanks in advance and best regards

@Koooooo-7
Copy link
Member

Hi @dithmer , go-echarts support insert a pure js func string into config instead of compile go func to do that trick.
You could try something like this instead:

	const symbolFunc = `
             function (params) {
                return (params[2] / 100) * 15 + 5;
             }
         `
	geo.AddSeries("geo", types.ChartEffectScatter, geoData, func(s *charts.SingleSeries) {
		s.SymbolSize = opts.FuncOpts(symbolFunc)
	})

@Koooooo-7 Koooooo-7 added the good first issue Good for newcomers label Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants