Commit Graph

248 Commits

Author SHA1 Message Date
Evert Timberg
d3d9573af5 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
2016-09-25 08:30:39 -04:00
Simon Brunel
d407da4e36 Merge pull request #3325 from chartjs/fix/3269
Improve multiline labeling for tooltips in doughnut charts
2016-09-24 22:31:29 +02:00
Evert Timberg
9041b5a2b9 Update default config tests and re-enable 2016-09-24 22:25:05 +02:00
Evert Timberg
62ef40ebf6 skip non finite data points when determining scale sizes. Fixes #3125 2016-09-24 12:19:49 -04:00
Evert Timberg
ba133876c2 Merge pull request #3356 from simonbrunel/aspect-ratio
Fix aspect ratio and add responsive unit tests
2016-09-24 12:06:45 -04:00
Simon Brunel
7d65bd3f52 Initial core.controller.js unit tests 2016-09-24 00:04:33 +02:00
dylan-kerr
4f668c3ed9 Adjust expected values in core.title.tests.js 2016-09-23 22:36:58 +01:00
Simon Brunel
4901471445 Automatically expose custom Jasmine matchers 2016-09-08 23:32:47 +02:00
Simon Brunel
8254331eef 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.
2016-09-08 23:32:45 +02:00
Simon Brunel
efb82d93d8 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.
2016-09-08 23:32:43 +02:00
Lubomir Sotirov
38f85c98b5 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).
2016-09-08 14:42:42 +02:00
Simon Brunel
52cdff5fc1 Merge pull request #3254 from ianks/minDisplayFormat
Suport minUnit for time scale
2016-09-08 13:34:53 +02:00
Ian Ker-Seymer
7af6e7f192
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.
2016-09-06 13:11:06 -04:00
Simon Brunel
69ab0d3e23 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`.
2016-09-03 18:42:22 +02:00
courchef
6269e2c437 Error possible when using the plugin Chart.Zoom.js used with time scale (#3194)
Zooming in can cause the params `datasetIndex` and `index` to be null in method `getLabelMoment`. This happens when no ticks are visible on scale. It also throws an error and the chart becomes broken.
2016-09-03 18:06:09 +02:00
Ekaterina Dontsova
4a4dccd6c1 Fix #3044 Line chart single data point centering (#3166)
In line charts, when there is only one label and data point, both are now horizontally centered.
2016-08-25 18:52:12 +02:00
Evert Timberg
8afac7bd3c Merge pull request #3191 from chartjs/fix/2994
Fix issues with repeated labels in the category scale and added a tes…
2016-08-23 17:09:31 -04:00
etimberg
904f19fb7e When drawTicks is false, we should not include their size in the size of the axis 2016-08-22 20:09:09 -04:00
Evert Timberg
1749d90faf Fix issues with repeated labels in the category scale and added a test to cover this case. 2016-08-22 18:03:56 -04:00
Evert Timberg
89531c6b93 Merge pull request #3112 from MatthieuRivaud/MonotoneCubicInterpolation
Monotone cubic interpolation
2016-08-22 17:53:31 -04:00
Karthik Iyengar
349a8a33ea Added borderDash support for grid lines (#3136) (#3142)
* Added borderDash support for grid lines (#3136)

* Save and restore context to prevent border dash being applied to other elements

* Adds support for borderDashOffset, checks for setLineDash (IE9/IE10)

* Fixes tests
2016-08-12 12:31:54 -04:00
Ekaterina Dontsova
31197978b7 Fix #2966: 0 values in logarithmic scale for line and vertical bar charts (#3016) 2016-08-11 21:40:25 +02:00
MatthieuRivaud
566ede1ecd Fixed splineCurveMonotone unit test (for real this time) 2016-08-08 17:02:58 +02:00
MatthieuRivaud
ef66bf5e6d Fixed splineCurveMonotone unit test 2016-08-08 16:33:32 +02:00
MatthieuRivaud
2409908027 Implement monotone cubic interpolation (see issue #3086). 2016-08-08 14:01:30 +02:00
Evert Timberg
d47ef17736 Handle the case where all points are skipped in a line 2016-07-30 14:46:28 -04:00
Evert Timberg
eb6124fea8 Fix 2 line drawing issues and add new tests for these cases 2016-07-30 12:55:42 -04:00
Evert Timberg
f60344dfdb Fix line controller stacking with multiple axes and add a test 2016-07-28 18:10:07 -04:00
Evert Timberg
7ebc533cdc Merge pull request #3028 from chartjs/fix/span-gaps
Refactoring of the line drawing function to make `spanGaps` work correctly
2016-07-28 18:02:56 -04:00
Ian Ker-Seymer
e4dd158b24
Fix out of bounds index access in getLabelMoment
Previously, calling getLabelMoment with an out of bound index would cause an
error such as this:

```
Uncaught TypeError: Cannot read property 'null' of undefined
```

This happens because there is not always guaranteed to be a labelMoment on
at the current datasetIndex.

One example of this is practice comes from a this function call:

```js
// since the are not always guaranteed to be at least two labelMoments
//                                \ / this index can be out of bounds
//                                 |
var tickWidth = me.getPixelForTick(1) - me.getPixelForTick(0) - 6;
```

This patch simply ensures that the `labelMoments` for the `datasetIndex` are
defined before accessing properties on it.
2016-07-26 14:45:05 -04:00
Evert Timberg
2016630daa Refactoring of the line drawing function to make spanGaps work correctly. Added a lot more test conditions to the line element tests. Ensured that the line controller correctly calculated bezier control points when there was a point to be skipped 2016-07-24 18:12:36 -04:00
Evert Timberg
e94d3c0730 Merge pull request #2947 from chartjs/fix/524
Add polar area start angle setting
2016-07-19 18:56:09 -04:00
unknown
1a63113bc0 changed option name for radar chart from offsetAngle to startAngle. Added test to make sure correct angles are computed for all points in the radar chart (with and without startAngle option set). 2016-07-17 23:11:30 -06:00
Evert Timberg
bfa37e7d68 Merge pull request #2926 from chartjs/fix/2915
Fix bar and line controllers to convert strings to numbers when stacking
2016-07-13 18:22:11 -04:00
Evert Timberg
b6686f00f4 Non numeric y (#2849)
* Category scale can now read from the xLabels and yLabels properties.

* Update docs with section regarding the data object.

* Add sample file with non numeric Y and fix animations
2016-07-09 09:22:25 -06:00
Evert Timberg
a452094f5d Add polar area start angle setting 2016-07-09 09:05:02 -04:00
Evert Timberg
7ca5f91b10 Fix bar and line controllers to convert strings to numbers when considering the values for stacking the chart. Simplified the base calculation for the bar charts and added test coverage to ensure that strings will work correctly. 2016-07-06 18:22:42 -04:00
Evert Timberg
44a9866bd8 Merge pull request #2870 from chartjs/fix/2802
Consider left and top when determining value from pixel in category s…
2016-07-06 17:53:50 -04:00
Shayne Linhart
0dccc85e3a Added usePointStyle option to label boxes
- Closes #2252
- Allows label boxes to match the shape(pointStyle) of the corresponding data.
* Removed unused varaible from legend's draw()
2016-07-05 20:08:29 -06:00
Mitsuhiro Tanda
2bf2be7a9c fix stacked scatter line chart 2016-06-30 22:28:21 +09:00
Evert Timberg
3660d9be39 Consider left and top when determining value from pixel in category scale 2016-06-29 07:00:09 -04:00
William Entriken
f2270ed8db Merge pull request #2741 from duerahan/master
time type xAxis height crah in line chart #2622
2016-06-27 13:59:41 -04:00
Evert Timberg
48ac791a0c Allow passing a value to the time scale getPixelForValue method 2016-06-21 19:03:30 -04:00
Simon Brunel
dfdbd4465c Allow to register/unregister an array of plugins
The plugins service now accepts an array of plugin instances to register or unregister (for consistency, renamed `Chart.plugins.remove` to `unregister`). Also added a few methods to manipulate registered plugins, such as `count`, `getAll` and `clear` (mainly used by our unit tests).
2016-06-11 00:17:44 +02:00
Simon Brunel
a55c17d73f Enhance plugin notification system
Change the plugin notification behavior: this method now returns false as soon as a plugin *explicitly* returns false, else returns true. Also, plugins are now called in their own scope (so remove the never used `scope` parameter).
2016-06-10 22:26:55 +02:00
Simon Brunel
7a419af4c2 Rename plugin service and notification method
Rename `Chart.pluginService` to `Chart.plugins` (so move the old Chart.plugins array as a private member of the service), and rename `notifyPlugins` to `notify` for consistency with other service methods.
2016-06-10 22:26:35 +02:00
Jack Valuntine
7d63bf085a time type xAxis height crah in line chart
if input only one data in dataset and xAxis type is date make offset crash.
check offset value and don't devide 0 value.
Add xAxis check test case.
2016-06-09 13:34:15 +09:00
Jack Valentine
99d3f423cb titleColor options is not available
titleColor change to titleFontColor
2016-06-08 23:15:21 +09:00
Jack Valentine
d6e5b5e79a core tooltip test case fixe
titleColor options is not available
titleColor change to titleFontColor
2016-06-08 23:01:41 +09:00
문승찬
5687aa479f Fix tooltip core test case
Change tooltip font color options
this options changed in tooltip core
bodyColor  -> bodyFontColor
titleColor -> titleFontColor
footerColor -> footerFontColor
2016-06-08 10:22:47 +09:00