Commit Graph

2276 Commits

Author SHA1 Message Date
Simon Brunel
1ca0ffb5d5 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.
2017-03-05 09:49:12 -07: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
Simon Brunel
b4dfa38731 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}}`).
2017-03-04 09:13:42 -05:00
Cătălin Pintea
5234899323 Added a maxBarThickness setting for bar charts xAxis (#3963)
Added a `maxBarThickness` setting for bar charts xAxis
2017-03-03 19:21:48 -05:00
Evert Timberg
a3b8fb266a 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.
2017-03-03 06:50:34 -05:00
Simon Brunel
b92b256872 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.
2017-03-03 06:49:47 -05:00
Simon Brunel
d25e7b1e1a 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.
2017-03-03 06:49:32 -05:00
Jerry Chang
05e63824b3 Fixed built-in auto skip caused by previous commit (#3904) 2017-02-25 12:12:41 -05:00
etimberg
b50eac366d Add test for layout service weight ordering 2017-02-25 12:10:27 -05:00
etimberg
0c642720d4 Layout service supports a new order setting to configure how boxes are ordered on left and right edges 2017-02-25 12:10:27 -05:00
Evert Timberg
2ddd5ff88c Fix use of reserved keyword as a parameter name 2017-02-25 08:05:05 -05:00
Adam Kirk
1e14124d55 fading tooltip 2017-02-24 19:27:05 -05:00
Marcelo Tedeschi
f97cab12b1 Refactored drawCaret and drawBackground functions to draw the background together with the caret in the same path 2017-02-24 19:27:05 -05:00
Marcelo Tedeschi
a038459d8c Added configuration to documentation 2017-02-24 19:27:05 -05:00
Marcelo Tedeschi
af11be3ce4 Added possibility to draw tooltip borders 2017-02-24 19:27:05 -05:00
Evert Timberg
e519ea399d Fix color dependency for builds 2017-02-21 20:45:56 -05:00
Simon Brunel
4741c6f09d Add new dataset update and draw plugin hooks
In order to take full advantage of the new plugin hooks called before and after a dataset is drawn, all drawing operations must happen on stable meta data, so make sure that transitions are performed before.
2017-02-21 20:28:16 -05:00
Simon Brunel
cc90c5c643 Add chart data property setter and unit tests
Chart data can now be entirely replaced using `chart.data = {...}` thanks to the new property setter (instead of using `chart.config.data = {}`). Also update the documentation, as suggested by @ldaguise and @kennethkalmer, with a note about versions prior 2.6.
2017-02-18 11:53:39 -05:00
potatopeelings
85ee592b2a #3849 - Stack bars in z dimension 2017-02-16 17:58:18 -05:00
etimberg
8dafbc02c0 when axes are in the wrong place, update the config position 2017-02-12 11:23:17 -05:00
Evert Timberg
fed42e218a When the dataset label is not defined, the tooltip label string should not include a ':' character. Added a test to cover this case. 2017-02-10 19:30:52 -05:00
Jerry
8f217182b8 Update tooltip only when active element has changed (#3856)
Resolves #3746
2017-02-10 18:51:37 -05:00
Thomas Redston
9f3b51a80c Reuse parsed results rather than redoing work
The input labels/data is converted into moments in `determineDataLimits`, reuse them instead of duplicating the work.
2017-02-10 18:49:35 -05:00
Jerry Chang
074ab2aa87 Fixed HorizontalBar: stacked axis, displays NaN when all legends
unselected (#3770)

added ability to take snapshot of chart limits in order to be used
when max and min value is not finite

added ignore files
2017-02-10 18:40:37 -05:00
Simon Brunel
ba6e041713 Unit tests for Chart constructor and deprecations 2017-02-10 18:37:56 -05:00
Simon Brunel
28ea6c4967 Rename chartInstance to chart 2017-02-10 18:37:56 -05:00
Simon Brunel
13c6121876 Remove deprecated nested chart accesses 2017-02-10 18:37:56 -05:00
Simon Brunel
a0077d4117 Deprecate Chart.Controller (and nested chart) 2017-02-10 18:37:56 -05:00
etimberg
8c90b9f2de Fix issue with how Chart.PluginBase is defined 2017-02-09 17:36:32 -05:00
Matthisk Heimensen
6ff34a5d4a Added Django-Jchart link to docs/notes.md (#3865) 2017-02-03 18:17:33 -05:00
etimberg
9a3af51618 bump version number 2017-01-28 11:33:14 -05:00
Simon Brunel
7205ff5e2a Replace onEvent by before/afterEvent 2017-01-27 19:32:35 -05:00
Simon Brunel
1e9224d49c Make beforeDraw cancellable and fix easing value 2017-01-27 19:32:35 -05:00
Simon Brunel
979341ecb0 Plugin hooks and jsdoc enhancements
Make all `before` hooks cancellable (except `beforeInit`), meaning that if any plugin return explicitly `false`, the current action is not performed. Ensure that `init` hooks are called before `update` hooks and add associated calling order unit tests. Deprecate `Chart.PluginBase` in favor of `IPlugin` (no more an inheritable class) and document plugin hooks (also rename `extension` by `hook`).
2017-01-27 19:32:35 -05:00
Jakub Juszczak
c6fa4e5582 📝 Add vue-chartjs to docs
vue-chartjs is a wrapper written in vue for chartjs.
2017-01-27 08:05:08 -05:00
Evert Timberg
1ef9fbf7a6 inner radius could be slightly negative due to numerical errors 2017-01-25 08:59:31 -05:00
Evert Timberg
1934358663 remove unnecessary extra init steps 2017-01-22 15:16:35 -05:00
Jerry Chang
696f8d3a39 Documentation update on requiring Chart.js using CommonJS and es6 (#3788) 2017-01-22 10:31:22 -05:00
Simon Brunel
ceec907bee Ignore .gitignore (and more) from Bower packages 2017-01-22 10:31:02 -05:00
Thomas Redston
c20e57bc8a Only generate ticks we care about
Instead of cloning `me.scaleSizeInUnits` moments and probably throwing the vast majority away, only clone what we need.
2017-01-17 21:13:09 -05:00
Simon Brunel
312773ba7b Platform event API abstraction
Move base platform definition and logic in src/platform/platform.js and simplify the browser -> Chart.js event mapping by listing only different naming then fallback to the native type.

Replace `createEvent` by `add/removeEventListener` methods which dispatch Chart.js IEvent objects instead of native events. Move `add/removeResizeListener` implementation into the DOM platform which is now accessible via `platform.add/removeEventListener(chart, 'resize', listener)`.

Finally, remove `bindEvent` and `unbindEvent` from the helpers since the implementation is specific to the chart controller (and should be private).
2017-01-15 14:25:38 -05:00
Evert Timberg
9e9b9cf46d when the cutoutPercentage is 0, the inner radius should be 0 2017-01-15 12:46:01 -05:00
mdewilde
27b2e332c6 Correct anchor link (#3772) 2017-01-08 08:54:03 -05:00
SAiTO TOSHiKi
83c54194ae Fix : Scale label display at top and right. (#3741)
Fix Scale position at rotation when scale is top.
2017-01-05 09:00:05 -05:00
Jake
7c3e71d58b update copyright date 2017-01-02 13:26:51 -05:00
potatopeelings
eebaa84e72 Group stacked bar charts (#2643) (#3563)
Group stacked bar charts (#2643)
2017-01-01 09:36:01 -05:00
Zach Panzarino
bf61b2c297 Happy new year!
Updated copyright date to 2017
2016-12-31 22:25:55 +00:00
Timofey Rechkalov
6255131156 Update 07-Pie-Doughnut-Chart.md
Fixed example in pie chart docs.
2016-12-23 19:33:59 -05:00
Evert Timberg
ecc35c527b Refactoring to put browser specific code in a new class (#3718)
Refactoring to put browser specific code in a new class, BrowserPlatform.
BrowserPlatform implements IPlatform. Chart.Platform is the constructor for the platform object that is attached to the chart instance.

Plugins are notified about the event using the `onEvent` call. The legend plugin was converted to use onEvent instead of the older private `handleEvent` method.
Wrote test to check that plugins are notified about events
2016-12-21 10:22:05 -05:00
SAiTO TOSHiKi
5387c48bd8 Fix bar draw issue with borderWidth. (#3680)
Fix bar draw issue.
1. `Chart.elements.Rectangle.draw` function supports both horizontal and vertical bar.
2. Corrected bar position at minus.
3. Adjust bar size when `borderWidth` is set.
4. Adjust bar size when `borderSkipped` is set.
5. Adjust `borderWidth` with value near 0(base).
6. Update test.
2016-12-20 09:01:07 -05:00