]> git.ipfire.org Git - thirdparty/Chart.js.git/log
thirdparty/Chart.js.git
8 years agoFix retina scale when display size is implicit 3551/head
Simon Brunel [Fri, 11 Nov 2016 18:53:45 +0000 (19:53 +0100)] 
Fix retina scale when display size is implicit

The retinaScale helper now enforces the display size to the correct values because if no style has been set on the canvas, the render size is used as display size, making the chart bigger (or smaller) when deviceAspectRatio is different of 1.

8 years agoFix context state restoration on destroy
Simon Brunel [Mon, 7 Nov 2016 23:16:58 +0000 (00:16 +0100)] 
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.

8 years agoBump version to 2.4.0
Simon Brunel [Sun, 6 Nov 2016 17:31:30 +0000 (18:31 +0100)] 
Bump version to 2.4.0

8 years agoX and Y interaction modes now use the intersect option
etimberg [Fri, 4 Nov 2016 22:40:53 +0000 (18:40 -0400)] 
X and Y interaction modes now use the intersect option

8 years agoFix the event handler when legend is disabled (#3544)
Simon Brunel [Thu, 3 Nov 2016 21:43:52 +0000 (22:43 +0100)] 
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}}.

8 years agoFix iframe resize handler when re-attached to DOM (#3527)
Simon Brunel [Mon, 31 Oct 2016 07:47:28 +0000 (08:47 +0100)] 
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.

8 years agoWhen an event triggers an update while the bufferedUpdate state is true, we need...
etimberg [Sun, 30 Oct 2016 15:03:19 +0000 (11:03 -0400)] 
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

8 years agoBump ESLint to v3.x (gulp and Code Climate) (#3526)
Simon Brunel [Sat, 29 Oct 2016 16:40:27 +0000 (18:40 +0200)] 
Bump ESLint to v3.x (gulp and Code Climate) (#3526)

8 years agoSpelling fixes (#3522)
Josh Soref [Thu, 27 Oct 2016 19:18:31 +0000 (15:18 -0400)] 
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

8 years agofix "area" typo
Varatep Buranintu [Thu, 27 Oct 2016 00:58:41 +0000 (17:58 -0700)] 
fix "area" typo

8 years agoFixes issue #3490: Tick documentation is missing autoSkipPadding
bret b [Tue, 25 Oct 2016 03:27:03 +0000 (22:27 -0500)] 
Fixes issue #3490: Tick documentation is missing autoSkipPadding

Adding a single line to the docs to document autoSkipPadding.

8 years agoUpdate installation instructions in README
Zach Panzarino [Tue, 25 Oct 2016 15:04:58 +0000 (15:04 +0000)] 
Update installation instructions in README

8 years agoUpdate chartColors.js to utils.js and move randomScalingFactor function there
Evert Timberg [Sun, 23 Oct 2016 18:04:00 +0000 (14:04 -0400)] 
Update chartColors.js to utils.js and move randomScalingFactor function there

8 years agoFix bug in 'y' tooltip mode
etimberg [Sun, 23 Oct 2016 03:12:39 +0000 (23:12 -0400)] 
Fix bug in 'y' tooltip mode

8 years agoReorganized sample files into sub directories. Added a helper containing colours...
etimberg [Fri, 21 Oct 2016 03:12:10 +0000 (23:12 -0400)] 
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.

8 years agoAdd a way to filter items in the tooltip
etimberg [Fri, 21 Oct 2016 01:49:13 +0000 (21:49 -0400)] 
Add a way to filter items in the tooltip

8 years agoCustom tooltip: add data points infos (#3201)
bydooweedoo [Wed, 19 Oct 2016 13:48:17 +0000 (21:48 +0800)] 
Custom tooltip: add data points infos (#3201)

Expose tooltip items from tooltip model and added `x` and `y` properties to `TooltipItemInterface`

8 years agoAdd new properties for the caretX,caretY point of a tooltip. Useful for custom tooltips.
etimberg [Sat, 15 Oct 2016 21:04:22 +0000 (17:04 -0400)] 
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.

8 years agoFix eslint errors in layout service test
Zach Panzarino [Tue, 18 Oct 2016 22:00:55 +0000 (22:00 +0000)] 
Fix eslint errors in layout service test

8 years agoLayout service now supports configurable padding on left, top, right and bottom.
etimberg [Sun, 16 Oct 2016 01:16:35 +0000 (21:16 -0400)] 
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.

8 years agoAdd reset method to chart prototype
etimberg [Sun, 16 Oct 2016 13:28:27 +0000 (09:28 -0400)] 
Add reset method to chart prototype

8 years agoExtend eslint to test files (#3473)
Zach Panzarino [Sun, 16 Oct 2016 21:34:59 +0000 (17:34 -0400)] 
Extend eslint to test files (#3473)

* Add eslint to test files

* Fix mockContext for tests

* Make formatting look better for nested objects

8 years agoEnhance context acquisition on chart creation
Simon Brunel [Sat, 15 Oct 2016 21:40:22 +0000 (23:40 +0200)] 
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.

8 years agoMake index mode only work with the horizontal distance to an element (#3471)
Evert Timberg [Sat, 15 Oct 2016 21:49:35 +0000 (16:49 -0500)] 
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

8 years agoConfigurable Tooltip Position Modes (#3453)
Evert Timberg [Fri, 14 Oct 2016 21:36:49 +0000 (16:36 -0500)] 
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

8 years agoBar chart performance improvements
etimberg [Fri, 14 Oct 2016 00:43:11 +0000 (20:43 -0400)] 
Bar chart performance improvements

8 years agoNew fill modes for lines (#3460)
Evert Timberg [Fri, 14 Oct 2016 11:19:47 +0000 (06:19 -0500)] 
New fill modes for lines (#3460)

New fill modes for lines allowing the user to customize where the fill goes to

8 years agoUpdate the GitHub issue template
Simon Brunel [Sun, 9 Oct 2016 08:54:42 +0000 (10:54 +0200)] 
Update the GitHub issue template

8 years agoNo longer merge arrays during the config merge. Simply replace the property
etimberg [Sun, 9 Oct 2016 20:24:47 +0000 (16:24 -0400)] 
No longer merge arrays during the config merge. Simply replace the property

8 years agoReplaces Unicode character with HTML entity
Tieson Trowbridge [Sat, 8 Oct 2016 02:14:25 +0000 (22:14 -0400)] 
Replaces Unicode character with HTML entity

8 years agoFix/3061 (#3446)
Evert Timberg [Sun, 9 Oct 2016 16:26:59 +0000 (12:26 -0400)] 
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.

8 years agoProperly merge colors for the label colors in the tooltip. I added a private helper...
Evert Timberg [Sat, 8 Oct 2016 00:39:24 +0000 (20:39 -0400)] 
Properly merge colors for the label colors in the tooltip. I added a private helper to simplify the code in the tooltip

8 years agoFix bubble chart tooltip callback to use correct labels (#3421)
Evert Timberg [Thu, 6 Oct 2016 12:54:50 +0000 (08:54 -0400)] 
Fix bubble chart tooltip callback to use correct labels (#3421)

Fix bubble chart tooltip callback to use correct label parsed from scales. Fixes #3029

8 years agoRefactor tooltip draw function to extract drawBackground method
Mickael Jeanroy [Tue, 4 Oct 2016 15:08:55 +0000 (17:08 +0200)] 
Refactor tooltip draw function to extract drawBackground method

See issue #3416.

8 years agoIf tick options have min, max and stepSize use them to generate evenly spaced ticks
Aidan Fewster [Tue, 4 Oct 2016 10:53:55 +0000 (11:53 +0100)] 
If tick options have min, max and stepSize use them to generate evenly spaced ticks

8 years agoAdded the watchify NPM dependency to satisfy karma-browserify's peerDependency
Aidan Fewster [Tue, 4 Oct 2016 10:48:18 +0000 (11:48 +0100)] 
Added the watchify NPM dependency to satisfy karma-browserify's peerDependency

8 years agoDisplay tooltip color boxes for all tooltips. Added a new `displayColors` option...
Evert Timberg [Mon, 3 Oct 2016 23:10:54 +0000 (19:10 -0400)] 
Display tooltip color boxes for all tooltips. Added a new `displayColors` option to turn them off

8 years agoImprove Tooltip and Hover Interaction (#3400)
Evert Timberg [Mon, 3 Oct 2016 20:05:21 +0000 (16:05 -0400)] 
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'

8 years agoBetter animation when adding or removing data
Simon Brunel [Sat, 1 Oct 2016 13:38:19 +0000 (15:38 +0200)] 
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.

8 years agoFix config initialization and add unit tests
Simon Brunel [Thu, 29 Sep 2016 20:18:34 +0000 (22:18 +0200)] 
Fix config initialization and add unit tests

8 years agoInject iframe for responsive charts only
Simon Brunel [Sat, 24 Sep 2016 19:51:12 +0000 (21:51 +0200)] 
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.

8 years agoFixes HTML legend string for polar area charts to match doughnut charts. (#3361)
Evert Timberg [Sun, 25 Sep 2016 12:30:39 +0000 (08:30 -0400)] 
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

8 years agoBetter number -> string callback for the radial linear scale (#3281)
Evert Timberg [Sat, 24 Sep 2016 20:56:16 +0000 (16:56 -0400)] 
Better number -> string callback for the radial linear scale (#3281)

Also create a new Chart.Ticks namespace to host common tick generators and formatters.

8 years agoMerge pull request #3325 from chartjs/fix/3269
Simon Brunel [Sat, 24 Sep 2016 20:31:29 +0000 (22:31 +0200)] 
Merge pull request #3325 from chartjs/fix/3269

Improve multiline labeling for tooltips in doughnut charts

8 years agoUpdate default config tests and re-enable 3325/head
Evert Timberg [Sat, 17 Sep 2016 19:57:33 +0000 (15:57 -0400)] 
Update default config tests and re-enable

8 years agoIn the doughnut chart, specifically handle multiline strings.
Evert Timberg [Sat, 17 Sep 2016 15:06:26 +0000 (17:06 +0200)] 
In the doughnut chart, specifically handle multiline strings.

8 years agoskip non finite data points when determining scale sizes. Fixes #3125
Evert Timberg [Sat, 24 Sep 2016 16:19:49 +0000 (12:19 -0400)] 
skip non finite data points when determining scale sizes. Fixes #3125

8 years agoMerge pull request #3356 from simonbrunel/aspect-ratio
Evert Timberg [Sat, 24 Sep 2016 16:06:45 +0000 (12:06 -0400)] 
Merge pull request #3356 from simonbrunel/aspect-ratio

Fix aspect ratio and add responsive unit tests

8 years agoFix 2 minor documentation issues in the scale documentation. #3341 (#3360)
Evert Timberg [Sat, 24 Sep 2016 15:54:51 +0000 (11:54 -0400)] 
Fix 2 minor documentation issues in the scale documentation. #3341 (#3360)

8 years agoCompute correct tooltip size when there is no title present (#3324)
Evert Timberg [Sat, 24 Sep 2016 08:58:31 +0000 (04:58 -0400)] 
Compute correct tooltip size when there is no title present (#3324)

8 years agoFix the legend drawing when `labels.usePointStyle` is true (#3323)
Evert Timberg [Sat, 24 Sep 2016 08:57:33 +0000 (04:57 -0400)] 
Fix the legend drawing when `labels.usePointStyle` is true (#3323)

8 years agoMerge pull request #3358 from dylan-kerr/fix/limit-title-length
Evert Timberg [Sat, 24 Sep 2016 00:20:01 +0000 (20:20 -0400)] 
Merge pull request #3358 from dylan-kerr/fix/limit-title-length

Set maxWidth during title draw to avoid overflow

8 years agoMerge pull request #3357 from kant/patch-1
Evert Timberg [Sat, 24 Sep 2016 00:19:08 +0000 (20:19 -0400)] 
Merge pull request #3357 from kant/patch-1

Minor fixes (proposal)

8 years agoInitial core.controller.js unit tests 3356/head
Simon Brunel [Fri, 23 Sep 2016 15:44:17 +0000 (17:44 +0200)] 
Initial core.controller.js unit tests

8 years agoAdjust expected values in core.title.tests.js 3358/head
dylan-kerr [Fri, 23 Sep 2016 21:36:58 +0000 (22:36 +0100)] 
Adjust expected values in core.title.tests.js

8 years agoSet maxWidth during title draw to avoid overflow
dylan-kerr [Fri, 23 Sep 2016 21:05:54 +0000 (22:05 +0100)] 
Set maxWidth during title draw to avoid overflow

CanvasRenderingContext2D.fillText() accepts a fourth parameter called maxWidth that sets the maximum width of the drawn text, enforced by scaling the entire line.

This commit uses the title element's layout dimensions to set maxWidth and avoid overflow outside of the canvas.

8 years agoMinor fixes (proposal) 3357/head
Darío Hereñú [Fri, 23 Sep 2016 19:00:34 +0000 (16:00 -0300)] 
Minor fixes (proposal)

8 years agoFix radar default aspect ratio and samples
Simon Brunel [Fri, 23 Sep 2016 15:44:06 +0000 (17:44 +0200)] 
Fix radar default aspect ratio and samples

Now that the aspect ratio is correctly handled, fix samples for charts with aspect ratio of 1 which was vertically too large. Also fix the default aspect ratio for radar charts which wasn't applied when creating a chart directly using new Chart(ctx, { type: 'radar' }).

8 years agoFix initial aspect ratio when not responsive
Simon Brunel [Fri, 23 Sep 2016 15:43:52 +0000 (17:43 +0200)] 
Fix initial aspect ratio when not responsive

When responsive is false and no canvas height explicitly set, the aspectRatio option wasn't applied because of the canvas default height. Prevent the retinaScale method to change the canvas display size since this method is called for none responsive charts, but instead make the resize() responsible of these changes. Also, as discussed some time ago, moved most of the core.js logic into core.controller.js. Clean up the destroy process and make sure that initial canvas values are properly saved and restored.

8 years agoGulp command switch to run specific test files
Simon Brunel [Fri, 23 Sep 2016 15:42:56 +0000 (17:42 +0200)] 
Gulp command switch to run specific test files

Add the --inputs command switch to the unittest and unittestWatch tasks, to be able to run unit tests from the specified files only (e.g. gulp unittest --inputs=test/core.element.tests.js;test/core.helpers.tests.js).

8 years agoMake charts vertically responsive (#3105) (#3326)
Simon Brunel [Fri, 23 Sep 2016 15:46:17 +0000 (17:46 +0200)] 
Make charts vertically responsive (#3105) (#3326)

Ensure that the hidden iframe is stretched vertically in order to detect height changes. Remove the classlist check/call since it was incorrectly spelled (should be classList), but also useless since the iframe has just been generated. Also remove the callback check: addResizeListener should never be called w/o a valid callback.

8 years agoMove reverse option for labels to correct section in docs
Zach Panzarino [Fri, 23 Sep 2016 00:12:40 +0000 (00:12 +0000)] 
Move reverse option for labels to correct section in docs
Addresses comment in #3102

8 years agoBump version to 2.3.0
Simon Brunel [Thu, 22 Sep 2016 18:53:26 +0000 (20:53 +0200)] 
Bump version to 2.3.0

8 years agoEnsure the second pie chart sits inline 3321/head
Nick Downie [Wed, 21 Sep 2016 10:17:17 +0000 (11:17 +0100)] 
Ensure the second pie chart sits inline

8 years agoBump version to 2.3.0-rc.1
Simon Brunel [Sat, 17 Sep 2016 09:37:34 +0000 (11:37 +0200)] 
Bump version to 2.3.0-rc.1

8 years agoChange bower package name for chart.js (#1562)
Simon Brunel [Sat, 17 Sep 2016 09:24:31 +0000 (11:24 +0200)] 
Change bower package name for chart.js (#1562)

Thanks to the Bower team, we have been able to register the chart.js package name, previously pointing on a dead repository, which make the Bower integration more consistent with the npm one. All other alias still work (Chart.js, chartjs, Chart-js, chartjs-Chart.js).

8 years agoMerge pull request #3315 from zachpanz88/fix-pie-multi-dataset
Zach Panzarino [Fri, 16 Sep 2016 03:19:47 +0000 (23:19 -0400)] 
Merge pull request #3315 from zachpanz88/fix-pie-multi-dataset

Fix error where pie/doughnut charts did not render correctly with multiple datasets

8 years agoFix bug with pie/doughnut chart legends 3315/head
Zach Panzarino [Fri, 16 Sep 2016 01:29:01 +0000 (01:29 +0000)] 
Fix bug with pie/doughnut chart legends
Fixes a rendering issue when there are multiple datasets on a pie chart and they do not all contain the same number of data in their datasets
Fixes #3309

8 years agoMerge pull request #3287 from simonbrunel/tests-cleanup
Evert Timberg [Thu, 15 Sep 2016 22:12:34 +0000 (18:12 -0400)] 
Merge pull request #3287 from simonbrunel/tests-cleanup

Tests cleanup

8 years agoTurn off linebreak-style linting rule
Simon Brunel [Thu, 15 Sep 2016 21:10:03 +0000 (23:10 +0200)] 
Turn off linebreak-style linting rule

On Windows, this rule conflicts when running ESLint locally on a repository setup with autoCrlf (then all lines are errors).

8 years agoMerge pull request #3308 from zachpanz88/eslint
Simon Brunel [Thu, 15 Sep 2016 16:01:19 +0000 (18:01 +0200)] 
Merge pull request #3308 from zachpanz88/eslint

ESLint Updates

8 years agoImplement eslint changes proposed by @simonbrunel in code review 3308/head
Zach Panzarino [Thu, 15 Sep 2016 12:49:11 +0000 (12:49 +0000)] 
Implement eslint changes proposed by @simonbrunel in code review

8 years agoInclude changes suggested by @etimberg in code review
Zach Panzarino [Thu, 15 Sep 2016 01:21:45 +0000 (01:21 +0000)] 
Include changes suggested by @etimberg in code review

8 years agoAllow variable use before define with warning
Zach Panzarino [Thu, 15 Sep 2016 00:27:29 +0000 (00:27 +0000)] 
Allow variable use before define with warning

8 years agoFix style issues in core and scales
Zach Panzarino [Thu, 15 Sep 2016 00:23:30 +0000 (00:23 +0000)] 
Fix style issues in core and scales

8 years agoFix more style errors in controllers, elements, and scales
Zach Panzarino [Wed, 14 Sep 2016 22:34:41 +0000 (22:34 +0000)] 
Fix more style errors in controllers, elements, and scales

8 years agoRemove func-call-spacing rule
Zach Panzarino [Wed, 14 Sep 2016 18:16:21 +0000 (18:16 +0000)] 
Remove func-call-spacing rule

8 years agoAdd keyword spacing to eslint and update code
Zach Panzarino [Wed, 14 Sep 2016 18:12:23 +0000 (18:12 +0000)] 
Add keyword spacing to eslint and update code

8 years agoFirst round of eslint fixes
Zach Panzarino [Wed, 14 Sep 2016 18:05:19 +0000 (18:05 +0000)] 
First round of eslint fixes

8 years agoUpdate new eslint rules
Zach Panzarino [Wed, 14 Sep 2016 18:03:55 +0000 (18:03 +0000)] 
Update new eslint rules

8 years agoFix broken links in Maintaining.md
Zach Panzarino [Tue, 13 Sep 2016 03:21:40 +0000 (23:21 -0400)] 
Fix broken links in Maintaining.md

8 years agoMerge pull request #3261 from desowin/3211
Evert Timberg [Mon, 12 Sep 2016 23:37:50 +0000 (19:37 -0400)] 
Merge pull request #3261 from desowin/3211

Implement moment diff cache in time scale

8 years agoFix check for undefined 3261/head
Tomasz Moń [Mon, 12 Sep 2016 07:37:04 +0000 (10:37 +0300)] 
Fix check for undefined

Use '!==' instead of '!='. This fixes eqeqeq error reported by gulp-eslint.

8 years agoMerge pull request #3284 from chartjs/fix/3278
Evert Timberg [Sun, 11 Sep 2016 11:46:06 +0000 (07:46 -0400)] 
Merge pull request #3284 from chartjs/fix/3278

Return correct tooltip data in category scale when double category scale is used

8 years agoWhen the category scale is used as the non main scale, return the correct data for... 3284/head
Evert Timberg [Sat, 10 Sep 2016 01:03:59 +0000 (21:03 -0400)] 
When the category scale is used as the non main scale, return the correct data for the tooltip

8 years agoCleanup React extension links (#3282)
Chris Fä [Fri, 9 Sep 2016 21:17:31 +0000 (23:17 +0200)] 
Cleanup React extension links (#3282)

Remove the existing link which was for Chart.js v1 and add 2 links for Chart.js v2

8 years agoMerge pull request #3280 from trantorLiu/master
Evert Timberg [Thu, 8 Sep 2016 23:26:55 +0000 (19:26 -0400)] 
Merge pull request #3280 from trantorLiu/master

Update 01-Chart-Configuration.md

8 years agoUpdate 01-Chart-Configuration.md 3280/head
Chun-Yi Liu [Thu, 8 Sep 2016 23:23:31 +0000 (18:23 -0500)] 
Update 01-Chart-Configuration.md

Fix an anchor link.

8 years agoAutomatically expose custom Jasmine matchers 3287/head
Simon Brunel [Thu, 8 Sep 2016 21:29:39 +0000 (23:29 +0200)] 
Automatically expose custom Jasmine matchers

8 years agoFix time scale tests using the wrong chart instance
Simon Brunel [Tue, 6 Sep 2016 09:34:33 +0000 (11:34 +0200)] 
Fix time scale tests using the wrong chart instance

Some tests were using the removed global `chartInstance` variable, so tests values were incorrect since against the wrong chart instance.

8 years agoAuto-release charts if not persistent (tests)
Simon Brunel [Tue, 6 Sep 2016 09:10:44 +0000 (11:10 +0200)] 
Auto-release charts if not persistent (tests)

For convenience, charts are now automatically released after each spec if they are not acquired using `persistent: true`. Also remove the confusing and error prone `chartInstance` global variable and make sure that chart instances are local to each spec.

8 years agoFix 3267 Add "onHover" functionality for legend (#3271)
Lubomir Sotirov [Wed, 7 Sep 2016 14:59:33 +0000 (16:59 +0200)] 
Fix 3267 Add "onHover" functionality for legend (#3271)

Add "onHover" to the legend options that will hold a user defined function (default is null) and called when a "mousemove" event is registered on top of a label item, with same parameters as the "onClick" option.

Also introduced logic that determines if the type of event passed to the legend "handleEvent" function is one we can handle. Currently allowing "click" and "mousemove" events. If the event is not one of those we stop the function execution (this is for the sake of reusing the legend hitbox calculations).

8 years agoMerge pull request #3254 from ianks/minDisplayFormat
Simon Brunel [Thu, 8 Sep 2016 11:34:53 +0000 (13:34 +0200)] 
Merge pull request #3254 from ianks/minDisplayFormat

Suport minUnit for time scale

8 years agoMerge pull request #3256 from simonbrunel/code-cleanup
Evert Timberg [Tue, 6 Sep 2016 19:21:24 +0000 (15:21 -0400)] 
Merge pull request #3256 from simonbrunel/code-cleanup

ESLint and cleanup

8 years agoSuport minUnit for time scale 3254/head
Ian Ker-Seymer [Fri, 2 Sep 2016 20:39:25 +0000 (16:39 -0400)] 
Suport minUnit for time scale

When dealing with time-delineated datasets, often we have data for known
intervals of time. For example, we may have a dataset which represents number
of purchases per day:

```json
{
labels: ['2016-01-01', '2016-01-02', '2016-01-03']
datasets: [
{
data: [12, 87, 42]
}
],
'...': '...'
}
```

In this case, Chart.js will attempt to figure out the best interval to display
the data, and could pick `hours` as the unit. However, in this case, we would
prefer to just use the `days` interval since our data's granularity can not be
represented well with `hours`.

To remedy this, this commit adds the `minUnit` option which allows
users to (optionally) specify what the minimum unit they would like
to use.

8 years agoBuild labelDiffs cache once per update (#3211)
Tomasz Moń [Sun, 4 Sep 2016 07:22:27 +0000 (10:22 +0300)] 
Build labelDiffs cache once per update (#3211)

Previously buildLabelDiffs() was called at the end of buildTicks() and
hence labelDiffs cache was calculated twice (in getMinimumBoxSize() and
then in fitBox()).

8 years agoBuild label diff lookup table
Tomasz Moń [Sat, 3 Sep 2016 16:40:13 +0000 (19:40 +0300)] 
Build label diff lookup table

This reduces number of calls to momentjs diff() if there are multiple
datasets sharing the same labels (#3211).

8 years agoEnforce curly braces for single statement block 3256/head
Simon Brunel [Sat, 3 Sep 2016 15:49:58 +0000 (17:49 +0200)] 
Enforce curly braces for single statement block

curly: [error, all] (http://eslint.org/docs/rules/curly)

8 years agoEnforce consistent tab indentation
Simon Brunel [Sat, 3 Sep 2016 08:53:32 +0000 (10:53 +0200)] 
Enforce consistent tab indentation

indent: [error, tab] (http://eslint.org/docs/rules/indent)

8 years agoUse gulp-eslint instead of gulp-jshint
Simon Brunel [Fri, 2 Sep 2016 19:56:22 +0000 (21:56 +0200)] 
Use gulp-eslint instead of gulp-jshint

Change the linter in gulp tasks to be consistent with Code Climate results which are based on ESLint using .eslintrc options. However, defaults Code Climate rules are too strict, so turn as warnings the 'complexity' and 'max-statements' rules (other errors has been fixed). Note that the Gulp task name has been changed for `gulp lint`.