Commit Graph

1092 Commits

Author SHA1 Message Date
Igor Lukanin
1c2f66a00e
Introduce Colors plugin (#10764)
Introduces a colors plugin that provides a color palette

Co-authored-by: Dan Onoshko <danon0404@gmail.com>
Co-authored-by: Jacco van den Berg <jaccoberg2281@gmail.com>
2022-10-21 08:21:08 -04:00
Jonatan
f5cb133551
fix: label text not centered when applied rotation (#10773)
* fix: label text not centered on tick when rotated

#10485

* fix: label text not centered on tick when rotated

#10485
2022-10-17 21:28:31 +03:00
cmcnulty
fbf3427ca2
Fix #10749 - backdrops with rotated labels (#10759)
* Fix #10749 - backdrops with rotated labels

* remove translation adjustment
Because backdrop now occurs after translation, we don't want to double-adjust the position.

* increase tolerance slightly due to anti-aliasing

Co-authored-by: Charles McNulty <charles.mcnulty@tasconline.com>
2022-10-12 07:08:22 -04:00
stockiNail
c51d697d7f
Use the correct area to clip for dataset drawing when stacked scales are used (#10691)
* Use the correct area to clip when stacked scales are used

* adds test cases

* fix CI issue

* apply review

* Update .size-limit.cjs

Co-authored-by: Jacco van den Berg <jaccoberg2281@gmail.com>

Co-authored-by: Jacco van den Berg <jaccoberg2281@gmail.com>
2022-10-01 21:26:45 +03:00
Dan Onoshko
52cf8e8a94
fix: aspect ratio calc (#10693) 2022-09-28 15:31:19 -04:00
Jacco van den Berg
5f37ba6fc4
Add warning if filler plugin is used but not registered (#10702)
* add warning if filler plugin is used but not registered

* fix lint

* increase size limit

* add test, only put warning in dataset controller

* fix register in docs, remove commented code

* remove other mr

* add documentation

* Apply suggestions from code review

Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>

* Also return false if plugin is disabled by options

* improve warning message

* undo docs changes

* update test

Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
2022-09-26 20:20:54 +02:00
Dan Onoshko
22f32af1bc
fix: calc visible points on update (#10667) 2022-09-24 17:01:47 -04:00
Kartik
1253ceddb1
FIX: render multiline legend items without overlapping (#10532) (#10641)
* FIX: render multiline legend items without overlapping (#10532)

Co-authored-by: Nirav Chavda <nmchavda99@gmail.com>

* CLN: Extract method to fix codeclimate line count

Co-authored-by: Nirav Chavda <nmchavda99@gmail.com>

* CLN: Shift helper methods from class to module scope

Co-authored-by: Nirav Chavda <nmchavda99@gmail.com>

* TST: Add test with fixtures

Co-authored-by: kartik <codebull707@gmail.com>

* FIX: Fix test case for multiline label

Co-authored-by: kartik <codebull707@gmail.com>

* 10532-ENH: Calculate legend item width for multiline labels

Co-authored-by: Nirav Chavda <nmchavda99@gmail.com>

* 10532-TST: use spriteText and non-empty labels for test

Co-authored-by: Nirav Chavda <nmchavda99@gmail.com>

* 10532-FIX: failing test case due to legendItem.text being undefined

Co-authored-by: Nirav Chavda <nmchavda99@gmail.com>

* 10532-FIX: Update compression size

Co-authored-by: kartik <codebull707@gmail.com>

Co-authored-by: Nirav Chavda <nmchavda99@gmail.com>
2022-09-16 09:46:53 -04:00
stockiNail
d4e106cc9c
Provide an empty object when the target of the resolver is undefined (#10655)
* Provide an empty object when the target of the proxy is undefined

* changes check on subGetTarget function

* adds test case

* fixes lint
2022-09-15 12:12:35 -04:00
Dan Onoshko
47cb9e1f76
feat: typescript node next support (#10661) 2022-09-14 06:44:57 -04:00
Jacco van den Berg
cc65c2bac2
Fix autoskip logic (#10663)
* fix autoskip logic

* add test

* fix lint erro

* Update variable name
2022-09-13 19:33:22 +02:00
stockiNail
9871aaa262
Use ticks.steSize instead of time.stepSize on time and timeseries scales (#10653) 2022-09-10 18:46:26 +03:00
Dan Onoshko
0c51ecd451
fix: respect aspect ratio with container height (#10646)
* fix: respect aspect ratio with container height

* docs: add info into migration guide
2022-09-02 08:03:41 -04:00
Dan Onoshko
8ff853c60e
feat: remove default axis override when custom id is given (#10643)
* feat: remove default axis override when custom id is given

* docs: add info into migration guide

* test: fix tests for the feat

* docs: add info into migration guide

* test: fix tests for the feat

* feat: review fixes

* feat: review fixes
2022-09-02 07:52:48 +03:00
Dominic Jean
0edb2ac604
enable pointStyleWidth for all legend style (#10639) 2022-09-01 06:37:12 -04:00
Ben McCann
9258f250b6
Switch to pnpm (#10576) 2022-08-22 20:42:43 +02:00
Jukka Kurkela
3b76488373
Refine logarithmic scaling / tick generation (#9166)
* Refine logarithmic scaling / tick generation

* Disable autoSkip on reverese test

* Reduce ticks, fix min
2022-08-22 14:05:27 -04: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
49b16c9678
Change react integration test to TS (#10605)
* switch to ts

* change web integration test to TS

* remove space

* lint things

* one more lint

* Add spaces
2022-08-18 08:42:40 -04:00
Dan Onoshko
e7372ade24
fix: same-looking tooltips on charts (#10548)
* fix: same-looking tooltips on multiseries charts

* fix: same-looknig tooltips on all chart types

* chore: restore tooltip plugin

* docs: additions to migration guide

* docs: remove labels from scatter and bubble examples

* docs: review fix
2022-08-18 07:34:35 -04: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
Dan Onoshko
ffce0f9f18
feat: tooltip callbacks fallback (#10567)
* feat: tooltip callbacks fallback

* docs: review fixes
2022-08-18 09:03:12 +03:00
Jacco van den Berg
1551537a40
Add integration test(s) for Web (#10563)
Adds a basic react integration test
2022-08-07 13:25:11 -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
Dan Onoshko
b19fc0169f
fix: pass timestamp to ticks callback (#10540)
* fix: pass timestamp to ticks callback
* docs: edit labelling page
* docs: additions to the migration guide
2022-08-05 07:59:36 -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
Dan Onoshko
a4de430d99
fix: treeshaking (#10504)
* fix: treeshaking
* refactor: DatasetController.datasetElementType and DatasetController.dataElementType as static props
2022-08-04 09:17:40 -04:00
Ivan Gamboa Ultreras
9ab50e6313
Fix offset on doughnut charts (#10469)
Fix offset on doughnut charts
2022-08-03 20:27:17 +03:00
Jukka Kurkela
9224e57d93
Add integration test(s) for Node (#10554) 2022-08-03 09:17:05 -04:00
Jacco van den Berg
beaf370cc5
Bug/Radial linear scale grid get correct options at index (#10010)
* get correct options for index

* update test

* add initial migration guide
2022-08-03 02:32:02 +02:00
Slava Terekhov
03e9194be5
feat: remove line element from scatter controller (#10439)
* feat: remove line element from scatter controller default config

* feat: move common controllers methods to helpers and add types

* feat: mark methods for scatter and line conntrollers as private

* fix: fix error when showline is true at root options and add tests

* feat: remove else inside scatter controller update

* fix: update getStartAndCountOFVisiblePoints helper code
2022-08-01 22:39:09 +03: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
Dan Onoshko
e800b46ab9
fix: calc visible points on update #10467 (#10523) 2022-07-28 07:46:00 -04:00
Jukka Kurkela
a4114e84d9
parsing: support dot(s) in object keys (#10517) 2022-07-26 08:30:52 -04:00
stockiNail
144a6c0c27
Enable borderDash option in the grid as scriptable (#10519) 2022-07-26 08:28:15 -04:00
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