Commit Graph

371 Commits

Author SHA1 Message Date
Jukka Kurkela
0d250a1fbf Fix setActiveElements behavior after a mouse event (#9992)
* Fix setActiveElements behavior after a mouse event

* Better variable name
2021-12-17 00:34:53 +02:00
Jukka Kurkela
ba6b446b04 Limit active element changes to chartArea (#9970)
* Limit active element changes to chartArea

* CC, remove duplicate ChartEvent interface

* CC2
2021-12-08 16:44:45 +02:00
Jacco van den Berg
e7aec8c301 add beforeDestroy hook (#9933)
* add `beforeDestroy` hook
* add documentation of destroy lifecycle, add `afterDestroy` hook and deprecate destroy
2021-12-05 09:05:18 -05:00
Jukka Kurkela
838d40b2c8 Synchronize data visibility with data changes (#9857)
* Synchronize data visibility with data changes

* avoid babel spread bug

* Simpler?

* one more

* simple enough, cc?
2021-11-18 00:13:31 +02:00
Jukka Kurkela
0dc733a96c Configure all datasets before updating any (#9872)
* Update misleading sample comment

* Configure all datasets before updating any
2021-11-18 00:09:25 +02:00
Josh Kelley
aac0bef060 Fix cleaning up metasets (#9656)
* Fix cleaning up metasets

I believe it's a mistake to only delete the metaset if it has a valid controller; see f191f2f5 for where this behavior was introduced.

This is a minimal fix for #9653; as discussed there, it may also be worth updating `updateHoverStyle`.

As of #7030, `this._metasets` should always be defined, so checking whether it's undefined is no longer necessary.

* Add a test covering metaset behavior

* Add a regression test for #9653; fix `toHaveSize` usage

* Fix test failure
2021-10-23 18:46:33 +03:00
Jukka Kurkela
6a250de81d Add chart, p0.raw, p1.raw to segment context (#9761)
* Add chart, p0.raw, p1.raw to segment context

* Types
2021-10-15 15:56:29 -04:00
Jukka Kurkela
12c5f9a839 Support nested scriptable options for datasets (#9758)
* Support nested scriptable options for datasets
2021-10-13 08:41:22 -04:00
Jukka Kurkela
bc5e5cbf11 Disable animations for BasicPlatform (offcreen) (#9751)
* Disable animations for BasicPlatform (offcreen)
* Update types
2021-10-11 14:37:25 -04:00
Jukka Kurkela
e1ae5e6abf Add layout.autoPadding option (#9716) 2021-10-04 14:01:10 -04:00
Evert Timberg
8e68481ec4 Remove const me = this pattern (#9646) 2021-09-14 07:37:22 -04:00
Jukka Kurkela
50ad1637b0 Fix plugin event filtering of renamed events (#9613) 2021-09-04 13:41:47 -04:00
Jukka Kurkela
fca0309223 Detect attach/detach from any level (#9557) 2021-08-18 18:14:09 -04:00
Jukka Kurkela
4d99658155 Remove chart.scale property (always undefined) (#9556) 2021-08-17 07:52:04 -04:00
Jukka Kurkela
cf951ac611 Add ability to hide specific data element (#9450) 2021-07-21 07:08:02 -04:00
Jukka Kurkela
bc7c58d46d Fix: config.platform was ignored (#9442) 2021-07-20 07:51:16 -04:00
Jukka Kurkela
4002694e26 Fix: Don't use clip/unclipArea when clip: false (#9286) 2021-06-18 14:11:33 -04:00
Jukka Kurkela
9326309afd Fix error when swapping dataset locations (#9183) 2021-05-30 07:39:00 -04:00
Josh Kelley
1df4883aff Fix detecting changed events (#9050)
* Fix detecting changed events

Because `this._listeners` may contain both event handlers from options and internal event handlers for responsive support, the `setsEqual` check would often fail, causing event handlers to be unnecessarily detached and reattached and fired.

If I'm understanding correctly, this is the root cause of #9049.

* Use a separate object for responsive listeners

Correctly update events when responsive property changes as well as when requested events change.

* Code review feedback
2021-05-10 08:48:03 -04:00
Toni Dietze
c955ffad64 Round canvas.style dimensions to avoid blurring (#9015)
When canvas.height and canvas.width are set, the numbers are rounded to
integers. The same rounding must be applied to canvas.style.height and
canvas.style.width to avoid scaling of the canvas which would lead to
blurring.

Acknowledging that canvas.height and canvas.width are integers, the
framebuffer is now only redrawn if those integer values change.
2021-05-08 08:11:52 +03:00
Evert Timberg
e29ba78cd1 Allow the events option to be changed at runtime (#8928) 2021-04-17 14:08:36 -04:00
Jukka Kurkela
0ae0fd4b2a Limit onHover to chartArea (#8794) 2021-04-10 16:13:30 -04:00
Jukka Kurkela
9e70913bed Enable event filtering per plugin (#8876) 2021-04-10 15:18:30 -04:00
Jukka Kurkela
dd99005b5a Remove line interaction overrides + hover.onHover (#8770)
* Remove interaction mode overrides + hover.onHover

* Restore bar override
2021-04-01 13:47:11 -04:00
Jukka Kurkela
b2c7baf10d Avoid recursive event replay loops (#8738)
* chart._lastEvent = null while processing onHover

* Pass replay flag to external tooltip

* Add test for replay

* cc
2021-03-27 06:11:51 -04:00
Evert Timberg
4ef04a8f78 Allow changing the aspect ratio (#8659)
* Allow changing the aspect ratio

* Add test and require `resize()` call

* Update to respect maintainAspectRatio
2021-03-18 23:07:32 +02:00
Jukka Kurkela
79cc6d3206 Use maxOverflow as minimum layout padding (#8650)
* Use maxOverflow as minimum layout padding

* fixes
2021-03-16 16:32:29 -04:00
Jukka Kurkela
8d6e87881a Relocate chart type and dataset type defaults (#8563)
* Relocate chart type and dataset type defaults

* Update types

* Separate overrides and descriptors

* Update derived sample, use merge for inherit

* Don't merge overrides

* Review update
2021-03-06 10:34:52 -05:00
Jukka Kurkela
061e3dbf2f Fix calling of onResize (#8529)
* Fix calling of onResize

* Try to fix the bugging animation test

* try again

* and the actual fix

* maybe now
2021-02-26 14:55:43 -05:00
Jukka Kurkela
8796a1ba1d Fix stacking bug when a dataset is removed (#8520) 2021-02-24 17:31:17 -05:00
Jukka Kurkela
2edd07d724 Config is no longer updated by options setter (#8516) 2021-02-24 16:34:29 -05:00
Jukka Kurkela
ee74dd646a Add resizeDelay option (#8509)
* Add resizeDelay option
* Extract helper
2021-02-23 18:40:57 -05:00
Jukka Kurkela
a6a12282c4 Fix memory leak on destroy (#8438) 2021-02-16 10:26:22 -05:00
Jukka Kurkela
b77f2585b1 perf: resolver caching (#8435)
* perf: resolver caching

* Fix plugin caching

* resetCache

* Reduce duplication, cache only by keys cached

* Reduce lines

* reduce more lines

* Double plural, noop-caching of chart level options
2021-02-16 15:43:11 +02:00
Jukka Kurkela
9fb87a4fc2 Round canvas size to 0.1px resolution (#8437)
* Round canvas size to 0.1px resolution
* Types + docs
* typofix
2021-02-16 08:30:40 -05:00
Jukka Kurkela
5baafac8ad Make Chart static properties and methods read only (#8431) 2021-02-15 15:06:37 -05:00
Jukka Kurkela
cfd9c98575 Option resolution with proxies (#8374)
* Option resolution with proxies

* Remove plugin fallback to root options/defaults

* Update core plugins, reduntant font fallbacks

* Add some notes
2021-02-15 14:42:32 -05:00
Jukka Kurkela
422d26d32a Optimize context object construction (#8413)
* perf: context construction
* avoid setPrototypeOf
2021-02-14 10:34:49 -05:00
Jukka Kurkela
6de5b3fa9e Small chores (#8408) 2021-02-10 18:06:48 +02:00
Jukka Kurkela
ddfbcf777a Update eslint-config-chartjs to v0.3.0 (#8406) 2021-02-10 08:21:39 -05:00
Jukka Kurkela
ffe4ab14dc Remove options.scale, in favor of options.scales.r (#8393)
Remove options.scale, in favor of options.scales.r
2021-02-06 16:19:21 -05:00
Evert Timberg
650956b2e1 Create a new hook to enable data decimation (#8255)
* Create a new hook to enable data decimation

The `beforeElementUpdate` hook can be used to decimate data. The chart
elements will not be created until after this hook has fired ensuring that
if decimation occurs, only the needed elements will be created.

* Address code review feedback

* Rename hook to beforeElementsUpdate

* Simplify parsing logic

* Add decimation plugin to the core

* Allow a dataset to specify a different data key

* Decimation plugin uses the dataKey feature

* Refactor the decimation plugin to support configurable algorithms

* Lint the plugin changes

* Tests for the dataKey feature

* Convert test files to tabs

* Standardize on tabs in ts files

* Remove the dataKey feature

* Replace dataKey usage in decimation plugin

We define a new descriptor for the `data` key allowing the
plugin to be simpler.

* Disable decimation when indexAxis is Y

* Simplify the decimation width approximation

* Resolve the indexAxis correctly in all cases

* Initial documentation

* Reverse check

* Update TS definitions for new plugin options

* Move defineProperty after bailouts

* Add destroy hook
2021-02-01 16:37:32 -05:00
Jukka Kurkela
2890b7022b Shave off some bytes (#8362) 2021-02-01 08:39:43 -05:00
Jukka Kurkela
ad84d285d8 Rename LayoutItem.fullWidth to fullSize (#8358) 2021-01-31 13:44:44 -05:00
Ben McCann
00dbe71dbb Revert "Update spelling of cancellable (#8236)" (#8312)
This reverts commit e6dfc47927.
2021-01-16 21:14:15 +02:00
Jukka Kurkela
d00ffdcd76 Tooltip: Render when animations are disabled (#8252) 2020-12-30 08:33:30 -05:00
Jukka Kurkela
2e43f787de Fix small bugs when animations are disabled (#8253)
* Fix small bugs when animations are disabled
* Update test
2020-12-30 08:31:30 -05:00
Jukka Kurkela
c2091fc77d Skip reset when animations are disabled (#8248)
* Skip reset when animations are disabled
* Review update
2020-12-29 10:10:32 -05:00
Jukka Kurkela
66c92548e8 Rename helpers.clear to helpers.clearCanvas (#8238)
* Change parameters of helpers.clear

* Update test
2020-12-28 10:21:46 +02:00
Ben McCann
e6dfc47927 Update spelling of cancellable (#8236) 2020-12-28 10:20:55 +02:00