Commit Graph

2409 Commits

Author SHA1 Message Date
andig
8dca88c7d5 Fix tests on OSX with retina screen
* Fix retina unit test failures
* Honor config file formatting
* Prevent gulp error on non-zero karma result
2017-08-05 10:48:12 -04:00
Simon Brunel
9ef5cc72f6 Enforce variable declaration coding style (#4610)
For consistency, enable ESLint `one-var` rule to require multiple variable declarations for initialized variables per scope. Uninitialized variables can still be declared together (preferred) or separately.

http://eslint.org/docs/rules/one-var
2017-08-03 18:33:18 +02:00
Ben McCann
51603cce2e Make Chart.Ticks private and remove Chart.Ticks.generators.time (#4602) 2017-08-02 14:30:38 +02:00
Ben McCann
2922dc96cf Allow updating dataset types (#4586) 2017-08-02 07:29:34 +02:00
Simon Brunel
15934e49c5 Change scale.ticks.bounds to scale.bounds (#4595)
The `bounds` option makes more sense directly under `scale` since it defines the scale limits strategy when no explicit min/max are specified. Also change the `bounds: 'labels'` option value for `bounds: 'ticks'` because it really means: "ensure ticks to be fully visible in the scale, whatever the ticks `source`.
2017-08-02 07:28:27 +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
97e2373721 Change ticks.mode to scale.distribution (#4582)
Fix `ticks.mode` behavior when `ticks.source` is `auto`: the lookup table is now built from the data and not from the ticks, so data (and ticks) are correctly distributed along the scale. Rename the option to `distribution` (more explicit than `mode`) and since this option applies from now on the data, it seems better to have it under `scale` instead `scale.ticks`.
2017-07-30 21:24:29 +02:00
Simon Brunel
53b7a6392f Change scale.ticks back to an array of strings (#4573)
Internal ticks are now stored as objects in the PRIVATE this._ticks member and must not be accessed directly from outside this class. this.ticks is around for a long time and hasn't been marked as private, so we can't change its structure without unexpected breaking changes. If you need to access the scale ticks, use scale.getTicks() instead.
2017-07-29 21:26:36 +02:00
Ben McCann
56fdd7ebc1 Allow specifying bar chart via {x, y} data points (#4565) 2017-07-29 21:22:52 +02:00
Evert Timberg
326991ce50 index-y interaction mode + convert horizontal bar defaults to new mode (#4458)
index-y interaction mode + convert horizontal bar defaults to new mode
2017-07-28 18:07:28 -04:00
Simon Brunel
2cc242d5a3 New time scale ticks.source: 'data' option (#4568)
This new option value generates ticks from data (including labels from {t|x|y} data objects).
2017-07-27 06:41:09 +02:00
andig
43baf2fbe0 Instructions to access resources built from master 2017-07-26 15:40:00 +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
3aa7a20923 New time scale ticks.bounds option (#4556)
`ticks.bounds` (`'data'`(default)|`'label'`): `data` preserves the data range while `labels` ensures that all labels are visible. This option is bypassed by the min/max time options.

Remove the useless time scale `_model` object containing private members: instead, make these members private (prefixed by `_`) part of the scale.
2017-07-25 10:12:53 +02:00
Ben McCann
d07fb28462 Add a note about breaking changes (#4555) 2017-07-24 14:49:26 +02:00
Simon Brunel
48d6face28 Move and rewrite time helpers (#4549)
Move time helpers back into time scale, remove the `Chart.helpers.time namespace` and attempt to make the auto generation logic a bit simpler. The generate method doesn't anymore enforce min/max, the calling code needs to clamp timestamps if needed.
2017-07-23 11:41:12 -04:00
andig
e7445a5f00 Honour time scale min/max settings (#4522) 2017-07-22 14:35:06 +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
Ben McCann
f6b6956a3a Fix ESLint errors (#4485) 2017-07-22 09:19:06 +02:00
Ben McCann
48d76b20fe Allow specifying the time axis via t attribute (#4533)
For time series charts it may make more sense to specify the horizontal axis using the variable `t`. This change will make it much easier to use the time scale with the financial chart, which takes in the data points `{t, o, h, l, c}`.
2017-07-22 08:33:22 +02:00
Simon Brunel
7b6388883a Refactor padding parsing under helpers.options (#4544)
New Chart.helpers.options.toPadding helpers that converts a number or object into a padding {top, right, bottom, left, height, width} object.
2017-07-21 15:03:03 +02:00
Simon Brunel
586b8c12fc Make Chart.Element/elements.* importable (#4540) 2017-07-21 08:40:01 +02:00
Ben McCann
94099c10f7 Remove duplicate npm install (#4542) 2017-07-21 08:21:29 +02:00
Simon Brunel
090196c07c Add support for line height CSS values (#4531)
The title plugin and scale title now accept lineHeight specified using unitless value (1.4), length ('1.4em' or '12px'), percentage ('200%') or keyword ('normal' === 1.2). The line height parsing has been refactored under the 'Chart.helpers.options' namespace. Also fix incorrect text positioning in the title plugin.

https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
2017-07-20 19:20:54 +02:00
Simon Brunel
5ad1b4ade7 New time scale ticks.mode/.source options (#4507)
`ticks.source` (`'auto'`(default)|`'labels'`): `auto` generates "optimal" ticks based on min, max and a few more options (current `time` implementation`). `labels` generates ticks from the user given `data.labels` values (two additional trailing and leading ticks can be added if min and max are provided).

`ticks.mode` (`'linear'`(default)|`series`): `series` displays ticks at the same distance from each other, whatever the time value they represent, while `linear` displays them linearly in time: the distance between each tick represent the amount of time between their time values.
2017-07-19 21:04:15 +02:00
andig
3bb31ca592 Allow category labels definition at scale level (#4506) 2017-07-19 12:41:17 +02:00
Marceau Dewilde
a0fc1c9019 Add link to Java integration (#4527) 2017-07-18 18:26:02 -04:00
Simon Brunel
889ecd560b Make Chart.defaults/Ticks/Interaction importable (#4512)
Default options can now be accessed by importing `core/core.defaults`. The returned object acts as a singleton and is populated when importing classes that expose their own default values (meaning that importing only `code.defaults` results in an empty object). Also make `Chart.Ticks` and `Chart.Interaction` importable since existing defaults rely on these values.

Add the `defaults._set` method that make easier declaring new defaults by merging given values with existing ones for a specific scope (`global`, `scale`, `bar`, etc).
2017-07-16 19:38:19 +02:00
Simon Brunel
1833614e1d Make Chart.platform importable (#4509) 2017-07-16 11:02:25 +02:00
Evert Timberg
8e643db09d Fix copy paste error in new docs with respect to settings for line and radar charts. (#4510) 2017-07-15 16:39:27 -04:00
Simon Brunel
717e8d950a Make Chart.helpers importable (#4479)
Properly export helpers and remove dependencies to `Chart.helpers`. Helpers can now be accessed from `src/helpers/index.js` (`var helpers = require('path/to/helpers/index')`, instead of `var helpers = Chart.helpers`).
2017-07-15 15:13:56 +02:00
Suhaib Khan
b03ab1ca45 Fix labelOffset not working for vertical axes (#4249) 2017-07-15 10:19:16 +02:00
Adrian Liaw
f16d8a32e2 Fix links in documentations (#4477)
* Fix relative links in documentation of configurations
* Fix relative link of 'Time Units'
* Fix relative links for chart types documentations
* Fix the release version link in developers/plugins
2017-07-09 08:58:18 -04:00
Simon Brunel
463a8dd778 Simplify formulas based on code review 2017-07-08 12:02:33 -04:00
Simon Brunel
56050dc9b7 Move easing effects in separate file + unit tests 2017-07-08 12:02:33 -04:00
Alexander Paterson
e8ebb46aad Update link to documentation for previous versions 2017-07-05 17:31:33 -04:00
Akihiko Kusanagi
6e54bc594a Clip chart area before filling
- Add clip and unclip around doFill() call
- This fixes #4450
2017-07-04 07:27:14 -04:00
etimberg
9ec78cee1c Add a note on how to use getElementAtEvent in a click handler 2017-07-04 07:26:18 -04:00
etimberg
7d60857819 Use proper reverse option in radial linear scale 2017-07-04 07:25:58 -04:00
Evert Timberg
cc9e88aebc Support an array for line chart pointBorderWidth 2017-07-04 07:24:37 -04:00
Simon Brunel
225bfd36f3 Rewrite the clone and merge helpers (#4422)
The `clone` method now accepts any type of input but also recursively perform a deep copy of the array items. Rewrite the `configMerge` and `scaleMerge` helpers which now rely on a new generic and customizable `merge` method, that one accepts a target object in which multiple sources are deep copied. Note that the target (first argument) is not cloned and will be modified after calling `merge(target, sources)`. Add a `mergeIf` helper which merge the source properties only if they do not exist in the target object.
2017-07-01 14:51:38 +02:00
Simon Brunel
6f317135a3 Clamp radius when drawing rounded rectangle (#4448) 2017-07-01 14:08:20 +02:00
Let Aurn IV
e5a431e724 Remove .js extensions when requiring a file (#4427) 2017-07-01 09:59:26 +02:00
Simon Brunel
ecca3373b2 Increase ESLint complexity and add config for tests (#4421)
Raise the cyclomatic complexity to 10 which seems to better match the project coding style and still reasonable (6 being quite low). Also move unit tests specific eslint rules in the cascaded `./test/.eslintrc` file (previously in `gulp.js`).
2017-07-01 09:55:11 +02:00
Justin Ledford
0eedec31f0 replace self closing script tag with open and closing tags 2017-06-29 17:05:01 -04:00
etimberg
7f15bebed2 ticks.padding option applies to both vertical and horizontal axes 2017-06-25 13:32:42 -04:00
etimberg
ccb2898539 When all datasets are hidden, the linear scale defaults to a range of 0 - 1.
If `ticks.min` was set this would not set the range correctly.
Added a test to cover this case as well
2017-06-25 13:32:08 -04:00
Simon Brunel
548edc65ea Fix non-passive event listener warning in Chrome
Deprecate `addEvent` and `removeEvent`, and move implementation in `platform.dom.js`. Add 'options' feature detection to register event listeners as passive and prevent warning in Chrome.
2017-06-25 10:15:55 -04:00
etimberg
7fa6052359 Update scatter chart default config to hide lines 2017-06-25 08:47:59 -04:00