Commit Graph

251 Commits

Author SHA1 Message Date
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
Jacco van den Berg
0a5c058d7a
Types/Allow min-max as string timescale (#9985)
* allow for string in time scale min max config

* add min-max type to docs

* typo
2021-12-14 11:50:37 -05: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
Josh Kelley
d83f0467da
Improvements to tooltip positioners (#9944)
* Improve positioner types; allow overriding xAlign and yAlign

* More type improvements; pass in Chart as third parameter

* Expose chart as part of TooltipModel

I initially passed the Chart element as the third parameter to the positioner; however, Scale and LegendElement elements expose `this.chart`, and sample code for positioners used `this._chart`, so documenting the chart member and giving it a public name seems to make more sense.

* Update documentation

* Fix documentation

* Fix issues from code review
2021-12-06 07:39:06 -05: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
Jacco van den Berg
d1daf1ac08
allow for multiline labels in tick callback (#9937) 2021-12-05 08:57:44 -05:00
Luuk de Vlieger
7784fbfded
Support "r" axis for non-intersecting interaction (#9919)
* Support "r" axis for non-intersecting interaction

* Extract some interaction functionality

* Remove whitespace and semicolons

* WIP: add interaction test

* Update documentation

* Fix test

* Add another test

* Update axis params

* Add additional axis check to binary search

* Update axis type
2021-12-05 08:57:07 -05:00
Jacco van den Berg
6d3a1c5fa6
Feature/active elements on top (#9920)
* add flag to draw active items on top

* add documentation and types

* remove redundent check

* added test

* resolve linting errors

* increase tollerance

* remove axes for better test, hope no tolerance needed
2021-12-05 08:56:53 -05:00
Jukka Kurkela
cd9d5289a4
Add borderJoinStyle option for arc elements (#9877)
* Add borderJoinStyle option for arc elements
* docs + types
* Consistently enumerate the possible choices
2021-12-05 08:56:37 -05:00
carsonalh
5e5339d01c
Update stale documentation for axis titles (#9683)
* Update stale documentation for axis titles (#9682)

Updated the documentation for the types on axis labels.

In the corresponding `index.esm.d.ts` file, put JSDoc descriptions for
the properties to match the now-updated documentation.

* Clean up axis title labels documentation (#9682)

Inserted extra information in the documentation for the type of the
padding, inserted missing full stops.

In the type file, added JSDoc for undocumented properties.

* Update docs/axes/labelling.md

* Update types/index.esm.d.ts

Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
2021-11-29 23:37:34 +02:00
Evert Timberg
67aa6eb985
Add a note about the type parameters of the ChartData type (#9917) 2021-11-28 13:01:14 -05:00
Evert Timberg
f8992a6168
Doughnut chart options have an offset property (#9916) 2021-11-28 13:01:00 -05:00
Jacco van den Berg
6c63f7a01b
Types: add autopadding to typing (#9858)
* add autopadding to types

* fix failing test
2021-11-15 23:23:51 +02:00
Jukka Kurkela
e43730eb4d
Fix incomplete TS type for Chart.register + others (#9855) 2021-11-15 12:56:56 -05:00
Jukka Kurkela
2988a6c6dc
Fix type linting and indent errors (#9843)
* Fix type linting and indent errors
* Properly indent comments too
2021-11-11 15:00:52 -05:00
NorthBlue333
7da77a560e
update animation event to include currentStep instead of currentState (#9837) 2021-11-11 18:54:17 +02:00
Jacco van den Berg
359d171683
update animation event to include inital variable (#9834) 2021-11-11 07:20:48 +02:00
Jukka Kurkela
1749e57918
Remove scriptability from defaults.font types (#9794)
* Remove scriptability from defaults.font types

* Remove failing test
2021-10-29 07:32:12 -04:00
Jacco van den Berg
10106e4ec6
Fix object notation border width barchart (#9800)
* make object available for bar as border Radius

* override only the bar borderWidth prop

* spacing
2021-10-26 08:50:07 -04:00