chartjs / chartjs/chartjs-chart-financial

Y-Axis auto scaling excludes datapoint at scale.x.max

Open
#250 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
809
Forks
199
PR merge metrics
No merged PRs in 30d

Description

I'm fiddling with min and max properties of the timeseries scale at the moment and I've come across a weird behaviour.

When setting the `scale.x.max` property to the `x` value of any datapoint, that datapoint is being ignored when the y-axis does its auto scaling.

Here's a minimal example: https://stackblitz.com/edit/vitejs-vite-yzysxr?file=src%2Fmain.ts
Uncomment line 32 to see the problem.

![correct](https://github.com/user-attachments/assets/fdfa29a0-d71f-4f20-b1b7-f9c75a59f135)
![incorrect](https://github.com/user-attachments/assets/1553b5ce-a5ee-40f7-9fd0-bba81b5d3508)

I'd appreciate if anyone could look into this :)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the minimal StackBlitz example linked in the issue and uncomment line 32 to reproduce the scaling problem. Trace how the timeseries scale's x.max boundary is used when calculating y-axis auto-scaling. Done means the datapoint whose x value equals scale.x.max is included in the y-axis range, with the example showing correct scaling.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.