Commit Graph

1056 Commits

Author SHA1 Message Date
Jukka Kurkela
9ba4480974
Resolve plugin defaults for local plugins (#10484) 2022-07-24 17:56:48 +03:00
Jacco van den Berg
1a1e68380f
Improve error message with id of the canvas (#10495)
* improve error message with id of the canvas
* update test
2022-07-20 12:51:34 -04:00
Jukka Kurkela
7a13906114
Fix options update when changing to shared opts (#10451) 2022-06-29 16:44:51 +03:00
Jukka Kurkela
e3b2b52790
Fix crash with skipNull and uneven datasets (#10454) 2022-06-29 07:46:48 -04:00
Jacco van den Berg
954ed953a5
Respect fill: false with custom draw times (#10414)
* Resolve canvasgradient is not defined in node
* Remove trailing white space
* export isPaternOrGradient helper with typings
* fix lint failure, single qoute
* Respect `fill: false` with custom draw times
* correctly listen to fill property
* remove console log and lint errors
* implement feedback, still update control points
2022-06-22 07:41:18 -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
1422c93dc0
Update scale polarArea correctly on data hide (#10340)
* give correct range back for polarArea
* added test
* tab to spaces
2022-05-22 09:50:32 -04:00
t-mangoe
d573dfb63e
display tooltips only at points in chart area (#10289)
* show only points in chart area

* use the _isPointInArea helper function
2022-05-07 10:43:47 -04:00
luke-heberling
a9765042f1
Use abs() when comparing for spanGaps (#10316)
* Use abs() when comparing for spanGaps

* tests for spanGaps w/ integer (boolean already covered)

* remove redundant default config from spanGaps tests
2022-05-01 14:28:41 -04:00
Evert Timberg
54dcd6a6d3
Trigger legend onLeave when the mouse leaves the canvas (#10301) 2022-04-15 19:36:42 -04:00
Evert Timberg
5c3dc932b6
Enable configuration of radial scale point label border radius (#10293) 2022-04-15 18:31:09 -04:00
Evert Timberg
a39f694184
Allow time scale to offset using skipped ticks (#10278) 2022-04-03 16:05:43 -04:00
Evert Timberg
43889f247c
Document tooltip draw hooks and only call hooks when the tooltip draws (#10276)
* Document tooltip draw hooks and only call hooks when the tooltip draws

* Update tests
2022-04-03 10:09:46 -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
Evert Timberg
edd764fcb5
minimum bar length setting keeps bar base in view (#10157) 2022-02-13 15:27:46 -05:00
Jacco van den Berg
ed68557a99
Make object notation usable for polarArea and radar (#10088)
* start to make object notation usable for polarArea
* enable object notation also for radar chart, test default key
2022-02-12 10:23:31 -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
Dimitri Papadopoulos Orfanos
a7d98fb1a0
Fix typos found by codespell (#10103) 2022-01-27 09:24:55 -05:00
Charles Masson
c527f47a89
Fix using above/below filling option with discontinuous lines (#10024)
Added a test in the boundary folder
2022-01-01 23:42:45 +02:00
Jukka Kurkela
1da9fdd519
radialLinear: fix positioning & scaling (#10021)
* radialLinear: fix positioning & scaling

* bloody pixels

* better radar fixtures
2021-12-23 20:47:36 +02:00
Jacco van den Berg
d24fe14e71
radialLinear: fix getIndexAngle when there are no labels (left) (#10020)
* Resolve animation if indexAngle is NaN

* make it private

* add test

* use chart.js helper instead of own logic

* implement feedback

* remove extra line

* my precious bits
2021-12-23 09:48:21 +02:00
Jukka Kurkela
f1c99316a7
radialLinear: Hide pointLabels of hidden data (#10018)
* radialLinear: Hide pointLabels of hidden data

* filter after map
2021-12-22 23:09:54 +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
Jukka Kurkela
0d250a1fbf
Fix setActiveElements behavior after a mouse event (#9992)
* Fix setActiveElements behavior after a mouse event

* Better variable name
2021-12-17 00:34:53 +02:00
Jukka Kurkela
5bea389c42
Add random seed reporting to test runs (#9977) 2021-12-09 21:15:50 +02: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
Jukka Kurkela
d2d5f49953
Pass object from array as value to _fallback (#9969)
* Pass object from array as value to _fallback

* cleanup

* reduce changes

* reduce even more changes
2021-12-08 16:27:55 +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
Josh Kelley
957ca837d5
Specify UTC time zone for the test suite (#9945)
The controller.bar/not-grouped/on-time test was failing on my computer because the date ranges happen to cross the end of Daylight Saving Time in the U.S., so chart was generated with one more hour of time than the test fixture expected.

Using moment-timezone to specify a fixed time zone with no DST seemed like the most robust fix. (Alternatively, I could pick a date range that doesn't change DST; that ought to work.)
2021-12-06 07:38:39 -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
Jukka Kurkela
db995af158
Fix resolver caching issue when setting values (#9938) 2021-12-01 17:53:55 -05:00
Jukka Kurkela
f10fab6591
Fix tooltip caret position when it is positioned at the corners (#9922)
* Fix tooltip caret position when  at the corners

* Add test

Co-authored-by: Dirk Gausmann <di.gaus@gmx.de>
2021-11-30 00:02:00 +02:00
Jukka Kurkela
93452501d1
Category: Track automatically added labels (#9921)
* Category: Track automatically added labels

* Use correct yAxisKey (does not change anything)
2021-11-29 23:38:11 +02:00
Evert Timberg
7cbc47becc
Chart area boxes receive 0 margin during the final layout process (#9915) 2021-11-28 10:25:27 -05:00
Jukka Kurkela
bccb1276f0
Detect detach/attach in same observation (#9876)
* Detect detach/attach in same observation

* Missing `!`, better tests

* reduce duplication
2021-11-27 21:46:00 +02:00
Jukka Kurkela
838d40b2c8
Synchronize data visibility with data changes (#9857)
* Synchronize data visibility with data changes

* avoid babel spread bug

* Simpler?

* one more

* simple enough, cc?
2021-11-18 00:13:31 +02:00
Jukka Kurkela
0c5db4973e
Fix inRange for full circle arc (#9871)
* Update misleading sample comment

* Fix inRange for full circle arc
2021-11-18 00:10:19 +02:00
Jukka Kurkela
0dc733a96c
Configure all datasets before updating any (#9872)
* Update misleading sample comment

* Configure all datasets before updating any
2021-11-18 00:09:25 +02:00
Jukka Kurkela
c8b885dd3e
Prevent proxying CanvasGradient in Node platform (#9861) 2021-11-15 20:09:43 -05:00
Josh Kelley
aac0bef060
Fix cleaning up metasets (#9656)
* Fix cleaning up metasets

I believe it's a mistake to only delete the metaset if it has a valid controller; see f191f2f5 for where this behavior was introduced.

This is a minimal fix for #9653; as discussed there, it may also be worth updating `updateHoverStyle`.

As of #7030, `this._metasets` should always be defined, so checking whether it's undefined is no longer necessary.

* Add a test covering metaset behavior

* Add a regression test for #9653; fix `toHaveSize` usage

* Fix test failure
2021-10-23 18:46:33 +03:00
Jukka Kurkela
18fc9760e1
Fix stacked fill with lines over multiple scales (#9767) 2021-10-15 08:00:14 -04:00
Jukka Kurkela
81acad9f2b
Bubble: Properly parse radius for non-object data (#9764) 2021-10-15 07:57:39 -04:00
Jukka Kurkela
0dcf025ab7
Support nested scriptable defaults for datasets (#9770) 2021-10-14 08:35:51 -04:00
Jukka Kurkela
9a47395010
Fix controller.getMinMax for stacked charts (#9766) 2021-10-14 00:24:38 +03:00
Jukka Kurkela
12c5f9a839
Support nested scriptable options for datasets (#9758)
* Support nested scriptable options for datasets
2021-10-13 08:41:22 -04:00
Jukka Kurkela
bc5e5cbf11
Disable animations for BasicPlatform (offcreen) (#9751)
* Disable animations for BasicPlatform (offcreen)
* Update types
2021-10-11 14:37:25 -04:00
Jukka Kurkela
10292c6912
Linear: determine grace amount from range (#9719) 2021-10-04 17:43:04 -04:00
Jukka Kurkela
e1ae5e6abf
Add layout.autoPadding option (#9716) 2021-10-04 14:01:10 -04:00