Commit Graph

22 Commits

Author SHA1 Message Date
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
Evert Timberg
49b0916c19
Update type map names (#8356)
* Rename ElementOptions to ElementOptionsByType

* Rename CommonOptions to CommonElementOptions

* Rename PluginOptions to PluginOptionsByType
Add new PluginChartOptions and remove some duplicates

* Rename ScaleOptions to ScaleOptionsByType

* Use Partial where appropriate
2021-02-01 08:38:37 -05:00
Jukka Kurkela
ad84d285d8
Rename LayoutItem.fullWidth to fullSize (#8358) 2021-01-31 13:44:44 -05:00
Josh Kelley
5eb3682b9f
Give elements their own interface definition (#8290)
From what I understand, if we want to allow registering additional element options (see [here][1] for an example), then the element options need to be a top-level interface so that they can be used with TypeScript's [declaration merging][2].

[1]: https://github.com/chartjs/chartjs-plugin-annotation/pull/275#issuecomment-742754562
[2]: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
2021-01-30 14:48:18 -05:00
LeeLenaleee
bc312d0dbc
feature: choose custom point style for bar legend display (#8341)
* add feature to choose custom point style for bar legend display
* add documentation and type
* the docs are in the right place now
2021-01-30 11:02:08 -05:00
Jukka Kurkela
3c64bc88e8
Doughnut: complete radians to degrees conversion (#8321) 2021-01-16 16:04:48 -05:00
Josh Kelley
fa375ff448
Update TypeScript ESLint configuration (#8288)
Using TypeScript-specific ESLint rules fixes some spurious ESLint warnings.
2021-01-08 16:01:20 -05:00
Jukka Kurkela
81a1e9a95e
Add type linting (#8264) 2021-01-05 07:23:30 +02:00
Ben McCann
4f7179a626
Standardize type declaration indentation with tabs (#8263) 2021-01-02 08:46:49 +02:00
Jukka Kurkela
d00ffdcd76
Tooltip: Render when animations are disabled (#8252) 2020-12-30 08:33:30 -05:00
Evert Timberg
f44db35e2e
Clean up the LayoutItem type (#8235) 2020-12-26 16:22:55 -05:00
Evert Timberg
7415517c83
Cache data limits to ensure they are only computed once per update (#8234)
* Cache data limits to ensure they are only computed once per updaet
* Replace `invalidateCaches` on scales with `beforeLayout`
2020-12-26 14:37:23 -05:00
Evert Timberg
988b3c5d2b
Create standardized text render method (#8227)
* Create standardized text render method
* Document renderText options and enable configurable decoration width
* Add tests for font rendering
* Split color definition to it's own file
* renderText supports setting styles
* Mock context needs to track textBaseline
* renderText can set textAlign and textBaseline
* renderText does not mutate the context + translate/rotate
* Explicitly set the text decoration style
* Move useStroke logic into renderText
* Cartesian scale: Update computeLabelItems to avoid duplicate allocations
2020-12-26 11:23:02 -05:00
Evert Timberg
55dd7ded0e
Remove duplicate Scriptable definitions (#8223) 2020-12-22 13:10:25 -05:00
Evert Timberg
55a26e69ba
Add options to configure tick styling independent of grid lines (#8215)
* Enable axis tick styling independent of grid lines
* Change tickMarkLength to tickLength for consistency with new options
* Add new scale options to TS definitions
2020-12-22 11:27:57 -05:00
Evert Timberg
ec7b381345
Split animation definitions (#8208) 2020-12-20 13:26:09 -05:00
Evert Timberg
388918924f
Split Element type to it's own definition file (#8206) 2020-12-19 21:56:11 +02:00
Jukka Kurkela
dd382bc806
Split adapter types to their own definition file (#8205)
* Split adapter types to their own definition file
* Sort & separate
2020-12-19 14:03:26 -05:00
Evert Timberg
75fcd4fffa
Split geometric types to their own definition file (#8202)
* Split geometric types to their own definition file
* Re-export types
2020-12-19 13:39:35 -05:00
Evert Timberg
a182cbed7b
Merge TS files into a single file to prevent circular loops (#8198) 2020-12-19 10:37:33 -05:00
Josh Kelley
efbaf2c082
TypeScript updates (#8190)
* Update type definitions and docs for legends

* Fix types for onHover and onClick callbacks

core.controller.js's implementation also passes the Chart instance as `this`. However, that isn't documented, and it's my impression that Chart.js is moving away from passing items as `this`, so I didn't declare it in the type definitions.

* Allow multi-line ticks

* Stricter DeepPartial definition

The previous definition resolved to `{}` (which can allow primitives) if it was given a function, so it was far too broad for any `Scriptable<>` properties.

* Grammar and writing style

* Updates to animation docs

Document the `fn` option, since it's in the type definitions.

Fix callback usage to match example code.

* Fix AnimationEvent parameter

The onProgress and onComplete events were mistakenly declared as taking the standard DOM AnimationEvent.  (Should Chart.js's AnimationEvent be renamed to ChartAnimationEvent to avoid any possible ambiguity?)

* Allow false for disabling animations

* Add comments explaining the layout and usage of Rollup
2020-12-18 12:46:54 -05:00
Samuel Gratzl
4eeed6e876
WIP: TypeScript types (#7668)
First version of types
2020-08-04 16:52:57 -04:00