chartjs / chartjs/Chart.js

Other stepped options

Open
#11,911 1 comment 0 reactions 0 assignees View on GitHub
type: enhancement
Dominant language
JavaScript
Stars
67.7k
Forks
11.9k
Avg merge
7h 39m
Merged PRs (30d)
5

Description

### 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](https://github.com/user-attachments/assets/2112c72b-8d8a-49cc-9152-36d331dcae93)
- 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](https://github.com/user-attachments/assets/d078edcc-6e9f-46b6-96a0-fe2324a6d091)
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)
}`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.