1159 Commits

Author SHA1 Message Date
asmenezes
e8c58daf72
Enable scale title stroke (12092) (#12130)
* Enable text stroke on scale titles

* update documentation

* specify stroke width units

* Simplify usage of strokeColor and strokeWidth

* Add scale title stroke test

* Enable text stroke on scale titles

* update documentation

* specify stroke width units

* Simplify usage of strokeColor and strokeWidth

* Add scale title stroke test

* Implement non image based tests

* Remove image based test
2025-10-20 18:37:39 -04:00
Bojidar Marinov
6372280085
Do not notify plugins after their uninstall function has been called (#12098)
Fixes #12032
2025-07-12 12:29:51 -04:00
Bojidar Marinov
beb77e475b
Sync Doughnut chart legend options to legend plugin (#12096)
Fixes #12060
2025-07-11 21:52:33 +02:00
Bojidar Marinov
5feebdf7b7
Fix charts shinking in size on certain Zoom values in Chrome (#12097) 2025-07-11 21:38:17 +02:00
William Entriken
debdf07c1d
Fix min js two renames (#11470)
* Name artifact chart.umd.js, fixes #11455

* Add (.min)? to karma filter
2025-06-10 08:31:41 -04:00
Xavier Leune
8ea47cad19
Fix: display stacked bar with multiple x-Axis (#12070) 2025-06-05 17:27:56 +02:00
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
Pierre
74961d1c86
Add selfJoin option for doughnut graphs (#12054)
Co-authored-by: Pierre Gueguen <gueguenpierre.pro@gmail.com>
2025-04-15 15:32:13 +02:00
FabTechAT
9b1306ab0a
feature: make above/below colors in filler plugin work with pivoted line charts (#12058)
* adapted filler plugin to make above/below colors work with pivoted line charts

resolved conflicts in src/plugins/plugin.filler/filler.drawing.js

* fixed doFill; added tests
2025-04-15 15:31:58 +02:00
Adrian Cerbaro
3dffb4fb8e
fix: respect dataset clipping area when filling line charts (#12057)
* fix(plugin.filler): respect dataset clipping area when filling line charts

The filling area must respect the dataset's clipping area when clipping is enabled. Before this change, the line would be clipped according to the dataset's area but the fill would overlap other datasets.

Closes #12052

* chore(plugin.filler): use @ts-expect-error instead of @ts-ignore
2025-04-14 15:41:14 +02:00
Josh Kelley
2f425290ee
[fix] Handle non-primitives in isNumber (#12034)
While investigating https://github.com/chartjs/chartjs-plugin-zoom/issues/928, I found that `isNonPrimitive` will throw TypeError on a Moment.js object after it's passed through Chart.js's options proxy, because the object has its `Symbol.toPrimitive`, `toString`, and `valueOf` all set to null.

(See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#string_coercion for background reading.)

Since isNumber appears to be a low-level function that can take any arbitrary input, it seems worth letting it handle this case.
2025-02-16 12:24:26 -05: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
Mariss Tubelis
97b564b718
Bugfix: Binary search wrapper returns non-existing index (#11991) 2025-01-05 09:42:33 -05:00
Mariss Tubelis
a77a63b16b
Bugfix: return nearest non-null point on interaction when spanGaps=true (#11986)
* First step in fixing the bug of spanGaps null point interaction

* Complete bugfix of spanGaps null point interaction

* Add two tests in core.interaction.tests for the bugfix change

* Remove odd line break

* Use isNullOrUndef helper for point value checks

* Add 10 more test cases for nearest interaction when spanGaps=true
2025-01-03 10:50:56 -05:00
Mariss Tubelis
1e3d6e5711
Bugfix: span gaps over null values beyond scale limits (#11984)
* Bugfix: spanGaps not working near min and max limits

* Fix error when meta.dataset.options = null

* Add tests for correct setting of line controller properties _drawStart and _drawCount

* Fix spacing in controller line tests

* Add tension to test

* Add a better test case

* Avoid the use of FindLastIndex

* Avoid taking 0 for null value and improve naming
2025-01-02 19:17:24 -05: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
Nikolai Iakovlev
6dd448b933
Fix: applyStack() returned the sum of all values for hidden dataset indices, which resulted in wrong show animations (#11938) 2024-10-24 11:55:58 -04: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
Jacco van den Berg
3f2968cb41
Add check to colors plugin if defaults are set (#11927) 2024-10-13 09:12:16 +02:00
Jacco van den Berg
680cd227d4
Fix initial dataset stacks (#11882)
* Update cahced _stacked value after updating stacks

* Add test

---------

Co-authored-by: Jacco van den Berg <jacco@jem-id.nl>
2024-08-26 17:13:12 +02:00
Jacco van den Berg
3dac05ed00
Return false from the average tooltip positioner on no valid data (#11863) 2024-08-17 08:52:36 +02:00
huqingkun
b9c01414ba
Bugfix/issue 11804 tooltip show for all invisible (#11858)
* exclude 0 angle from inRange to not showing tooltip when all data are hidden

Signed-off-by: Hu, Vince <Qingkun.Hu@fmr.com>

* test 0 angle point not in arc range

---------

Signed-off-by: Hu, Vince <Qingkun.Hu@fmr.com>
2024-08-12 11:56:35 -04:00
huqingkun
147ee593ba
fix issue #11717 (#11844)
* fix issue #11717

Signed-off-by: Hu, Vince <Qingkun.Hu@fmr.com>

* unit test for issue #11717

* fixing test lint style issue

* update codes according review comments

---------

Signed-off-by: Hu, Vince <Qingkun.Hu@fmr.com>
2024-08-06 17:32:26 +02:00
Jacco van den Berg
ff740789a5
Fix drawing angle lines on reversed radial scale (#11788)
* Fix drawing angle lines on reversed radial scale

* add test

* Show ticks in test

---------

Co-authored-by: Jacco van den Berg <jacco@jem-id.nl>
2024-05-24 16:15:28 +02:00
Jon Dufresne
5c9e5c66d2
Fix some typos (#11781) 2024-05-21 12:10:07 +02:00
Arun Philip
e7b8fa290f
do not attempt to clear canvas if one does not exist (#11764)
* do not attempt to clear canvas if one does not exist

* update test to explicitly run clearCanvas method to ensure it doesn't throw an error

* explicitly set canvas and ctx to null in test since the helper in test code didn't

* Update test/specs/helpers.canvas.tests.js

---------

Co-authored-by: Jacco van den Berg <jaccoberg2281@gmail.com>
2024-05-17 08:16:58 -04:00
Jacco van den Berg
8c004a1c42
Create parsed object with correct keys (#11690)
* Create parsed object with correct keys

* Add test
2024-04-28 20:37:29 -04:00
Megaemce
4068bd8c47
fix #11503, autoskipping 0 ticks when min is below 0 (#11682) 2024-02-24 20:30:35 +01:00
Hyun-je Alex Moon
dff44828db
fix(#11615): fix calculating caretX position on stacked bar with index interaction. (#11616) 2023-12-27 07:18:14 +01:00
Josh Kelley
429d99dbc2
Tooltip fixes (getLabelAndValue on null controller, null getParsed) (#11596)
* Fix for getLabelAndValue on null controller

I encountered #11315 under the following circumstances:

1. Position the cursor over the chart area, such that it causes a
   tooltip to be shown.
2. Move the cursor out of the chart area, such that the tooltip remains
   visible.
3. Cause the chart contents to be changed, such that the dataset
   referenced by the active tooltip element is no longer valid.
4. Move the mouse again.  This triggers an `inChartArea = false` event,
   so it reuses the previous, now invalid, active elements.

This fixes #11315 under the circumstances for which I've reproduced it,
but there may be others.

* Further fixes for elements added / changed

This possibly fixes #11365.
2023-11-29 14:51:56 -05:00
Jacco van den Berg
2a03e138e9
Fix backdrop padding (#11577)
* fix for alignment inner

* Add test

* Remove eslint ignores

* remove unecesarry config

* Remove text from test
2023-11-10 00:25:36 +01:00
stockiNail
79f1a0a9e8
Add clip option to scale configuration to allow unclipped scales (#11404)
* Add clip option to scale configuration to allow unclipped scales

* add images

* fix cc

* change name of function
2023-08-07 20:16:20 +02:00
stockiNail
a102ca515b
Revert fix for monotone cubic interpolation (#11432) 2023-08-02 10:42:29 -04: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
stockiNail
cc7ee8ade1
Fix curve path if scale limits are set for line chart (#11377)
* Fix curve path if scale limits are set for line chart

* add scale limits test case
2023-07-24 19:58:23 +02:00
stockiNail
05608b0ceb
Fix time series scale to have each data point is spread equidistant (#11388)
* Fix time series scale to have each data point is spread equidistant

* remove tabs

* remove casting and add/update test cases
2023-07-13 16:36:08 -04:00
stockiNail
57bbd8229d
Fix mismatch between hit boxes and drawn items in legend plugin (#11352)
* Fix mismatch between hit boxes and drawn items in legend plugin

* fixes padding calculation
2023-06-20 18:20:12 +02:00
stockiNail
ec7be48470
Fix toggling showLine option on scatter controller (#11334) 2023-06-08 08:53:50 -04:00
stockiNail
eff39c0769
Enable point labels hiding when overlapped (#11055)
* Enable point labels hiding when overlapped

* fix cc

* fallback CC updates

* fixes CC
2023-04-27 18:28:55 -04:00
stockiNail
ee7e928cfe
Enable applying of gradients and pattern on line segments (#11217)
* Enable applying of gradients and pattern on line segments

* add test case

* improve replacer
2023-04-27 18:25:13 -04:00
stockiNail
5ee0ff1b97
Border is counted as part of ArcElement (#11180)
* Border is counted as part of ArcElement

* improve calculation
2023-04-19 18:22:40 -04:00
stockiNail
82aca7852f
Use custom scale defaults and dataset axis ID options to determine the axis (#11134)
Use custom scale defaults to determine the axis
2023-02-15 09:27:13 -05:00
stockiNail
7f9bca6844
Add borderDash options to arc element (#11127) 2023-02-12 17:46:05 -05:00
CodingMarco
e417c60c22
Fix: don't generate ticks > max if max is specified (#11116)
* Fix: don't generate ticks > max if max is specified (#11083)

* Add test "Should not generate any ticks > max if max is specified" (#11083)
2023-02-10 07:57:58 -05:00
stockiNail
8dfcf1c443
Use maxTicksLimit option to calculate the labels size on ticks (#11069)
* Use maxTicksLimit option to calculate the labels size on ticks

* apply review
2023-02-09 09:26:11 -05: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
stockiNail
e8d9fb579e
Add format method to time scale to format timestamp using scale options (#11063) 2023-01-18 08:27:52 -05:00
stockiNail
ab55f6c976
Check colors definition in the chart options (#11003)
* Check colors definition in the chart options

* Update src/plugins/plugin.colors.ts

Co-authored-by: Dan Onoshko <danon0404@gmail.com>

* Update src/plugins/plugin.colors.ts

Co-authored-by: Dan Onoshko <danon0404@gmail.com>

* Update src/plugins/plugin.colors.ts

Co-authored-by: Dan Onoshko <danon0404@gmail.com>

* apply review

Co-authored-by: Dan Onoshko <danon0404@gmail.com>
2023-01-18 13:31:33 +01:00