Commit Graph

2535 Commits

Author SHA1 Message Date
Simon Brunel
efced4780c Fix context state restoration on destroy
In many cases, the canvas render size is changed by the lib, causing the state stack to be discarded, meaning that we can't use save() and restore() to release the context with its initial state (i.e. before creating the chart). Since we don't need (want) to manually save / restore the context initial state, simply make sure to reset it to the default state to give a fresh context back to the user. That also means we don't need to revert the scale when the pixel device ratio is not 1.
2016-11-07 19:16:45 -05:00
Simon Brunel
040b0e160d Bump version to 2.4.0 2016-11-06 18:31:30 +01:00
etimberg
74d4dbc608 X and Y interaction modes now use the intersect option 2016-11-05 08:19:07 -04:00
Simon Brunel
a94885e32d Fix the event handler when legend is disabled (#3544)
When legend is disabled (i.e. {options: {legend: false}}), me.legend is null. Add the same test on me.tooltip even if the tooltip object is always created in case of {options: {tooltips: false}}.
2016-11-03 22:43:52 +01:00
Simon Brunel
5012dcbdae Fix iframe resize handler when re-attached to DOM (#3527)
When the iframe is attached to the DOM, its content is reloaded (invaliding the resize listener) so make sure to install the handler after the iframe is loaded. Optimize resize events by throttling resize process until the next animation frame. Rewrite the unit test "waitForResize" method, the previous one (timeout) was too weak and most tests was failing on FF.
2016-10-31 08:47:28 +01:00
etimberg
f288bc727b When an event triggers an update while the bufferedUpdate state is true, we need to do that render with priority over any other renders that take place for animations and tooltips 2016-10-30 16:58:40 -05:00
Simon Brunel
e90edd8c9a Bump ESLint to v3.x (gulp and Code Climate) (#3526) 2016-10-29 18:40:27 +02:00
Josh Soref
67934920be Spelling fixes (#3522)
Including: actually, aspect, bottom, changes, characters, datasets, divisible, downward, guidelines, instance, instances, interrupted, item, javascript, label, lifecycle, lines, plugins, manually, milliseconds, nearest, occurring, position, predefined, recalculate, tooltip, those
2016-10-27 21:18:31 +02:00
Varatep Buranintu
7c8998f96a fix "area" typo 2016-10-26 20:23:51 -05:00
bret b
295c9db1df Fixes issue #3490: Tick documentation is missing autoSkipPadding
Adding a single line to the docs to document autoSkipPadding.
2016-10-25 17:28:13 -05:00
Zach Panzarino
99041de31a Update installation instructions in README 2016-10-25 15:04:58 +00:00
Evert Timberg
80bd08bef9 Update chartColors.js to utils.js and move randomScalingFactor function there 2016-10-23 16:33:25 -05:00
etimberg
274aa290ca Fix bug in 'y' tooltip mode 2016-10-23 16:33:25 -05:00
etimberg
9ad9cd2154 Reorganized sample files into sub directories. Added a helper containing colours that should be used by all samples.
I added new samples to explain behaviour and modified all samples to have consistent styling. In updating the samples,
I removed the use of jQuery and instead use standard methods.

For the custom tooltip samples, I updated the styling to show color boxes like the regular tooltips.
2016-10-23 16:33:25 -05:00
etimberg
5ae268e942 Add a way to filter items in the tooltip 2016-10-23 16:33:08 -05:00
bydooweedoo
3bd4d283f7 Custom tooltip: add data points infos (#3201)
Expose tooltip items from tooltip model and added `x` and `y` properties to `TooltipItemInterface`
2016-10-19 08:48:17 -05:00
etimberg
a0388eff4c Add new properties for the caretX,caretY point of a tooltip. Useful for custom tooltips.
The custom tooltip sample was updated as well to use the new properties.
2016-10-19 06:30:41 -05:00
Zach Panzarino
a0ce74643f Fix eslint errors in layout service test 2016-10-18 22:00:55 +00:00
etimberg
596ff3718c Layout service now supports configurable padding on left, top, right and bottom.
Re-enabled the layout service tests and then properly disabled the tests that
fail on the CI.
2016-10-17 16:59:47 -05:00
etimberg
16f23b2c44 Add reset method to chart prototype 2016-10-17 06:40:29 -05:00
Zach Panzarino
766ca49cd0 Extend eslint to test files (#3473)
* Add eslint to test files

* Fix mockContext for tests

* Make formatting look better for nested objects
2016-10-16 17:34:59 -04:00
Simon Brunel
4a5b5a0e7e Enhance context acquisition on chart creation
Add support for creating a chart from the canvas id and prevent exceptions, at construction time, when the given item doesn't provide a valid CanvasRenderingContext2D or when the getContext API is not accessible (e.g. undefined by add-ons to prevent fingerprinting). New jasmine matcher to verify chart validity.
2016-10-16 08:25:13 -05:00
Evert Timberg
6ec6a929f0 Make index mode only work with the horizontal distance to an element (#3471)
Make index mode only work with the horizontal distance to an element if intersect is off
2016-10-15 16:49:35 -05:00
Evert Timberg
a86c47cf48 Configurable Tooltip Position Modes (#3453)
Adds new tooltip position option that allows configuring where a tooltip is displayed on the graph in relation to the elements that appear in it
2016-10-14 16:36:49 -05:00
etimberg
3365ba6d29 Bar chart performance improvements 2016-10-14 06:20:08 -05:00
Evert Timberg
f8e90b1c2d New fill modes for lines (#3460)
New fill modes for lines allowing the user to customize where the fill goes to
2016-10-14 06:19:47 -05:00
Simon Brunel
f481746fe1 Update the GitHub issue template 2016-10-11 07:42:26 -04:00
etimberg
0817199f45 No longer merge arrays during the config merge. Simply replace the property 2016-10-10 08:14:58 -04:00
Tieson Trowbridge
c61ab012c4 Replaces Unicode character with HTML entity 2016-10-09 12:34:35 -04:00
Evert Timberg
d21a853f30 Fix/3061 (#3446)
Solve weird animation issues with the tooltip. The optimization in Chart.Element.transition when the animation finishes to set `_view = _model` caused problems during update because we were using `helpers.extend` all over the place.

I changed to code so that we regenerate the model variable rather than continuously extending the old version. I also removed unnecessary tooltip reinitializations from the controller which should improve overall performance during interaction.
2016-10-09 12:26:59 -04:00
Evert Timberg
65a06e4735 Properly merge colors for the label colors in the tooltip. I added a private helper to simplify the code in the tooltip 2016-10-08 07:28:45 -04:00
Evert Timberg
4d2772e313 Fix bubble chart tooltip callback to use correct labels (#3421)
Fix bubble chart tooltip callback to use correct label parsed from scales. Fixes #3029
2016-10-06 08:54:50 -04:00
Mickael Jeanroy
b64cab0046 Refactor tooltip draw function to extract drawBackground method
See issue #3416.
2016-10-04 14:10:56 -04:00
Aidan Fewster
365bdbb346 If tick options have min, max and stepSize use them to generate evenly spaced ticks 2016-10-04 09:30:28 -04:00
Aidan Fewster
99b8d6740a Added the watchify NPM dependency to satisfy karma-browserify's peerDependency 2016-10-04 09:27:43 -04:00
Evert Timberg
c15fa98978 Display tooltip color boxes for all tooltips. Added a new displayColors option to turn them off 2016-10-04 09:20:20 -04:00
Evert Timberg
03735563f4 Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y'
2016-10-03 16:05:21 -04:00
Simon Brunel
1484520692 Better animation when adding or removing data
In order to simulate real-time chart updates (i.e. horizontal animation), it's necessary to distinguish a removed or added value from a simple update. The dataset controller now hooks array methods that alter the data array length to synchronize metadata accordingly. Also remove the duplicate calls of updateBezierControlPoints() for line and radar charts.
2016-10-03 16:01:38 -04:00
Simon Brunel
9deebf8371 Fix config initialization and add unit tests 2016-09-29 17:55:04 -04:00
Simon Brunel
806a3832ef Inject iframe for responsive charts only
Responsiveness is currently based on the use of an iframe, however this method causes performance issues and could be troublesome when used with ad blockers. So make sure that the user is still able to create a chart without iframe when responsive is false.
2016-09-28 15:43:15 -04:00
Evert Timberg
d3d9573af5 Fixes HTML legend string for polar area charts to match doughnut charts. (#3361)
Fixes HTML legend string for polar area charts to match doughnut charts
2016-09-25 08:30:39 -04:00
Evert Timberg
d09a17a2b1 Better number -> string callback for the radial linear scale (#3281)
Also create a new Chart.Ticks namespace to host common tick generators and formatters.
2016-09-24 22:56:16 +02:00
Simon Brunel
d407da4e36 Merge pull request #3325 from chartjs/fix/3269
Improve multiline labeling for tooltips in doughnut charts
2016-09-24 22:31:29 +02:00
Evert Timberg
9041b5a2b9 Update default config tests and re-enable 2016-09-24 22:25:05 +02:00
Evert Timberg
c3d7a3328d In the doughnut chart, specifically handle multiline strings. 2016-09-24 22:25:04 +02:00
Evert Timberg
62ef40ebf6 skip non finite data points when determining scale sizes. Fixes #3125 2016-09-24 12:19:49 -04:00
Evert Timberg
ba133876c2 Merge pull request #3356 from simonbrunel/aspect-ratio
Fix aspect ratio and add responsive unit tests
2016-09-24 12:06:45 -04:00
Evert Timberg
f6ac8279cc Fix 2 minor documentation issues in the scale documentation. #3341 (#3360) 2016-09-24 17:54:51 +02:00
Evert Timberg
11e8c50f72 Compute correct tooltip size when there is no title present (#3324) 2016-09-24 10:58:31 +02:00
Evert Timberg
9015e72ae1 Fix the legend drawing when labels.usePointStyle is true (#3323) 2016-09-24 10:57:33 +02:00