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

Continuous Functions Module #21013

Open
MarcelloPoletti opened this issue Apr 16, 2024 · 4 comments
Open

Continuous Functions Module #21013

MarcelloPoletti opened this issue Apr 16, 2024 · 4 comments
Labels
Product: Highcharts Type: Feature Request Used when a new feature is requested either directly or indirectly

Comments

@MarcelloPoletti
Copy link

MarcelloPoletti commented Apr 16, 2024

Hi,
There are many cases where there is a need to represent continuous trends rather than discrete ones. Some examples include:

  • Trend lines, which are not necessarily linear.
  • Line annotations, which are not necessarily straight lines.

These types of series or annotations are essentially continuous functions rather than a set of points. The topic is evidently complex and broad. There are challenges in defining the domain and codomain of functions, and functions can be expressed in various ways - explicitly, parametrically, and so on.

However, by imposing certain restrictions (at least initially), we could create a powerful tool. For instance, we could consider only:

  • Explicit functions, where y = f(x).
  • A domain interval, possibly open (e.g., [-∞, +∞]).
  • An optional density parameter that specifies the drawing precision (perhaps unnecessary?).

A series or annotation associated with a function could then be drawn by the engine. Naturally, this leads to some special behaviors:

  • A function-based series would not have markers.
  • A function-based series would not automatically define any axis visibility range.
  • Crosshairs, tooltips, etc., would require careful consideration.

In summary, this is indeed a non-trivial task, but if someone willing takes it up, it would benefit the entire community! 😊

Marc.

@MarcelloPoletti MarcelloPoletti added the Type: Feature Request Used when a new feature is requested either directly or indirectly label Apr 16, 2024
@karolkolodziej
Copy link
Contributor

Hi @MarcelloPoletti!

Thank you for sharing this idea!

Right now with a bit of code, you can create such a thing- see the y = f(x) demo.

But if I understand you correctly your idea is to have instead of the data in the series something like this:

  series: [{
    type: 'function',
    equation: 'x^2 + 5'
    range: [-10, 10]
  }]

If you have any other idea how it might look or work please feel free to share that!

@MarcelloPoletti
Copy link
Author

MarcelloPoletti commented Apr 17, 2024

Hi karolkolodziej,

Yes, a function type series it's probably the best way. And it can have some params, in example:

series: [{
    type: 'function',
    equation: function(x){ return x^2 + 5},
    range /*optional*/: [-10, 10], //or [-10, null] or [null, 10]...
    density /*optional*/: 10, //or nothing, draw a point every 10 pixel 
  }]

marc.

@karolkolodziej
Copy link
Contributor

Thank you for clarifying! We are going to discuss it internally and we will keep you posted!

@MarcelloPoletti
Copy link
Author

MarcelloPoletti commented Apr 18, 2024

Another way to think the problem, perhaps more powerfull, is work on data instead of series.
Suppose "data" depends on xAxys range now visible for a generic series:

series: [{
    type: anytype!!
    data:{
	function: function(o){
		//o contains some information about newminx, newmax, oldminx, oldmax, olddata
		//Here we can produce new dataset in any possible way, using any possibile optimization strategy
	}
    }
}]

marc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Product: Highcharts Type: Feature Request Used when a new feature is requested either directly or indirectly
Projects
None yet
Development

No branches or pull requests

2 participants