Giter VIP home page Giter VIP logo

Comments (11)

mitar avatar mitar commented on May 27, 2024 1
function (){
	const chart = this.ecModel.scheduler.ecInstance;
	const series = [];
	for (const s of chart.getOption().series) {
		if (s.type === 'custom') {
			if (s.data.length === 0) {
				series.push({data: chart.getModel().getSeriesByName(s.name).filter((s) => s.subType === 'line')[0].option.data})
			} else {
				series.push({data: []});
			}
		} else {
			series.push({});
		}
	}
	chart.setOption({series: series});
}

It is a bit ugly because there is no simple way to toggle a series (apache/echarts#15585), but it works. You can get chart instance from this.ecModel.scheduler.ecInstance. There are also other parameters passed as arguments to the click handler.

from go-echarts.

Koooooo-7 avatar Koooooo-7 commented on May 27, 2024

Hi @mitar , We mainly support the configurable common useful opts of the toolbox (the same as other options), not a flexible structure. I don't think it is a lib thing that we provide just interface{} and you do the rest.

I have to say go-echarts is part of the echarts implementations and it still needs more features and adaptions.

  • Charts type.
  • Charts Options.
  • Charts (echarts) instance operation.
  • Charts dynamic data/render.
  • ...

If there is miss something, glad to hear your voice.
And I would appreciate that If you could do some contributions is a big plus.

from go-echarts.

mitar avatar mitar commented on May 27, 2024

OK, so if I understand, comment is currently wrong and this is not yet possible? But you are not opposed to adding such a feature and allow user defined tools?

from go-echarts.

Koooooo-7 avatar Koooooo-7 commented on May 27, 2024

OK, so if I understand, comment is currently wrong and this is not yet possible?

Yep, the comment sounds not align to current support options.

But you are not opposed to adding such a feature and allow user defined tools?

Everyone knows the ideal things is If it can do in echarts, it should do in go-echarts as well.
The point is we need find a good way to implement it and make it easy to use. There needs lot of time to design and make it work, not just straightforward and crude change it to just make it work.

But we don't have a Aladdin's magic lamp to say I want it, then I have it.

I don't have that much time to follow everyone's requirements and include the whole echarts' options/functions/features... asap.

So, I do wanna more contributors who use go-echarts can share ideas and contribute something like the allow user defined tools , and benefit to others also.

from go-echarts.

mitar avatar mitar commented on May 27, 2024

I am not sure what are you saying here. So I am willing to make a PR with this feature and propose an approach how to do it. I am not asking for you to do it for me. Is that OK?

The approach I would take is to have extra map field on ToolBoxFeature for user-defined tools. Where you can then define those extra tools. And custom json marshal to merge those together.

from go-echarts.

Koooooo-7 avatar Koooooo-7 commented on May 27, 2024

I am not sure what are you saying here. So I am willing to make a PR with this feature and propose an approach how to do it. I am not asking for you to do it for me. Is that OK?

The approach I would take is to have extra map field on ToolBoxFeature for user-defined tools. Where you can then define those extra tools. And custom json marshal to merge those together.

Thx for your understanding and helping here.
TBH, I don't think implement it (add an extra option) is that hard. The point is how do we implement it.
I assume that you may need a JSFunc string for onclick event, which means may need more of the JS context beyond go-echarts, even more ES modules...etc. The alert example in echarts is meaningless.

So, what the scope is and how much things we support by the customized feature?

from go-echarts.

mitar avatar mitar commented on May 27, 2024

which means may need more of the JS context beyond go-echarts, even more ES modules...etc. The alert example in echarts is meaningless.

I do not think that is really necessary. In my case it is for example just to toggle some series to be shown or not. That is few lines of JavaScript.

from go-echarts.

Koooooo-7 avatar Koooooo-7 commented on May 27, 2024

which means may need more of the JS context beyond go-echarts, even more ES modules...etc. The alert example in echarts is meaningless.

I do not think that is really necessary. In my case it is for example just to toggle some series to be shown or not. That is few lines of JavaScript.

So, if we provide this features in the way of my assumption. It seems so much limitation to use it, and hard to use.
Or, you have any other thoughts on it?

from go-echarts.

mitar avatar mitar commented on May 27, 2024

I made #327. It works great for me. Allows me to add a simple tool to toggle series on and off in a batch.

from go-echarts.

Koooooo-7 avatar Koooooo-7 commented on May 27, 2024

Allows me to add a simple tool to toggle series on and off in a batch.

What does it look like?

from go-echarts.

Koooooo-7 avatar Koooooo-7 commented on May 27, 2024

It is a bit ugly because there is no simple way to toggle a series (apache/echarts#15585), but it works. You can get chart instance from this.ecModel.scheduler.ecInstance. There are also other parameters passed as arguments to the click handler.

Thats cool.

from go-echarts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.