Commit Graph

2300 Commits

Author SHA1 Message Date
Eric Nikolay Katz
205cedc0ef Enhancement: adds step-after functionality, true defaults to step-before (#4065)
* Adds step-after functionality, true defaults to step-before

* Update stepped line sample to include all variations of steppedLine configurations

* Update documentation on steppedLine values

* Add tests for new steppedLine values 'before' and 'after'
2017-04-16 16:13:13 -04:00
etimberg
19d6df21e3 Fix pointRadius and pointHitRadius settings for radar charts 2017-04-16 16:12:45 -04:00
GabrielMancik
254bd4bf86 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
2017-04-15 12:37:49 -04:00
Joe B. Lewis
ecac839f68 Fix broken link to point to correct sample file. 2017-04-15 09:27:27 -04:00
Simon Brunel
50a80da1e9 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`.
2017-04-08 13:40:21 -04:00
cizmiak
69dd0bde6c scale service - respect new weight scale option for axes ordering (#4094)
* respect new scale option 'order' when ordering scales

* scale service - respect new weight scale option for axes ordering

* added test for scale ordering by weight

* removed trailing spaces from layout weight scale order test
2017-04-04 19:42:25 -04:00
etimberg
06383669be 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.
2017-04-03 17:39:09 -04:00
etimberg
9ea18065ad Add live samples back to docs for each chart type 2017-04-03 17:38:52 -04:00
Thomas Redston
35dcfe00b1 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).

* Re-implement tick generation

As in v2.5
2017-04-02 08:49:00 -04:00
etimberg
222479c5c7 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.
2017-03-28 18:17:26 -04:00
Martin Zürn
6f99157eb8 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
2017-03-27 18:02:56 -04:00
Simon Brunel
f3816b560c Move legend and title in the plugins folder (#4076) 2017-03-25 18:28:54 +01:00
Simon Brunel
e3f3b8978b 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`.
2017-03-25 18:26:45 +01:00
y-take
90d458a6d9 Add link to plugin that creates a stacked percentage chart 2017-03-24 18:57:08 -04:00
ellie
c96ad66945 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
2017-03-22 06:35:50 -04:00
Lee N Dobryden
20a832809e Zero line dash options (#4019)
* Add of zero line border dash options
* Update Readme with zero line border dash config options
2017-03-21 06:38:09 -04:00
Simon Brunel
6e57405a0a Reorganize samples and list them in index.html (#4043) 2017-03-20 20:40:44 -04:00
Samuel Jo
8367f90df0 Do not draw tooltips that have no items (#4034) 2017-03-20 20:40:28 -04:00
Hiroshi Shirosaki
cffa9447a1 Fix radar chart horizontal position (#4032)
Radar chart position is not center horizontally with v2.5.0.

Right and left of `furthestLimits` would be switched wrongly on
this refactoring commit.
e1606f88ed
2017-03-20 20:39:18 -04:00
Evert Timberg
36ccf40946 Fix for stacked bar charts with log axes (#4010)
* Undo fix for #3585 since it has broken the stacked bar charts when the axis has a user defined minimum value.

* When a value of 0 is requested for a vertical logarithmic axis, return the bottom point
2017-03-20 20:38:15 -04:00
Bohdan Khorolets
da1d1ca512 Avoid errors when rendering serverside (#3909) 2017-03-20 20:37:34 -04:00
Evert Timberg
3e94b9431a Update the docs structure/content to use GitBook (#3751)
Update the docs structure/content to use GitBook
2017-03-20 20:36:54 -04:00
Simon Brunel
bd60fa2dfd Correctly handle decimal display size (#4009)
Fix the `readUsedSize` regular expression to correctly parse (truncate) pixel decimal values.
2017-03-18 11:54:56 +01:00
Simon Brunel
4b421a50bf 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.
2017-03-18 11:08:57 +01:00
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