13 Commits

Author SHA1 Message Date
Josh Kelley
3361a63705
Require 'this' when calling tick formatters (#12064)
The `numeric` and `logarithmic` tick formatters require that `this` be provided. That happens automatically if they're used directly as a tick callback but not if they're invoked manually. Failing to pass `this` results in runtime errors similar to the following:

```
TypeError: Cannot read properties of undefined (reading 'chart')
```
2025-04-18 13:16:34 +02:00
Josh Kelley
370f6c385d
Fix helpers Chart type (#12012)
helpers.dom.ts functions referenced the internal `Chart` JavaScript class rather than the published `Chart<TType, TData, TLabel>` TypeScript definition. This causes errors when outside code tries to call helper functions.

The two `Chart` interfaces are incompatible - the `width`, `height`, and `currentDevicePixelRatio` properties are declared as readonly in the TS declaration but are manipulated by helpers.dom.ts functions, and helpers.dom.ts functions need to be invoked both by internal Chart.js code (which uses the JS class) and by outside code (which uses the TS types). To address this, I'm importing the JS version as `PrivateChart`. There may be a better solution.

It's my understanding that the comment about "typedefs are auto-exported" is obsolete now that helpers.dom is a native TS file.

Fixes #11153
2025-01-30 10:29:19 +01:00
DustinEwan
3a515d08e8
fix: correct typing for doughnut, pie, and polarArea charts (#11521)
* fix(#10896): correct typing for doughnut, pie, and polarArea charts

* formatting
2024-11-18 15:43:17 -05:00
Jacco van den Berg
03d1d5caa2
Allow array's in backgroundColor defaults and add hover background and border color to defaults (#11931)
* Allow array as default and add extra default options

* Add test

---------

Co-authored-by: Jacco van den Berg <jacco@jem-id.nl>
2024-10-15 20:31:51 +02:00
stockiNail
bda2ae7c4f
Revert feature to disable plugins by TS (#11422) 2023-07-26 08:59:42 -04:00
stockiNail
f287be491c
Add missing feature for disabling plugins in TyeScript (#11403)
* Add  missing feature for disabling plugins in TyeScript

* apply review

* remove empty line
2023-07-24 15:39:38 -04:00
Dan Onoshko
6cb10dc895
chore: #10963 revert (#11102) 2023-02-07 11:51:48 -05:00
Jacco van den Berg
d20b59fb03
Add colors plugin TS options to be configured (#11115) 2023-02-07 08:19:00 -05:00
Michiel Lankamp
0e189dd554
fix: updated type for doughnut offset (#11051) 2023-01-13 10:06:33 +02:00
Dan Onoshko
fd505acced
fix: fix Plugin interface (#11016) 2022-12-22 16:17:28 -05:00
Dan Onoshko
64a027874c
fix: move types to src dir to escape src / dist dirs in paths (#10993) 2022-12-16 07:56:06 -05:00
Jukka Kurkela
aee979da54
Types: fix bubble chart options (#8625) 2021-03-13 08:04:59 -05:00
Samuel Gratzl
4eeed6e876
WIP: TypeScript types (#7668)
First version of types
2020-08-04 16:52:57 -04:00