Skip to content

Commit

Permalink
New time scale ticks.mode/.source options
Browse files Browse the repository at this point in the history
`ticks.source` (`'auto'`(default)|`'labels'`): `auto` generates "optimal" ticks based on min, max and a few more options (current `time` implementation`). `labels` generates ticks from the user given `data.labels` values (two additional trailing and leading ticks can be added if min and max are provided).

`ticks.mode` (`'series'`(default)|`'linear'`): `series` displays ticks at the same distance from each other, whatever the time value they represent, while `linear` displays them linearly in time: the distance between each tick represent the amount of time between their time values.
  • Loading branch information
simonbrunel committed Jul 15, 2017
1 parent f16d8a3 commit 4dc75e1
Show file tree
Hide file tree
Showing 3 changed files with 289 additions and 172 deletions.
2 changes: 1 addition & 1 deletion src/helpers/helpers.time.js
Expand Up @@ -55,7 +55,7 @@ module.exports = function(Chart) {
var ticks = [];
if (options.maxTicks) {
var stepSize = options.stepSize;
var startTick = options.min !== undefined ? options.min : niceRange.min;
var startTick = options.min === undefined || options.min === null ? niceRange.min : options.min;
var majorUnit = options.majorUnit;
var majorUnitStart = majorUnit ? moment(startTick).add(1, majorUnit).startOf(majorUnit) : startTick;
var startRange = majorUnitStart.valueOf() - startTick;
Expand Down

0 comments on commit 4dc75e1

Please sign in to comment.