Commit Graph

82 Commits

Author SHA1 Message Date
Jacco van den Berg
3dac05ed00 Return false from the average tooltip positioner on no valid data (#11863) 2024-08-17 08:52:36 +02:00
Hyun-je Alex Moon
dff44828db fix(#11615): fix calculating caretX position on stacked bar with index interaction. (#11616) 2023-12-27 07:18:14 +01:00
Josh Kelley
429d99dbc2 Tooltip fixes (getLabelAndValue on null controller, null getParsed) (#11596)
* Fix for getLabelAndValue on null controller

I encountered #11315 under the following circumstances:

1. Position the cursor over the chart area, such that it causes a
   tooltip to be shown.
2. Move the cursor out of the chart area, such that the tooltip remains
   visible.
3. Cause the chart contents to be changed, such that the dataset
   referenced by the active tooltip element is no longer valid.
4. Move the mouse again.  This triggers an `inChartArea = false` event,
   so it reuses the previous, now invalid, active elements.

This fixes #11315 under the circumstances for which I've reproduced it,
but there may be others.

* Further fixes for elements added / changed

This possibly fixes #11365.
2023-11-29 14:51:56 -05:00
leo2436
6cf9de9681 Change labelColors to labelColor in tooltip drawColorBox method. (#11135)
Co-authored-by: Leo Chen <liang.chen@thoughtworks.com>
2023-02-12 14:15:07 -05:00
Shahab HM
2481547ef8 fix RTL tooltip colorBox placement (#11061)
* fix RTL tooltip colorBox placement #10771

* fix lint problem
2023-02-10 07:57:24 -05:00
Dan Onoshko
64a027874c fix: move types to src dir to escape src / dist dirs in paths (#10993) 2022-12-16 07:56:06 -05:00
Dan Onoshko
51441272a7 refactor: move to esm in sources (#10879) 2022-11-17 08:08:44 -05:00
Jacco van den Berg
3c33d87dd2 Remove tooltip constructor fallbacks, this.chart and this._chart (#10612)
* remove tooltip fallbacks/backwards compatability in constructor

* increase size limit
2022-08-22 21:17:40 +02: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
Dan Onoshko
ffce0f9f18 feat: tooltip callbacks fallback (#10567)
* feat: tooltip callbacks fallback

* docs: review fixes
2022-08-18 09:03:12 +03: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
Jacco van den Berg
8ccff8cad7 draw tooltip with object borderwidth (#10489) 2022-07-20 19:25:47 +02: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
Dimitri Papadopoulos Orfanos
a7d98fb1a0 Fix typos found by codespell (#10103) 2022-01-27 09:24:55 -05: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
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
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
6a250de81d Add chart, p0.raw, p1.raw to segment context (#9761)
* Add chart, p0.raw, p1.raw to segment context

* Types
2021-10-15 15:56:29 -04:00
Evert Timberg
8e68481ec4 Remove const me = this pattern (#9646) 2021-09-14 07:37:22 -04:00
Evert Timberg
f5c9a656ef Configurable tooltip box padding (#9625) 2021-09-06 09:13:21 -04:00
Evert Timberg
0cdadd2560 Enable per-corner border radius in tooltip (#9620) 2021-09-05 13:07:28 -04:00
Evert Timberg
cc4ce7adef Do not redraw endlessly on mouse move (#8898)
* Do not redraw endlessly on mouse move

The tooltip incorrectly determined that the position changed leading to many redraws

* Code review feedback
2021-04-15 16:36:03 -04:00
Jukka Kurkela
f8885ce7a2 Font validate style, move defaults to weight (#8877) 2021-04-10 15:58:11 -04:00
Evert Timberg
7ee498e412 Tooltip colorbox supports configurable borderWidth, borderRadius, and dash effect (#8874)
* Start on extending tooltip style
* Correct borderRadius implementation
* Tests of updated tooltip styling
* Update docs
2021-04-10 13:37:22 -04:00
Jukka Kurkela
b2c7baf10d Avoid recursive event replay loops (#8738)
* chart._lastEvent = null while processing onHover

* Pass replay flag to external tooltip

* Add test for replay

* cc
2021-03-27 06:11:51 -04:00
Jukka Kurkela
f10b510890 Fix tooltip padding (#8666) 2021-03-18 07:27:37 -04:00
Jukka Kurkela
a6b3b99675 Fix tooltip positioning issues (#8646)
* Fix tooltip positioning issues

* Update fixture, add npm run dev:ff

* Refactor determineXAlign

* Simplify more

* remove unneeded change
2021-03-16 08:06:05 -04:00
Jukka Kurkela
4d173c6b8a Allow tooltip callback override in dataset (#8640) 2021-03-14 11:29:54 -04:00
Evert Timberg
96f6b42c57 Use font lineHeight for tooltip alignment (#8631)
* Use font lineHeight for tooltip alignment
* Remove toFontString usage from tooltip
2021-03-13 15:14:48 -05:00
Evert Timberg
91628c1449 Tooltip specific scriptable context (#8561)
* Update plugin to use it's own tooltip context

* Scriptable tooltip option types

* Tests

* Update types to use UnionToIntersection

* Update TooltipItem to use UnionToIntersection
2021-03-04 08:25:24 -05:00
Jacco van den Berg
9741942976 rename tooltip.custom property to tooltip.external (#8523)
* rename tooltip.custom property to tooltip.external

* Implement feedback

* missed 1
2021-02-27 18:18:12 +02:00
Evert Timberg
8c4e862a2c Merge tooltip padding settings (#8493) 2021-02-22 08:30:25 +02:00
Jukka Kurkela
5d5e48d01b Isolate properties / modes from animation options (#8332)
* Isolate properties / modes from animation options
* tabs, something wrong with the linter
* Update misleading variable name
2021-02-20 09:02:22 -05:00
Jukka Kurkela
aa5e0fe413 Remove core plugin fallbacks to root options (#8462)
* Remove core plugin fallbacks to root options
* Legend font color default fallbacks
2021-02-19 17:53:01 -05:00
Jukka Kurkela
cfd9c98575 Option resolution with proxies (#8374)
* Option resolution with proxies

* Remove plugin fallback to root options/defaults

* Update core plugins, reduntant font fallbacks

* Add some notes
2021-02-15 14:42:32 -05:00
Jukka Kurkela
ddfbcf777a Update eslint-config-chartjs to v0.3.0 (#8406) 2021-02-10 08:21:39 -05:00
Ben McCann
eb7ce4e5a0 Add raw data to context and rename dataPoint to parsed (#8318)
* Make the raw data point available in scriptable context
* Rename variables
* Update samples
2021-02-05 09:13:32 -05:00
Jukka Kurkela
610461d714 Use provided options in tooltip plugin (#8254) 2020-12-31 08:46:23 +02:00
Jukka Kurkela
d00ffdcd76 Tooltip: Render when animations are disabled (#8252) 2020-12-30 08:33:30 -05:00
Jukka Kurkela
61aea761f4 Unify signature of plugin hooks (#8102) 2020-11-28 09:45:43 +02:00
Jukka Kurkela
913a01a3a6 Move title, tooltip and legend to options.plugins (#8089)
* Move title, tooltip and legend to options.plugins

* Update tooltip.md

* Update legend.md and title.md

* Add migration notes

* typo

* Types

* Restore plurals

* One more s, restore tabs

* All plugins disabled

* lint

* cc
2020-11-25 08:50:12 +02:00
Jukka Kurkela
ddc72fcfbb Align font options with CSS (#8066)
* Align font options with CSS

* Review comments
2020-11-19 20:59:24 +02:00
LeeLenaleee
c3e861d78c dataset tooltip now shows correctly (#8024)
* dataset tooltip now shows correctly

* removed optional chaining
2020-11-08 15:41:52 -05:00
Evert Timberg
17f6edb650 Remove I prefix from TS types (#8017)
* Remove I prefix from TS types
* Update missing `ILayoutItem` typedefs
* IEvent should become ChartEvent
* Prevent FillTarget collision
* Import FontSpec instead of IFontSpec
* Prevent recursive DateAdapter problem
2020-11-07 08:35:19 -05:00
Jukka Kurkela
61d2227985 Tooltip: clear cached animations on initialize (#7983) 2020-10-30 18:43:46 -04:00
Dan Manastireanu
6869a41d40 feat: Draw tooltips with point styles. Closes #7774 (#7972)
* feat: Draw tooltips with point styles. Closes #7774

* chore: Add tooltip usePointStyle docs

* chore: Add tests and visual tests for tooltip usePointStyle

* chore: Update typescript with tooltip usePointStyle
2020-10-29 22:55:40 +02:00
Jukka Kurkela
f5c4f97504 Add interaction options (#7922)
* Add interaction options
* Add migration note
2020-10-19 07:24:06 -04:00