etimberg [Sun, 25 Jun 2017 13:06:22 +0000 (09:06 -0400)]
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
Simon Brunel [Sun, 25 Jun 2017 10:14:28 +0000 (12:14 +0200)]
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.
Simon Brunel [Sun, 25 Jun 2017 08:54:37 +0000 (10:54 +0200)]
Change `valueAtIndexOrDefault` behavior (#4423)
For consistency with `valueOrDefault`, `valueAtIndexOrDefault` now returns null if `value` (expected array) is null. Also get rid of the superfluous `get` prefix in `getValueOrDefault` and `getValueAtIndexOrDefault`.
Simon Brunel [Sat, 24 Jun 2017 09:46:06 +0000 (11:46 +0200)]
Cleanup and reorganize core and canvas helpers
Move some of the "core" and "canvas" utils in `helpers.core.js` and `helpers.canvas.js` and introduce the new `isNullOrUndef` and `isObject` helpers. Deprecate `indexOf` and rename `drawRoundedRectangle` to `roundedRect` which now creates a simple `rect` path if radius is 0. Write missing unit tests for the moved helpers.
etimberg [Mon, 19 Jun 2017 01:21:37 +0000 (21:21 -0400)]
Line height setting for scale titles. The text is centered within the line height, so setting the line height to a size
greater than the font size moves it away from the axis edge.
Peter-Van-Drunen [Fri, 23 Jun 2017 22:08:16 +0000 (18:08 -0400)]
Ensure that chart dimensions are always >= 0
Elements were resizing incorrectly if they were regenerated while the chart was in a div that was display:none. Added a check to avoid this issue. Resolves #4397
According to the (issue tracker of highcharts)[https://github.com/highcharts/highcharts/issues/4405#issuecomment-125124004] they do not consider the code open source. It's available for reading but that's about it.
The code is provided under CC-BY-NC via github.
See also:
https://shop.highsoft.com/faq#Non-Commercial-0
Ricardo Costa [Sun, 11 Jun 2017 16:06:39 +0000 (17:06 +0100)]
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.
Andrew [Mon, 29 May 2017 22:40:10 +0000 (01:40 +0300)]
Implemented aligment by senior unit in time axis. (#4267)
Implemented alignment by major unit in the time scale. This allows showing the first tick of a larger unit like days in a special way and is part of the basis of the time series scale.
Ricardo Costa [Sun, 28 May 2017 21:23:20 +0000 (22:23 +0100)]
Fix onHover event not being triggered (#4297)
Fix onHover event not being triggered
The core controller was looking at the wrong object (options.hover) to
find the function to be called on hover. The function is provided on the
top level options object (options.onHover).
By using the helper function, there's no need to verify if the callback
is defined, as the helper already does that.
Simon Brunel [Fri, 19 May 2017 19:58:34 +0000 (21:58 +0200)]
Deploy to GitHub pages (#4256)
Add Travis CI task to deploy the docs, samples and dist files to chartjs.github.io for the `release` and `master` branches. A `latest` symbolic links is also created for each folder to the highest version (or `master` if any).
Simon Brunel [Sat, 22 Apr 2017 07:49:10 +0000 (09:49 +0200)]
Fix failing instanceof when reading context
`instanceof HTMLCanvasElement/CanvasRenderingContext2D` fails when the item is inside an iframe or when running in a protected environment. We could guess the types from their toString() value but let's keep things flexible and assume it's a sufficient condition if the item has a context2D which has item as `canvas`.
Simon Brunel [Sat, 22 Apr 2017 11:59:56 +0000 (13:59 +0200)]
Enhance the responsive documentation
Make sure to explain responsiveness limitations with CANVAS elements and how to correctly setup a responsive chart using a dedicated and relatively positioned div wrapper.
Fixed calculation of scale min and max when dataset contains no values (#4064)
* Fixed different calculation of scale min and max when dataset contains no values
* Removed trailing spaces
* Added test for correct min/max calculation
* Removed trailing spaces
Simon Brunel [Sun, 19 Mar 2017 16:51:18 +0000 (17:51 +0100)]
Fix and refactor bar controllers
Merge most of the horizontalBar controller into the bar one but also fix stack groups and bar positioning when scales are stacked or when a min and/or max tick values are explicitly defined. Note that this is a breaking change for derived controllers that rely on the following removed methods: `calculateBarBase`, `calculateBarX`, `calculateBarY`, `calculateBarWidth` and `calculateBarHeight`.
etimberg [Sat, 25 Mar 2017 23:34:55 +0000 (19:34 -0400)]
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.
Thomas Redston [Sun, 2 Apr 2017 12:49:00 +0000 (14:49 +0200)]
Time scale improvements to improve performance and reliability
* Make parseTime private
* start on fixing time scale
* Reimplement existing functionality
* Tidy tests
* Fix labels for non-linearly sized units
Months, quarters and years have non-constant numbers of seconds. A scale that's linear WRT milliseconds produces incorrect tick labels due to the label formatting losing precision (eg year labels lose month and day so a label of 2016-12-32 displays as 2016 instead of 2017).
etimberg [Tue, 28 Mar 2017 00:19:57 +0000 (20:19 -0400)]
Update the tooltip with a new `caretPadding` setting. Previously this value was essentially hard coded to
2 because of a typo that read it from the positioner output. Based on #3599 we agreed to make this into
a config setting.
Martin Zürn [Mon, 27 Mar 2017 22:02:56 +0000 (00:02 +0200)]
Fixed misplaced data points on category scale
* Fixed issue, that category scale shows data points misplaced. See #4060
* Cleaned code
* Fixed Irregular whitespace
* Fixed error in case value is undefined
* Verified that no error is thrown in case value === null
Simon Brunel [Sat, 25 Mar 2017 17:26:45 +0000 (18:26 +0100)]
Add `gulp unittest --coverage` argument (#4075)
Coverage data are now generated by running `gulp unittest` with the `--coverage` argument: unit tests are then executed a single time on Travis. The gulp `coverage` task has been removed and `karma.coverage.conf.ci.js` merged into `karma.conf.ci.js`.
Update documentation with gulp commands (and remove them from `README.md`) and remove unused `config.jshintrc` (oversight from #3256). Delete `thankyou.md` which has been merged into `README.md`.
ellie [Wed, 22 Mar 2017 10:35:50 +0000 (03:35 -0700)]
Update line-customTooltips.html (Re issue #4038 )
Add window scroll position to tooltip position calculation so they show up in the intended place instead of potentially off-screen! Moved tooltips inside the canvas parent container since they are being positioned in terms of its location
Radar chart position is not center horizontally with v2.5.0.
Right and left of `furthestLimits` would be switched wrongly on
this refactoring commit.
https://github.com/chartjs/Chart.js/pull/3625/commits/e1606f88ed4805815038cba4fdcd6211d7490356
Simon Brunel [Sat, 18 Mar 2017 10:08:57 +0000 (11:08 +0100)]
Add support to fill between datasets (#4008)
The `fill` option now accepts the index of the target dataset (number) or a string starting by "+" or "-" followed by a number representing the dataset index relative to the current one (e.g. `fill: "-2"` on dataset at index 3 will fill to dataset at index 1). It's also possible to "propagate" the filling to the target of an hidden dataset (`options.plugins.filler.propagate`). Fill boundaries `zero`, `top` and `bottom` have been deprecated and replaced by `origin`, `start` and `end`.
Implementation has been moved out of the line element into a new plugin (`src/plugins/plugin.filler.js`) and does not rely anymore on the deprecated model `scaleTop`, `scaleBottom` and `scaleZero` values. Drawing Bézier splines has been refactored in the canvas helpers (note that `Chart.helpers.canvas` is now an alias of `Chart.canvasHelpers`).
Add 3 new examples and extend utils with a pseudo-random number generator that can be initialized with `srand`. That makes possible to design examples starting always with the same initial data.
Simon Brunel [Sun, 5 Mar 2017 16:49:12 +0000 (17:49 +0100)]
Introduce unit test based on image comparison (#3988)
Attempt to make easier the creation of unit tests that check the drawing output. Until now, this was done by checking calls on a 'fake' context, which is hard to maintain (need to update pixel values by hands) and also not reliable when optimizing code (i.e. different calls sequence but same result).
As of now, it's possible to define 'auto' tests based on JSON/PNG fixtures: chart is generated from the JSON file and compared to the associated PNG image. The image diff is done using `pixelmatch`. As an example (and in preparation of the `filler` plugin), add auto tests for the line element `fill` options.
Simon Brunel [Sat, 4 Mar 2017 15:47:53 +0000 (16:47 +0100)]
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.
Simon Brunel [Sat, 4 Mar 2017 11:21:51 +0000 (12:21 +0100)]
Fix shorthand `legend: false` and `title: false`
Prevent attempt to remove the legend or title layout items if they haven't been created but also check if the item to remove is registered with the layout manager to avoid removing the wrong box `splice(-1, 1)`. Add ids to the legend and title plugins to allow to fully disable them (`options: {plugins: {legend: false, title: false}}`).
Evert Timberg [Wed, 11 Jan 2017 01:05:35 +0000 (20:05 -0500)]
Split radial scale lineArc setting into a combination of existing and new settings.
gridLines.circular is a new option that toggles circular lines. This allows radar charts with circular lines #3082
pointLabels.display is a new option that toggles the display of point labels.
The existing angleLines.display is used with the new pointLabels.display setting is used to trigger the radar like settings.
This required changing the default polar area config.
Simon Brunel [Sat, 25 Feb 2017 10:51:47 +0000 (11:51 +0100)]
Flatten animation object and fix callbacks
Animation callbacks now receives `animationObject` directly with a reference on the associated chart (`animation.chart`), which deprecates `animation.animationObject` and `animation.chartInstance`. Also fix missing `onComplete` animation argument and make sure that an animation object is passed even when animations are disabled.
Simon Brunel [Sat, 25 Feb 2017 12:06:36 +0000 (13:06 +0100)]
Handle incoming model values on element transition
If a value is set on the model after `pivot()` has been called, the view wasn't initialized and the animation started from 0. Now, `_start` and incomplete `_view` are initialized to the model value during the transition (no initial implicit transition).
Also remove exception handling when animating a string (color), which is faster when string are not valid colors (e.g. tooltip position). It requires to update `chartjs-color` to version 2.1.0.