chartjs / chartjs/Chart.js

Time cartesian axis generates incorrect tick width for first and last tick

Open
#11,582 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

For a dataset that ranges from 1st of January until current date the widths of the ticks (when set to months) should align with the correct dates.

### Current behavior

I have a dataset with production values for each day of the year, and the time unit set to "month".

This cuts the width of the tick for January in half, and then adds half of an empty tick for December. So the tick for January covers the dates from 1st of January until the 16. of January, and then the start and end of the following ticks are incorrectly placed.

The dates of the dataset goes from 1. of January until yesterday (13th of November) and are chronologically sorted

### Reproducible sample

https://codepen.io/Bjarte-Sebastian-Hansen/pen/VwgzogO

### Optional extra steps/info to reproduce

_No response_

### Possible solution

_No response_

### Context

_No response_

### chart.js version

4.4.0

### Browser name and version

Chrome 119.0.6045.105

### 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.