chartjs / chartjs/Chart.js

`base` dataset property for `bar` charts is not indexable when it should be

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

Description

### Expected behavior

The `base` dataset property `bar` charts for should be indexable, which means that each bar should have its own base
*Reminder: according to the docs, base is:*
> Base value for the bar in data units along the value axis. If not set, defaults to the value axis base value.

### Current behavior

All bars have the same base (the first value of the array if we use an array)
And it doesn't work either using the scriptable way since the function is also called once

### Reproducible sample

https://codepen.io/Truite-Seche/pen/MWxayZm

### Optional extra steps/info to reproduce

Put an array as `base` on a `bar` chart

### Possible solution

Make `base` scriptable and indexable, but this is theoretically already the case according to the docs.

### Context

_No response_

### chart.js version

v4.4.1

### Browser name and version

Microsoft Edge (Chromium) v120.0.2210.91

### Link to your project

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the reproducible CodePen sample and the bar chart `base` option described in the issue. Trace how array and scriptable `base` values are resolved for each bar, then verify that each bar receives its own base value and that the existing behavior is covered by an appropriate test.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.