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

Other stepped options #11911

Open
anto52nio opened this issue Sep 30, 2024 · 1 comment
Open

Other stepped options #11911

anto52nio opened this issue Sep 30, 2024 · 1 comment

Comments

@anto52nio
Copy link

Feature Proposal

I need to have some other options to assign as stepped in line charts.
Besides after, before and middle...

  • Could be good to have at less one I call it "down" where the segment "y" goes from higher value to lower it drops at the beginning, similar to "before" and when it goes from lower "y" to higher it if goes up at the end, similar to after:
    004113
  • Another one is a mix, so it only work as stepped when "y" goes from lower to higher, in other case it doesn't do any step:
    004114
    Ofcourse other cases in the other way around are very welcome.

Possible Implementation

I already re-engineered my copy of Chartjs.js even the code is very good and it works properly:
//function Fe(t,e,i,s,n){if(!e)return t.lineTo(i.x,i.y);if("middle"===n){const s=(e.x+i.x)/2;t.lineTo(s,e.y),t.lineTo(s,i.y)}else"after"===n!=!!s?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)} function Fe(t,e,i,s,n) { if(!e)return t.lineTo(i.x,i.y); if("middle"===n) { const s=(e.x+i.x)/2; t.lineTo(s,e.y),t.lineTo(s,i.y) } else if ("after"===n!=!!s) {t.lineTo(e.x,i.y) } else if ("down"===n) { if (e.y>=i.y) { t.lineTo(i.x,e.y) } else{ t.lineTo(e.x,i.y) } } else if ("onlyup"===n) { if (e.y>=i.y) { t.lineTo(i.x,e.y) } else{ t.lineTo(i.x,i.y) } } else { t.lineTo(i.x,e.y);} t.lineTo(i.x,i.y) }

@anto52nio
Copy link
Author

Sorry, in the "possible implementation" I mean "the code is not very good".
In any case, if something like this can't be implemented, is there any way to do "overriding" the Fe function in local script in my web page?
Thanks in advance,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant