Commit Graph

89 Commits

Author SHA1 Message Date
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
Evert Timberg
b036b7ba92
Provide a method to quickly register all imports in ESM builds (#8425) 2021-02-15 11:21:31 +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
Jukka Kurkela
90758950ad
Update ScriptableContext, reduce warnings (#8390)
* Update ScriptableContext, reduce warnings

* _parsed is unknown[]

* Add defaults

* static defaults.

* review update

* more cancelables
2021-02-05 19:59:55 -05:00
LeeLenaleee
22ca8af1cd
Fix/type dateadapter override (#8377)
* Not totally sure this is right , but since in core.adapters.js override is part of the dateadapter it seems logical it should be there. Should also fix #8369
* implemented feedback
* Declare the dataAdapter since it will be available at runtime if someone overrides it
* remove declaration. if this is giving problems in the future it might need te be added again
2021-02-05 19:15:35 -05:00
Jukka Kurkela
6e56ae64f7
Update types for indexAxis (#8389)
* Add indexAxis to CoreChartOptions
* Update types for indexAxis
2021-02-05 17:39:45 -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
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
LeeLenaleee
a58d43cbda
fixes #8304 (Missing type) beta 8 broken typescript (#8305)
* fixes #8304

* Update layout.d.ts

First letter of variable from capital to normal
2021-01-14 07:45:12 -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
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
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
stockiNail
f16e836c3d
Add color options to documentation and types where missing (#8196)
* fixes #8188 and #8189

* removes scriptable context sample with link to options page

* Removes <code> tags in markdown where not needed
2020-12-18 22:03:01 +02: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
Jukka Kurkela
b2d5a5fa97
Update defaults and types for tick stroke (#8195) 2020-12-18 12:36:18 -05:00
Evert Timberg
b54bd272fb
Move tooltip plugin hooks to the core Plugin type (#8160)
* Move tooltip plugin hooks to the core
* Try and use declaration merging for Plugin type
* Merge Plugin types
2020-12-17 18:10:29 -05:00
Josh Kelley
dc00ed08cb
Update docs on printing (#8149)
From what I can tell from testing locally, Chrome doesn't reliably trigger resize events for the final print layout, so using `.resize()` with no parameters doesn't generally work.

I'm not sure if there are circumstances in which the original docs' suggestion of using `.resize()` with no parameters can work; if the original text should be deleted, I can do so.

I also noticed that the TypeScript type definitions for `.resize()` mark the parameters as required, even though the implementation and docs don't require them.
2020-12-10 16:25:00 +02:00
lab900-marcel-samyn
e08b17636b
[v3] Add locale to ChartOptions type (#8118)
* Add locale to ChartOptions type

* Adds locale options documentation

* fixed typo

* changes links to number format, linking the constructor

* changes to a better sentence

* changes to better sentence (2)

Co-authored-by: stock <stocki.nail@gmail.com>
2020-12-04 08:25:43 +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
78dbeea1f0
Add new hooks for plugins (#8103)
* Notify beforeUpdate on disabled plugins

cc?

cc2

cc3

typo

* init, unInit, enabled, disabled

self review :)

update the new hook signatures to unified

merge error

* Review update

* start/stop, cc

* types, jsdoc

* stop between destroy and uninstall
2020-11-28 22:57:45 +02:00
Mostafa Sameti
f014873864
fix color type & add background and border color (#8110) 2020-11-28 15:06:38 -05:00
Jukka Kurkela
61aea761f4
Unify signature of plugin hooks (#8102) 2020-11-28 09:45:43 +02:00
Jukka Kurkela
913a01a3a6
Move title, tooltip and legend to options.plugins (#8089)
* Move title, tooltip and legend to options.plugins

* Update tooltip.md

* Update legend.md and title.md

* Add migration notes

* typo

* Types

* Restore plurals

* One more s, restore tabs

* All plugins disabled

* lint

* cc
2020-11-25 08:50:12 +02:00
Jukka Kurkela
f96fa2b96d
Allow single parameter to Defaults.set (#8050)
* Allow single parameter to Defaults.set

* Review update

* Record
2020-11-19 20:58:24 +02:00
Evert Timberg
85fc6cc49c
Rename uppercase types to camel case (#8074)
* Rename uppercase types to camel case

* Rename SCALES to TScale
Reanme DSE to TDatasetElement
Rename E to TElement
2020-11-19 08:10:26 -05:00
Jukka Kurkela
988c865599
Add plugins to CoreChartOptions (#8048) 2020-11-16 20:58:13 +02:00
xr0master
3f413c7bcf
Fix inconsistency in types for LABEL (#8027)
Co-authored-by: Sergey Khomushin <sergey@placer.io>
2020-11-09 16:23:14 +02:00
emmcbd
7ad91817e7
Improved types for defaults (#8025) 2020-11-08 09:52:41 -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
xr0master
afbe03cce4
[types][beta-5] fixed stacked scale, changed default type for data.labels (#8001)
* Scale: added the stacked property for all scales
* interfaces: generic type LABEL can be string, Date, etc.
* controllers: stack can be used for all types of dataset
* docs/data-structures: added general dataset properties

Co-authored-by: Sergey Khomushin <sergey@placer.io>
2020-11-05 09:12:25 -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
Dan Manastireanu
6869a41d40
feat: Draw tooltips with point styles. Closes #7774 (#7972)
* feat: Draw tooltips with point styles. Closes #7774

* chore: Add tooltip usePointStyle docs

* chore: Add tests and visual tests for tooltip usePointStyle

* chore: Update typescript with tooltip usePointStyle
2020-10-29 22:55:40 +02:00
Dan Manastireanu
aad748dc5a
feat: Make options.layout.padding scriptable. Closes #7873 (#7968) 2020-10-28 11:28:17 -04:00