Commit Graph

68 Commits

Author SHA1 Message Date
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
Jukka Kurkela
73b4e82fd5 Use Object.create(null) as merge target, to prevent prototype pollution (#7917)
Use Object.create(null) as merge target to prevent polluting `Object.prototype`
2020-10-18 13:31:01 -04:00
Evert Timberg
c68ec57672 Reduce tooltip implied padding at top and bottom edges of the canvas (#7908)
* Allow the tooltip to get closer to the canvas edge

Closer to the top & bottom by considering (height/2) instead of height.

* Update missing options in TS types

* Remove unneeded brackets
2020-10-18 16:51:48 +03:00
Evert Timberg
a8a83d12cd Provide APIs to set active (hovered) and tooltip elements. (#7845)
Provide APIs to set active (hovered) and tooltip elements.

Chart.setActiveElements will set the hovered items.
Chart.tooltip.setActiveElements will set the tooltip items.
2020-10-05 17:14:38 -04:00
Jukka Kurkela
e756fb93a3 Resolve fonts through options.font (#7674)
* Resolve fonts through options.font
* Remove defaultRoutes from Tooltip fonts
2020-08-03 12:32:58 -04:00
Jukka Kurkela
af855d7646 Fix remaining issues in samples (#7625)
* Fix remaining issues in samples
* Update migration guide
* Use element instead
* Update tooltip.md
2020-07-16 13:28:12 -04:00
Ben McCann
426d8debba Tooltip: add dataPoint and rename value to formattedValue (#7618)
* Tooltip: add dataPoint and rename value to formattedValue
* Add a test
2020-07-14 17:40:32 -04:00
Ben McCann
30e197742d Align the tooltip callbacks parameters with scriptable options (#7603)
Align the tooltip callbacks parameters with scriptable options
2020-07-12 18:26:13 -04:00
Jukka Kurkela
7024aad38f PluginService using registry (#7590)
PluginService using registry
2020-07-11 18:08:45 -04:00
Ben McCann
6c38c31a0a Pass context parameter to custom tooltip (#7579) 2020-07-06 09:34:06 -04:00
Evert Timberg
ff29522f5f Fix tooltip caret border when caret is on right or bottom (#7565)
* Fix tooltip caret border when caret is on right or bottom
* Lint fixes

* Code review feedback
2020-06-29 07:55:09 -04:00
Ben McCann
2ca155cce1 Add parameters to tooltip filter option (#7556) 2020-06-29 07:51:20 -04:00
Evert Timberg
ba5c9e01c6 Update tooltip when the display position changes (#7469) 2020-06-25 13:51:34 -04:00
Jukka Kurkela
2e4d623bf3 Tooltip: Provide argument for custom callback (#7522) 2020-06-18 17:37:27 -04:00
Evert Timberg
e590a9792c Only draw the tooltip if it is defined (#7411) 2020-05-26 20:03:18 -04:00