fenix-hub / godot-engine.easy-charts

A Godot Engine addon for plotting general purpose charts. A collection of Control, 2D and 3D Nodes to plot every chart possible.
MIT License
647 stars 48 forks source link

[BUG] Domain scaling is wrong #82

Closed addmix closed 6 months ago

addmix commented 1 year ago

Max sample count was implemented in #80, but domain scaling was not modified to handle this case elgantly, so the domain will shift and change randomly, sometimes setting either axis scale to 0, or not filling the domain entirely, or points going off the graph.

I have 3 features to propose that can aid in fixing this problem.

  1. Option to enable/disable sample count limits: Setting max_samples to 0 or -1 will disable max sample counts.
  2. Add an option for static domain limits, especially for the Y axis. Make static/dynamic domain settings independent for each axis.
  3. Add an option for smooth domain changes. Currently the domain is snapped to nearby increments, which is good in many cases, but for maximum resolution, there should be an option to make the current data fill the domain exactly. (using basic min/max on either axis). Added benefit if this can be independently controlled for X and Y axes.

image

fenix-hub commented 1 year ago

point (2) added as proposal here.

fenix-hub commented 1 year ago

bdceaa5 implements point (2). Currently it is possible to fix y/x domain bounds using Chart.set_x_domain(lower_bound, upper_bound) and Chart.set_y_domain(lower_bound, upper_bound) methods. You can find an update example on simple_chart on main branch (it should have been another branch, but I decided to first integrate your PR and ended up working on main). It is not a final implementation, let me know what you think about it and if you are still having issues :)