Commit Graph

351 Commits

Author SHA1 Message Date
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
Jukka Kurkela
7a2acebc28 Layout: enforce box limits, reject <0 chartArea (#8193)
* Skip chartArea boxes when chartArea <= 0
* Legend: limit to maxWidth/maxHeight
* Layout: enforce box limits, reject <0 chartArea
* Update legend fixtures
2020-12-18 12:56:04 -05:00
Jukka Kurkela
b10d994017 Hover: only update styles of changed elements (#8185) 2020-12-17 15:18:02 -05:00
LeeLenaleee
f191f2f5f9 Remove dataset while hovered (#8181) 2020-12-16 16:40:10 -05:00
Josh Kelley
5ed422a93a Update docs for .resize() method (#8151)
See #7678 and #8149.  (The `silent` parameter mentioned in the original 7678 no longer exists.)

Add JSDoc.

Fix some minor issues with grammar and coding style consistency.
2020-12-14 12:30:20 +02:00
Jukka Kurkela
c1aeba1e67 Add new scale hooks for plugins (#8112)
* Add new scale hooks for plugins

* Add notes

* cc

* cancelability
2020-12-02 06:51:47 +02:00
Jukka Kurkela
61aea761f4 Unify signature of plugin hooks (#8102) 2020-11-28 09:45:43 +02:00
Jukka Kurkela
99aa1a4215 Switch to eslint-plugin-es (#8075)
* Switch to eslint-plugin-es

* Restore eslint-config-chartjs

* Sort
2020-11-19 21:23:24 +02:00
Jukka Kurkela
c2dd264fe8 Events: Only render when needed (#8049) 2020-11-13 17:35:40 -05:00
Jukka Kurkela
d74a5d7552 Add type to context objects (#8007) 2020-11-08 08:43:55 -05:00
Evert Timberg
17f6edb650 Remove I prefix from TS types (#8017)
* Remove I prefix from TS types
* Update missing `ILayoutItem` typedefs
* IEvent should become ChartEvent
* Prevent FillTarget collision
* Import FontSpec instead of IFontSpec
* Prevent recursive DateAdapter problem
2020-11-07 08:35:19 -05:00
Jukka Kurkela
10ffe753d9 When data is removed, remove from stacks too (#8013)
* When data is removed, remove from stacks too
* Remove unreferenced metasets
2020-11-06 08:05:56 -05:00
Jukka Kurkela
4daf37e864 Delay resize to just before draw when animating (#7989)
* Remove unused properties
* Delay resize to just before draw when animating
* Remove silent resize, update migration guide
* Fix typo in migrations doc

Co-authored-by: Evert Timberg <evert.timberg+github@gmail.com>
2020-11-01 08:15:43 -05:00
Jukka Kurkela
23bf7c0c89 Preserve scriptable context (#7981)
* Preserve scriptable context
* CC, utilize `index` in tests
* Update example to utilize context
2020-11-01 07:39:08 -05:00
Takuya Uehara
7b6737a209 Check index bounds of datasets for isDatasetVisible (#7986)
* Check index bounds of datasets
* Add test for isDatasetVisible
2020-10-31 08:10:17 -04:00
Jukka Kurkela
4f2511aff3 Relocate dataset defaults to defaults.controllers (#7979) 2020-10-30 18:34:32 -04:00
Jukka Kurkela
6dbb7e7446 Move config handling to a dedicated script (#7939)
* Split core.config.js out of core.controller.js

* Remove side effects from config.js

* Turn config into a class

* Refactor config merging as includeDefaults
2020-10-24 18:37:37 +03:00
Jukka Kurkela
58d1911d05 Add args.mode to before/after update plugin hooks (#7949) 2020-10-24 18:36:31 +03:00
Jukka Kurkela
f5c4f97504 Add interaction options (#7922)
* Add interaction options
* Add migration note
2020-10-19 07:24:06 -04:00
Jukka Kurkela
73b4e82fd5 Use Object.create(null) as merge target, to prevent prototype pollution (#7917)
Use Object.create(null) as merge target to prevent polluting `Object.prototype`
2020-10-18 13:31:01 -04:00
paul cheung
b31a815382 some minor typo fix (#7913) 2020-10-18 09:35:21 -04:00