* test: new test to reproduce issue #10951
* test: validate the canvas style too
* fix: Avoid reassigning the the chart size. For specific values of pixelRatio the assignment would cause the size to reduce by 1px. Since it's called from the ResizeObserver it will be stuck in a loop that constantly reduce the size of the chart and canvas.
* Revert "fix: Avoid reassigning the the chart size. For specific values of pixelRatio the assignment would cause the size to reduce by 1px. Since it's called from the ResizeObserver it will be stuck in a loop that constantly reduce the size of the chart and canvas."
This reverts commit ed7a34814d.
* fix: Avoid the resize loop by fixing the rounding error in the retinaScale function.
* fix: getMaximumSize was flooring non-integer height values unnecessarily.
* Revert "fix: Avoid the resize loop by fixing the rounding error in the retinaScale function."
This reverts commit 23525abc6a.
* fix: Avoid the resize loop by fixing the rounding error in the retinaScale function.
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>
* 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>
* 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
* 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
* 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>
* 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
* 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
* 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>
* Use abs() when comparing for spanGaps
* tests for spanGaps w/ integer (boolean already covered)
* remove redundant default config from spanGaps tests
* 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>
* 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.
* 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
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.)
* 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