Commit Graph

224 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
stockiNail
57bbd8229d Fix mismatch between hit boxes and drawn items in legend plugin (#11352)
* Fix mismatch between hit boxes and drawn items in legend plugin

* fixes padding calculation
2023-06-20 18:20:12 +02: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
Johannes Kronmüller
207fe8f66e fix: decimation plugin data not writeable after clean (#11045) 2023-02-10 07:45:43 +02:00
stockiNail
ab55f6c976 Check colors definition in the chart options (#11003)
* Check colors definition in the chart options

* Update src/plugins/plugin.colors.ts

Co-authored-by: Dan Onoshko <danon0404@gmail.com>

* Update src/plugins/plugin.colors.ts

Co-authored-by: Dan Onoshko <danon0404@gmail.com>

* Update src/plugins/plugin.colors.ts

Co-authored-by: Dan Onoshko <danon0404@gmail.com>

* apply review

Co-authored-by: Dan Onoshko <danon0404@gmail.com>
2023-01-18 13:31:33 +01: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
Jacco van den Berg
41f8128c2b Allow dynamic datasets to be colored (#10964)
* Allow dynamic datasets to be colored

* revieuw
2022-12-14 21:43:41 +01:00
Jacco van den Berg
8239567802 Allow color plugin to work with custom dataset controllers (#10904) 2022-11-25 15:03:49 +01:00
Dan Onoshko
22f0dfe9a7 feat: colors for mixed charts (#10870) 2022-11-18 13:15:08 -05:00
Dan Onoshko
51441272a7 refactor: move to esm in sources (#10879) 2022-11-17 08:08:44 -05:00
Jacco van den Berg
53b79673eb Remove type attribute from dataset specific type specification (#10869) 2022-11-13 19:36:25 +02:00
stockiNail
b271b5098a Enable colors plugin for pie charts (#10851)
* Enable colors plugin for pie charts

* fixes CC
2022-11-04 11:17:49 -04:00
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
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
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
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
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
Dominic Jean
a31e1e59d6 pass boxWidth only if pointStyleWidth presents (#10524) 2022-07-29 16:40:28 +03:00
Jacco van den Berg
8ccff8cad7 draw tooltip with object borderwidth (#10489) 2022-07-20 19:25:47 +02:00
Dominic Jean
5452502b8c Add pointStyleWidth option for legend (#10412)
* add pointStyleWidth for legend

* add drawPointLegend to keep drawPoint signature
2022-07-18 06:49:08 -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
Evert Timberg
54dcd6a6d3 Trigger legend onLeave when the mouse leaves the canvas (#10301) 2022-04-15 19:36:42 -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
Jacco van den Berg
e9ce6ce60d resolve circulair import (#10247) 2022-03-18 17:39:55 -04:00
Evert Timberg
d3a9bf375c Allow individual chart controllers to opt-in to the decimation plugin (#10182)
* Allow individual chart controllers to opt-in to the decimation plugin

* Code review feedback
2022-02-21 08:33:33 -05:00
Jukka Kurkela
4b542682f3 Refactor filler plugin for easier maintenance (#10040) 2022-02-12 17:22:38 +02: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
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
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
Atharva Deshpande
30e66bc50e Fix: Typo 'is less' -> 'are lesser' (#9755)
* Fix: Typo 'is less' -> 'are lesser'

* Update plugin.decimation.js
2021-10-16 22:41:27 +03: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
Jukka Kurkela
18fc9760e1 Fix stacked fill with lines over multiple scales (#9767) 2021-10-15 08:00:14 -04:00
nikethan rai
7dabae9a86 Fix: Typo that-->than (#9708) 2021-10-02 17:02:38 -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
27b91b7458 Adjust legend hitboxes when RTL and each item has a different size (#9353)
* Adjust legend hitboxes when RTL and
each item has a different size

* Add test for RTL legend hitboxes
2021-07-10 18:36:46 -04:00
Jukka Kurkela
066130be4d Decimation: Prevent buffer overflow (#9367) 2021-07-07 17:45:31 -04:00
Jukka Kurkela
840599637f Add 'shape' mode for filler-plugin (#9360) 2021-07-05 17:03:19 -04:00