chartjs / chartjs/Chart.js

Not possible to set the default option for each chart

Open
#11,285 1 comment 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

Users should be able to set different font size and font family for each chart.

### Current behavior

Users are not able to set different font size and font family for each chart.

### Reproducible sample

https://github.com/Codeinwp/visualizer/blob/master/js/render-chartjs.js#L211

### Optional extra steps/info to reproduce

Create a Polar area or Radar/spider chart and add it to the same page(single page).
You can verify the same font size and font family are applied to both chart.

I've checked this issue with the latest chart js library
Ref: https://www.jsdelivr.com/package/npm/chart.js?path=dist

Set below default options:
`Chart.defaults.font.family = ''`
`Chart.defaults.font.size = '18'`

### Possible solution

_No response_

### Context

_No response_

### chart.js version

v4.3.0

### Browser name and version

All

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