Commit Graph

269 Commits

Author SHA1 Message Date
Evert Timberg
b95ba3d5c3
Convert the easing helpers to typescript (#10627)
Co-authored-by: Chart.js <>
2022-08-31 09:53:54 -04:00
Dan Onoshko
2031cdf051
Preparing the project for TypeScript (#10595)
* Add Typescript to the build
* Converts the `helpers.core` to Typescript as an example
* Converts the `core.element` to Typescript
2022-08-22 11:58:57 -04:00
Grant Hynd
75793eb86f
fix: allow beforeTooltipDraw to be cancelable (#10598) 2022-08-22 17:33:02 +02:00
Jacco van den Berg
3eb947719e
Put the border opts in own object (#10571)
* put borderOpts in own object

* document z option

* remove todo and change scaleId to id

* update some tests

* clean bit, remove console log

* fix failing test

* lint

* Remove comment
2022-08-18 15:07:46 +02:00
Jacco van den Berg
d09e424a0a
Use borderRadius for legend and remove fallbacks (#10551)
* Use borderRadius for legend

* re enable test

* fix lint

* add note in migration guide

* Update types/index.d.ts

Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
2022-08-18 07:34:18 -04:00
Jacco van den Berg
dad1e98c5a
Allow animations to be set to false for the tooltip (#10582) 2022-08-18 07:33:42 -04:00
Jacco van den Berg
bd29fcbf67
type grouped option for bar chart (#10590) 2022-08-18 09:16:13 +03:00
Jacco van den Berg
d9203719f6
add correct padding object to type (#10585)
* add correct padding object to type

* Apply suggestions from code review

Add spacing

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
2022-08-18 09:15:50 +03:00
Dan Onoshko
ffce0f9f18
feat: tooltip callbacks fallback (#10567)
* feat: tooltip callbacks fallback

* docs: review fixes
2022-08-18 09:03:12 +03:00
John Williams Metservice
7776d27268
Update index.d.ts (#10579)
Allow nulls to be passed to barChart data to allow datasets to spanGaps.
2022-08-17 18:43:46 -04:00
Jacco van den Berg
3df687a87c
Remove destroy hook (#10549)
* remove destroy hook

* revert package-lock.json changes

* update test

* add migration guide note

* fix karma failing test

* change way of importing package.json
2022-08-05 19:51:14 +03:00
Jukka Kurkela
29395d9013
Fix docs build (#10566) 2022-08-05 08:02:04 -04:00
Dan Onoshko
ce375a6876
feat: add ESM support (#10525)
* feat: add ESM support

* build: rename UMD bundle

* chore: edit supbackages description

* style: disable es/no-import-meta linter rule

* test: dynamic import in cjs module

* docs: edit integrations page

* docs: review fixes

* chore: remove useless regex in webpack config

* ci: test size-limit only for ESM bundle
2022-08-04 18:43:26 -04:00
Jacco van den Berg
9dfaa63639
Move parameter of TType in ChartMeta to first option (#10550)
* move paramter of TType in ChartMeta to first option

* add missing ChartMeta change

* Add note in migration guide
2022-08-04 01:06:15 +02:00
Dan Onoshko
844270eb5e
feat: pass some chart options to DateAdapter (#10528)
feat: pass some chart options to DateAdapter
2022-07-30 11:25:01 -04:00
Slava Terekhov
f0be17c859
Add circular prop to arc element (#10405)
* feat: add circular prop to arc element draw actions
* test: add test for arc element with circular:false prop
* feat: add circular prop to Arc element options
* docs: add decriptiption for new Polar area chart prop
* docs: fix circular prop description
* docs: add info about arc element circular prop to elements docs
* docs: move circular prop from general options to styling
2022-07-30 11:08:38 -04:00
Jacco van den Berg
1fef75d990
Skip all borders if borderSkipped === true (#10530)
* Skip all borders if borderSkipped === true

This will allow you to skip all borders (not just one side) if you set borderSkipped to boolean true and so allow you to have a consistent legend marker even for bars without borders. Reason is that even if same colored borders are set there are artifacts that make the bar look bad and also even with inflateAmount the bars do look good when big but when only a few pixel in size they start to look bad too so this was the only way for me to make it work so legends are looking good and bars too.

* fix failing test, update docs and typings

* update typing comment

Co-authored-by: Istvan Petres <pijulius@users.noreply.github.com>
2022-07-30 08:12:53 -04:00
stockiNail
144a6c0c27
Enable borderDash option in the grid as scriptable (#10519) 2022-07-26 08:28:15 -04:00
Jacco van den Berg
97351d1b5d
update typing of clip, allow it to be configurable in the options for typescript (#10494) 2022-07-20 12:51:22 -04:00
Dominic Jean
5452502b8c
Add pointStyleWidth option for legend (#10412)
* add pointStyleWidth for legend

* add drawPointLegend to keep drawPoint signature
2022-07-18 06:49:08 -04:00
Jacco van den Berg
0312697f38
Add index to legendItem interface (#10436)
* Add index to legendItem interface for doughnut, pie and polarArea charts. Make datasetIndex optional since the before named charts dont include it.

* Remove test to check if datasetIndex has been set in generateLabels function for legend
2022-06-22 09:22:53 -04:00
Jacco van den Berg
f796c7b475
Add padding to pointLabels type, add type to scriptable context (#10404)
* Add padding to pointLabelTypings and add type field to context

* Use correct scriptable helper

* Remove trailing space
2022-06-07 15:59:41 +03:00
Jacco van den Berg
2486fe2b1e
Allow for each dataset to be individually typed without a main type (#10387)
* allow for each dataset to be individually typed without a main type
* fix lint issues
* add extra test cases
2022-05-31 14:01:39 -04:00
Jacco van den Berg
5173d05978
Types: Allow font to be partial scriptable and individually scriptable (#10364)
* allow font scriptable to return partial object and be scriptable
* add other elements as scriptable
* rename variable for context to resolve lint issue
* add duplicate font for non scriptable
* change to scriptableOptions
* fix parameter
* missing space
* Change name of helper function to match other helper function
2022-05-25 07:49:12 -04:00
Yiwen Wang
ebcaff15c2
Add option to include invisible points (#10362)
* Add option to include invisible points

* Minor fixes

* Add doc for newly added option

* Fix typo

* Add test for newly added option

* Improve description of the new option

* Update docs/configuration/interactions.md

Co-authored-by: Jacco van den Berg <39033624+LeeLenaleee@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Jacco van den Berg <39033624+LeeLenaleee@users.noreply.github.com>

Co-authored-by: Yiwen Wang 🌊 <yiwwan@microsoft.com>
Co-authored-by: Jacco van den Berg <39033624+LeeLenaleee@users.noreply.github.com>
2022-05-25 13:25:27 +03:00
Jacco van den Berg
2c268f0943
Resolve canvasGradient is undefined in node (#10328)
* Resolve canvasgradient is not defined in node

* Remove trailing white space

* export isPaternOrGradient helper with typings

* fix lint failure, single qoute

* Allow for string inputs too to function
2022-05-03 08:21:43 -04:00
Evert Timberg
5c3dc932b6
Enable configuration of radial scale point label border radius (#10293) 2022-04-15 18:31:09 -04:00
Jukka Kurkela
4b5ca7f24e
Types: add 'middle' to borderSkipped (#10283) 2022-04-05 18:52:45 +03:00
Evert Timberg
a39f694184
Allow time scale to offset using skipped ticks (#10278) 2022-04-03 16:05:43 -04:00
Evert Timberg
09128947d5
Export types for cartesian and radial tick options (#10275) 2022-04-03 16:40:31 +03:00
Jacco van den Berg
1c1368bead
add startangle to radial scale opts (#10269) 2022-03-31 08:08:13 -04:00
Josh Kelley
c057c96693
Interaction functions (#10046)
* Refactor get...Items functions to take events rather than positions

To work toward exposing something like the get...Items functions.

* Switch getAxisItems to use optimizedEvaluateItems

optimizedEvaluateItems falls back to evaluating all items for unsorted items, and sorting / optimizing ought to be okay, so this ought to be equivalent.

* Performance

* Consolidate getRelativePosition

helpers.dom.js's getRelativePosition already had logic to handle ChartEvent vs. Event (as demonstrated by the `native` check within `getCanvasPosition`), so it's redundant for core.interaction.js to have its own `native` check.

Update `getRelativePosition` to use the same `native` check as core.interaction.js's version.  As best as I can tell, the ChartEvent's x and y are populated from `getRelativePosition`, so the previous `getCanvasPosition` was effectively just duplicating `getRelativePosition'`s work.  I added a test to verify this; it depends on a local, not-yet-submitted change in chartjs-test-utils' `triggerMouseEvent` to return the mouse event that it triggers.

* Add an API to refactor duplicate isPointInArea

* Rename and update JSDoc to prepare for making this public

* Give functions a consistent, generic interface

* Export functions for discussion

* Code review feedback

Add a non-null assertion, as requested in code review.

Add JSDoc to clarify that `getCanvasPosition` now expects a native `Event`, not a `ChartEvent`.  Add `@ts-ignore`; `getCanvasPosition` relied on some loose conversions between `Event`, `TouchEvent`, and `Touch` that would require several changes to make TypeScript happy.

* Code review feedback

Return the event directly, to speed up the code a bit.  Add JSDoc to help communicate its intent.  Update various comments.

* Finalize exports; add docs and TypeScript

* Update src/helpers/helpers.dom.js

* Update src/helpers/helpers.dom.js

Only thing needed actually is the update of chartjs-test-utils to 0.4.0

* Bump chartjs-test-utils dependency

To get supporting work from https://github.com/chartjs/chartjs-test-utils/pull/19

Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
2022-03-24 09:02:30 -04:00
Martin Steiger
ec6590027d
Add missing fields to the ScriptableContext type (#10254) 2022-03-24 08:42:46 -04:00
Evert Timberg
d3a9bf375c
Allow individual chart controllers to opt-in to the decimation plugin (#10182)
* Allow individual chart controllers to opt-in to the decimation plugin

* Code review feedback
2022-02-21 08:33:33 -05:00
Jacco van den Berg
16e6acc6b9
Allow array for line opts in dataset (#10179)
* fix line as array ts error

* added test

* implement only for the border,background color and radius
2022-02-20 21:31:42 -05:00
Talla2XLC
7c14ab74aa
Add new align 'inner' for X axis (#10106)
* Add new align for X axis

new align 'left-right' for options.scales['x'].ticks namespace will allow users to aling ticks: 'start" for first (left) tick and 'end' for last (right) tick

* corrected name of aligment to "inner", documentation and add test for inner labels

* delete unnecessary changes

* corrected logic for reverse axis, add tests for reverse axis and withoutY axis

* corrected chart paddings for "inner" tick align

* code clearness

* Update types/index.esm.d.ts

Co-authored-by: Jacco van den Berg <39033624+LeeLenaleee@users.noreply.github.com>

Co-authored-by: Talla2XLC <alexey.ivanov@epc.com.ru>
Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
Co-authored-by: Jacco van den Berg <39033624+LeeLenaleee@users.noreply.github.com>
2022-02-12 10:07:00 -05:00
Jérémy Morel
b1876a4b8a
Add missing mouse events to CoreChartOptions.events type (#10124)
* add missing mouse events to CoreChartOptions.events type

* allow all html event names in CoreChartOptions.events
2022-02-09 07:45:30 -05:00
Evert Timberg
cb81592989
Allow spanGaps to be specified on LineOptions (#10133) 2022-02-06 15:11:02 -05:00
Evert Timberg
c869972b60
Ensure that min/max of TimeScaleOptions can be a string (#10137) 2022-02-06 13:53:03 -05:00
Andy
aebbb5afff
fix: allow colors as array (#10075)
* fix: allow colors as array

* Revert "fix: allow colors as array"

This reverts commit 632e2ee917.

* fix: allow colors as array

* Update types/index.esm.d.ts

Co-authored-by: Jacco van den Berg <39033624+LeeLenaleee@users.noreply.github.com>

Co-authored-by: Jacco van den Berg <39033624+LeeLenaleee@users.noreply.github.com>
2022-02-05 19:51:01 +02:00
Evert Timberg
2995775f68
Correct type for updateHoverStyle (#10131)
* Correct type for updateHoverStyle
* Lint fixes
2022-02-05 09:26:31 -05:00
Evert Timberg
49dc77ec0b
Type Chart.legend property (#10130) 2022-02-05 09:13:05 -05:00
Jacco van den Berg
cc807b22d3
add SubTitle to ts test register (#10117) 2022-01-31 12:15:33 -05:00
Jacco van den Berg
6283c6f15b
Change repeating alingment string to single type (#10111)
* Change repeating alignment to single type for ease of maintenance
* improved naming
2022-01-29 11:46:37 -05:00
Dimitri Papadopoulos Orfanos
a7d98fb1a0
Fix typos found by codespell (#10103) 2022-01-27 09:24:55 -05:00
Jacco van den Berg
ec67123df8
move scriptable or array to helper function (#10078) 2022-01-16 17:06:56 -05:00
Jacco van den Berg
4d918f5afa
add typing and docs for maxTicksLimit all scales (#10057)
* add typing and docs for maxTicksLimit time scale

* change maxTicksLimit to base  instead of each scale seperatly since its done in the core.scale
2022-01-11 15:57:35 -05:00
Jukka Kurkela
a5b46a859c
Bump version to 3.7.0, update deps (#10011)
* Bump version to 3.7.0, update deps

* Fix issues from updated packages
2021-12-23 20:55:39 +02:00
t-mangoe
961533c115
Add centerPointLabels option for linear radial scale (#9949)
* center point labels to slices in polar chart

* remove unnecessary comments

* put the code together in one line

* fix the code according to the code review

* Undo changes related to the createContext function

* add documentation and types.
2021-12-21 20:27:07 +02:00
Jacco van den Berg
30bebefc40
Types/ type suggestedMin and suggestedMax for time scale (#9986)
* type suggestedMin and suggestedMax for time scale

* implement feedback
2021-12-14 13:41:47 -05:00