Commit Graph

47 Commits

Author SHA1 Message Date
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
Evert Timberg
8438da9e84
Provide method to lookup a chart from a canvas (#7843)
* Provide method to lookup a chart from a canvas
* Throw an error during construction if a canvas is in use
* Migration docs for new constructor behaviour
2020-10-04 11:08:38 -04:00
Jukka Kurkela
d5eaa12d96
Fix: update chart when attached (#7758) 2020-09-04 16:47:36 -04:00
Jukka Kurkela
6bd5ad5518
Generic registry for controllers, scales, elements and plugins (#7435)
* Generic registry for controllers, scales, elements and plugins
* Remove references to scale service
2020-07-06 17:38:04 -04:00
Evert Timberg
3ec3ac716f
Cleanup Event Handling code to match style of tooltip plugin. (#7467)
* Cleanup Event Handling code to match style of tooltip plugin.

Eliminates saving two arrays of items on the chart prototype. The `onHover`
callback now receives the wrapped event instead of the native one.
2020-06-08 07:31:00 -04:00
Yiwen Wang
94763bff35
Fix chart resizing issue (#7297) (#7298)
Fix chart resizing issue
2020-05-25 16:54:55 -04:00
Jukka Kurkela
5a83a80811
Move font* to font.* (#7383) 2020-05-21 17:07:06 -04:00
Jukka Kurkela
a3dddb45d9
Use global element hidden status for Pie charts (#7156)
Use global element hidden status for Pie / polarArea charts
2020-03-01 09:07:39 -05:00
Jukka Kurkela
bfe34214ac
Use ResizeObserver and MutationObserver to detect detach/attach/resize (#7104)
* Use Resize/MutationObserver to detect detach/attach/resize
* Cleanup
* Review update
* Restore infinite resize detection (#6011)
2020-02-17 11:00:03 -05:00
Jukka Kurkela
b05699eec5 Clean up after test (#6976)
* Clean up
* Make sure the event is inside chart are
2020-01-21 15:43:41 -05:00
Jukka Kurkela
767ffc05ce Resize on zoom (#6974)
* Resize on zoom
* Add test
2020-01-17 19:07:28 -05:00
Jukka Kurkela
a1c2dd6fb6 Throttle all events (to 1 / frame each) (#6953)
* Throttle all events
* Asynchronize event tests
2020-01-14 07:34:08 -05:00
Jukka Kurkela
16b1fb11b4 waitForResize before resizing (#6954)
* waitForResize before resizing
* Change the failing test
* Change the other leaking test too
2020-01-13 19:35:44 -05:00
Jukka Kurkela
f1677b6652 Limit interactions to chartArea (+/-0.5px) (#6943)
Limit interactions to chartArea (+/-0.5px)
2020-01-11 18:10:32 -05:00
Evert Timberg
9cb65d2c97
Add API to change data visibility (#6907) 2020-01-06 17:16:00 -05:00
Jukka Kurkela
f4792306e0 Remove global from defaults (#6893) 2020-01-03 14:07:38 -05:00
Jukka Kurkela
0b68786c04 Resync metasets array when indices change. (#6864)
* Resync metasets array when indices change.
* Make sure _metasets is initialized
2019-12-28 09:49:34 -05:00
Jukka Kurkela
b83f64b16e Rewrite animation logic (#6845)
* Rewrite animation logic

* Review update 1

* Review update 2

* Review update 3

* Add 'none' to api.md
2019-12-27 17:13:24 -05:00
Jukka Kurkela
ce74eb76a1 Convert axis options from arrays to objects (#6773)
* Convert axis options from arrays to objects

* Updated all chart type defaults
* Throw errors when axis type or position are not specified
* Avoid raising unnecessary errors when merging options into the default configs

* Fix additional tests

* Ensure scale defaults are set if type is not explicitly defined

* Another step

* Include `scale` as `firstIDs.r`

* update docs

* Update for buildOrUpdateScales

* Update migration guide

* Add test back
2019-11-21 18:46:49 -05:00
Jukka Kurkela
7f97adf5a0 Move scale defining options up from ticks (#6738)
* Move scale defining options up from `ticks`
* Include `ticks.reverse` in v3-migration
2019-11-15 12:11:13 -05:00
Ben McCann
a3392e0e59 Remove index and datasetIndex from Element (#6688)
Remove `index` and `datasetIndex` properties from elements.
2019-11-10 07:52:12 -05:00
Ben McCann
eef153de40 Upgrade dependencies (#6662) 2019-10-31 18:03:00 -04:00
RatherLogical
50fd869334 Update tooltip content and styling on update() (#6635)
Update tooltip content and styling on update()
2019-10-29 06:39:07 -04:00
Jukka Kurkela
0228776e66 Remove deprecated interaction modes (#6625)
* Remove deprecated interaction modes
* Use default modes
2019-10-28 18:11:38 -04:00
Akihiko Kusanagi
bf094c59db
Assign unique scale IDs (#6291) 2019-06-09 15:45:12 +08:00
Ben McCann
d6a5ea0d36 Implement per-dataset type (default and per-chart) options (#5999) 2019-05-06 22:52:40 +02:00
Jukka Kurkela
58e154c7da Avoid time related deprecation warnings in tests (#6246) 2019-05-06 22:46:22 +02:00
Janelle deMent
b9290a20de Make line options scriptable (#6128) 2019-03-21 09:06:39 +01:00
Jukka Kurkela
5fc934eae1 Fix responsive resize on rtl page (#6063) 2019-02-13 17:08:38 +01:00
Simon Brunel
0697d0de90
Deprecate configMerge and scaleMerge helpers (#6022)
These methods shouldn't have been public since they are specific to the chart controller internal logic. Note that this scale custom merging will be removed in v3.
2019-01-29 17:52:21 +01:00
serhii-yakymuk
c51ac8a64a Make animation duration consistent across browsers (#5331) 2019-01-02 16:13:56 +01:00
Akihiko Kusanagi
d29ec5a485 Add scale.pointLabels.lineHeight and scale.ticks.lineHeight options (#5914) 2018-12-20 09:56:06 +01:00
Simon Brunel
75aa44eef6
Upgrade dev dependencies to reduce vulnerabilities (#5840) 2018-11-18 09:33:34 +01:00
Xingan Wang
333f2eba99 Fix scale options update (#4198)
- allow options to be updated in-place or as a new object
- re-merge new options and rebuild scales & tooltips
- preserve reference to old scale if id/type not changed
- related tests and new sample also added.
- update document about options update
- update doc and example
2017-11-29 22:52:23 +01:00
jcopperfield
e080e782ab Fix bumpy line on smooth data set (#4944)
Linear scale getPixelForValue() method doesn't round the returned value anymore.
2017-11-14 13:56:45 +01:00
Evert Timberg
13e9676625 Reset tooltip when calling Chart.update (#4840) 2017-10-28 10:20:34 +02:00
JewelsJLF
8ac0257f8d Add "beforeTooltipDraw" and "afterTooltipDraw" plugin hooks (#4793) 2017-10-14 23:29:35 +02:00
Simon Brunel
3fe198c860 Fix responsive issue when the chart is recreated (#4774)
Chrome specific issue that happens when destroying a chart and re-creating it immediately (same animation frame?). The CSS animation used to detect when the canvas become visible is not re-evaluated, breaking responsiveness. Accessing the `offsetParent` property will force a reflow and re-evaluate the CSS animation.
2017-10-07 17:43:09 +02:00
Ben McCann
2922dc96cf Allow updating dataset types (#4586) 2017-08-02 07:29:34 +02:00
Simon Brunel
2c52209ba7 Replace the IFRAME resizer by DIVs (#4596)
Resize detection is now based on scroll events from two divs nested under a main one. Implementation inspired from https://github.com/marcj/css-element-queries.
2017-08-02 07:25:55 +02:00
Simon Brunel
f90ee8c786 Add support for detached canvas element (#4591)
Allow to create a chart on a canvas not yet attached to the DOM (detection based on CSS animations described in https://davidwalsh.name/detect-node-insertion). The resize element (IFRAME) is added only when the canvas receives a parent or when `style.display` changes from `none`. This change also allows to re-parent the canvas under a different node (the resizer element following). This is a preliminary work for the DIV based resizer.
2017-08-01 14:28:45 +02:00
Simon Brunel
c6bda02468 Rewrite unit test waitForResize helper (#4566)
The original implementation tries to intercept events from the chart internal iframe, which ones failing on Chrome 60. Checking internals doesn't seem the best approach, instead we could consider that a chart has been resized after the resize method has been called and processed. So let's hook `Chart.resize` and callback once it's done.
2017-07-26 13:33:45 +02:00
Simon Brunel
4c763bff44 Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.

http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops
2017-07-22 14:13:09 +02:00
Ricardo Costa
009ae4dec6 Support hover animation duration during updates (#4300)
See discussion in the issue for context and possible approaches.

When invoking update() inside an event handler, such as onHover,
`options.hover.animationDuration` was not being respected. Given that
some use cases may require additional animation properties for the
manual update call, this commit changes that method signature to accept
a configuration object.

This object provides backwards compatibility with duration and lazy
properties, and also introduces the easing property so that the event
animation is different from the global one. 

Add tests that guarantee that when update is called manually with
arguments, it properly builds the _bufferedRequest or calls render with
the proper arguments.
It includes test cases for when update is called with legacy arguments
(duration and lazy) instead of the config object.

.update() documentation was previously updated but .render() was left
out. Since the backwards compatible change was also made to render(),
this commit adds documentation for it.
2017-06-11 12:06:39 -04:00
OlduwanSteve
8eee12486d Added 'devicePixelRatio' option to override the window's DPR setting (#4270) 2017-06-04 18:57:55 +02:00
etimberg
06383669be Adds a better error message when the chart type is incorrect. Previously the user got a message about type being undefined.
This gives something that's easier to understand and debug.
2017-04-03 17:39:09 -04:00
Simon Brunel
c216c0af76 Cleanup and upgrade unit tests environment
`karma.conf.ci.js` has been merged into `karma.conf.js` for local testing consistency: `gulp unittestWatch` has been replaced by `gulp unittest --watch` and thus use exactly the same config file. Upgrade to latest jasmine and karma packages and remove deprecated `gulp-karma` dependency (directly use `karma.Server` in gulp).

Split `test/mockContext.js` into smaller `test/jasmine.*` modules to make easier unit tests maintenance and finally, move all `*.test.js` files under the `test/specs` folder.
2017-03-04 11:39:48 -05:00