chartjs / chartjs/Chart.js

Using center position axes drags the title into the center of the chart area as well

Open
#11,307 2 comments 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

### Expected behavior

When using the center positioning as documented [here](https://www.chartjs.org/docs/latest/samples/scale-options/center.html), any axis titles should either be able to be independently positioned or should remain at the default axes locations.

### Current behavior

When the axes are positioned in the center, any title that is defined for them is also dragged into the center of the chart area, obscuring the data points and making the titles difficult to read.

Source documentation referenced: [Center Positioning](https://www.chartjs.org/docs/latest/samples/scale-options/center.html)

Steps to reproduce:

1. Go to the scale-options center page [here](https://www.chartjs.org/docs/latest/samples/scale-options/center.html)
2. Click on the "Position: center" button
3. Update the config to the sample shown below
`const config = {
type: 'scatter',
data: data,
options: {
responsive: true,
plugins: {
title: {
display: true,
text: 'Axis Center Positioning'
}
},
scales: {
x: {
min: -100,
max: 100,
title: { display: true, text: 'X-Label'}
},
y: {
min: -100,
max: 100,
title: { display: true, text: 'Y-Label'}
}
}
},
};`

image

### Reproducible sample

https://codepen.io/John-McCarthy/pen/YzJBByY

### Optional extra steps/info to reproduce

_No response_

### Possible solution

_No response_

### Context

_No response_

### chart.js version

4.2.1

### Browser name and version

_No response_

### Link to your project

_No response_

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.