Commit Graph

44 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Ceane Lamerez
456ab9ca36 Fix #2574 - Add support to hide border on the chart 2016-05-17 21:35:19 +02:00
Evert Timberg
8c209405e9 Merge branch 'iso_weekday' of https://github.com/tomduncalf/Chart.js into tomduncalf-iso_weekday
Conflicts:
	docs/01-Scales.md
2016-05-12 18:24:14 -04:00
Tom Duncalf
7ee5af81af Add labelOffset option to scales 2016-05-11 10:43:22 +01:00
Tom Duncalf
8b3d079a50 Add isoWeekday option to allow time scale ticks in 'week' unit mode to start on a specified day of the week 2016-05-11 09:44:02 +01:00
Tom Duncalf
3bef974c25 Add minRotation support 2016-05-10 12:33:36 +01:00
Evert Timberg
38373300ee Improve time scale for zoom and pan
* Improve time scale for zoom and pan
Improve category scale when zoomed

* Fix CI test
2016-05-01 11:40:14 -05:00
Evert Timberg
56411bdcd4 Increase tolerance for CI 2016-04-29 20:07:42 -04:00
Evert Timberg
6df9b24ecd Merge from feature/pan-support
All tests are passing
2016-04-29 20:03:15 -04:00
Evert Timberg
9fe9305992 Reenable time scale tests 2016-04-27 21:50:31 -04:00
Evert Timberg
03fb66751f Make animation options consistent for polar area and doughnut charts (#2342)
* Make animation options consistent and fix an issue when `animateRotate === false` in the polar area chart

* Update docs for moved options

* Fix typo
2016-04-27 16:07:21 -05:00
Tanner Linsley
da90e2f670 Time scale now compensates for rounded tick units
Closes #2277
2016-04-25 17:48:21 -05:00
Evert Timberg
f613ad5c0f Comment out tests since they seem like a moment issue 2016-04-23 20:08:00 -04:00
Evert Timberg
c31c90b2e4 Backwards pixel to value API 2016-04-23 13:27:10 -04:00
Evert Timberg
bc90aaa522 Start on pan support 2016-04-21 07:48:47 -04:00
Evert Timberg
fac92448ff Update tests for new config option 2016-04-16 21:49:08 -04:00
Tanner Linsley
4f60eecc01 Better default tick rotation and tick autoskip settings (#2258)
* Better default tick rotation and tick autoskip settings

* scale.time: Use ctx to measure label, and <= instead of < for unit fitting

* Test Changes

* Passing Tests with new defaults
2016-04-16 17:38:03 -05:00
Evert Timberg
a87ebe0841 Fix test for time zone difference 2016-03-05 23:16:25 -05:00
Evert Timberg
c3f765857e Fix some time rounding problems 2016-03-05 22:58:34 -05:00
Matthias Winkelmann
9410eaabbf fixed timezone bug in test 2016-03-02 16:51:48 +01:00
Matthias Winkelmann
fc46e25f23 fixed test and added a test for a custom date parser 2016-03-02 16:40:58 +01:00
Evert Timberg
8d5b3809f6 Fix global font settings 2016-02-28 13:41:17 -05:00
Evert Timberg
309ab1f477 Disable autoskipper for time scales 2016-02-15 09:41:35 -05:00
Evert Timberg
d16f4fc5ce Add default font options 2016-02-01 21:06:54 -05:00
Evert Timberg
f75116a91e Update millisecond default format. Removed unnecessary space at right edge of time scale. 2016-01-30 16:35:10 -05:00
Evert Timberg
c312835eb1 Add some tests for scales. Cleaned up some minor bugs in the time scale. Wrote better helpers for helpers.min and helpers.max 2016-01-23 12:44:55 -05:00
Tore Lervik
0437968a4e Fixed broken tests 2015-12-21 23:47:38 +01:00
Mattias Lyckne
dec4a5f57a Fix tests 2015-12-21 08:43:48 +01:00
Evert Timberg
28fc6841f3 Add tooltipFormat option to time scale options.
Fix bars when displayed on a time scale.
Updated sample files.
2015-12-05 19:33:33 -05:00
Evert Timberg
14c2cf56d1 Merge pull request #1728 from ashayas/bugfix/1722
Realized minRotation not needed, removed as an option and removed from tests
2015-12-02 07:30:55 -05:00
npsecoding
164671ffeb Realized minRotaion not needed, removed as an option and removed from tests 2015-12-01 22:29:19 -08:00
etimberg
f609452727 Allow the user to change the time label display formats 2015-11-30 20:42:48 -05:00
Evert Timberg
a90aac7b26 Change scale show properties to display and update tests 2015-11-24 19:18:15 -05:00
Evert Timberg
66bc1dc492 Reference data from the main controller wherever possible. Updated tests to account for this. 2015-11-13 09:38:35 -05:00
etimberg
965d74e34a Time scale test fix for optional labels 2015-10-21 21:00:13 -04:00
Evert Timberg
d0475b8052 Down to 3 test failures 2015-10-18 19:48:57 -04:00
Tanner Linsley
e0918817ae Testing fixes for time scale 2015-10-16 21:14:07 -06:00
Evert Timberg
be4facdea9 Time scale tests. 2015-09-27 09:38:11 -04:00