},
time: {
parser: false,
- format: false,
unit: false,
round: false,
isoWeekday: false,
});
it('should use the min option when less than first label for building ticks', function() {
- config.time.min = '2014-12-29T04:00:00';
+ config.ticks.min = '2014-12-29T04:00:00';
var scale = createScale(mockData, config);
expect(scale.ticks[0]).toEqual('Jan 1');
});
it('should use the min option when greater than first label for building ticks', function() {
- config.time.min = '2015-01-02T04:00:00';
+ config.ticks.min = '2015-01-02T04:00:00';
var scale = createScale(mockData, config);
expect(scale.ticks[0]).toEqual('Jan 2');
});
it('should use the max option when greater than last label for building ticks', function() {
- config.time.max = '2015-01-05T06:00:00';
+ config.ticks.max = '2015-01-05T06:00:00';
var scale = createScale(mockData, config);
expect(scale.ticks[scale.ticks.length - 1]).toEqual('Jan 3');
});
it('should use the max option when less than last label for building ticks', function() {
- config.time.max = '2015-01-02T23:00:00';
+ config.ticks.max = '2015-01-02T23:00:00';
var scale = createScale(mockData, config);
expect(scale.ticks[scale.ticks.length - 1]).toEqual('Jan 2');
scales: {
xAxes: [{
type: 'time',
- time: {
+ ticks: {
min: moment().subtract(1, 'months'),
max: moment(),
}
var scale = chart.scales.x;
var options = chart.options.scales.xAxes[0];
- options.time.min = '2012';
- options.time.max = '2051';
+ options.ticks.min = '2012';
+ options.ticks.max = '2051';
chart.update();
expect(scale.min).toEqual(+moment('2012', 'YYYY'));
var scale = chart.scales.x;
var options = chart.options.scales.xAxes[0];
- options.time.min = '2017';
- options.time.max = '2042';
+ options.ticks.min = '2017';
+ options.ticks.max = '2042';
chart.update();
expect(scale.min).toEqual(+moment('2017', 'YYYY'));
var scale = chart.scales.x;
var options = chart.options.scales.xAxes[0];
- options.time.min = '2012';
- options.time.max = '2051';
+ options.ticks.min = '2012';
+ options.ticks.max = '2051';
chart.update();
expect(scale.min).toEqual(+moment('2012', 'YYYY'));
var scale = chart.scales.x;
var options = chart.options.scales.xAxes[0];
- options.time.min = '2017';
- options.time.max = '2043';
+ options.ticks.min = '2017';
+ options.ticks.max = '2043';
chart.update();
expect(scale.min).toEqual(+moment('2017', 'YYYY'));
var scale = chart.scales.x;
var options = chart.options.scales.xAxes[0];
- options.time.min = '2012';
+ options.ticks.min = '2012';
chart.update();
var start = scale.left;
var scale = chart.scales.x;
var options = chart.options.scales.xAxes[0];
- options.time.max = '2050';
+ options.ticks.max = '2050';
chart.update();
var start = scale.left;
var scale = chart.scales.x;
var options = chart.options.scales.xAxes[0];
- options.time.min = '2012';
- options.time.max = '2050';
+ options.ticks.min = '2012';
+ options.ticks.max = '2050';
chart.update();
var start = scale.left;
var scale = chart.scales.x;
var options = chart.options.scales.xAxes[0];
- options.time.min = '2012';
- options.time.max = '2050';
+ options.ticks.min = '2012';
+ options.ticks.max = '2050';
chart.update();
var start = scale.left;
});
});
- describe('when time.min and/or time.max are defined', function() {
+ describe('when ticks.min and/or ticks.max are defined', function() {
['auto', 'data', 'labels'].forEach(function(source) {
['data', 'ticks'].forEach(function(bounds) {
describe('and ticks.source is "' + source + '" and bounds "' + bounds + '"', function() {
var min = '02/19 07:00';
var max = '02/24 08:00';
- options.time.min = min;
- options.time.max = max;
+ options.ticks.min = min;
+ options.ticks.max = max;
chart.update();
expect(scale.min).toEqual(+moment(min, 'MM/DD HH:mm'));
var min = '02/21 07:00';
var max = '02/22 20:00';
- options.time.min = min;
- options.time.max = max;
+ options.ticks.min = min;
+ options.ticks.max = max;
chart.update();
expect(scale.min).toEqual(+moment(min, 'MM/DD HH:mm'));
var scale = chart.scales.x;
var options = chart.options.scales.xAxes[0];
- options.time.min = '2012';
- options.time.max = '2051';
+ options.ticks.min = '2012';
+ options.ticks.max = '2051';
chart.update();
expect(scale.getPixelForValue('2012')).toBeCloseToPixel(scale.left);
var scale = chart.scales.x;
var options = chart.options.scales.xAxes[0];
- options.time.min = '2012';
- options.time.max = '2051';
+ options.ticks.min = '2012';
+ options.ticks.max = '2051';
options.offset = true;
chart.update();
var scale = chart.scales.x;
var options = chart.options.scales.xAxes[0];
- options.time.min = '2012';
+ options.ticks.min = '2012';
chart.update();
var start = scale.left;
var scale = chart.scales.x;
var options = chart.options.scales.xAxes[0];
- options.time.max = '2050';
+ options.ticks.max = '2050';
chart.update();
var start = scale.left;
var scale = chart.scales.x;
var options = chart.options.scales.xAxes[0];
- options.time.min = '2012';
- options.time.max = '2050';
+ options.ticks.min = '2012';
+ options.ticks.max = '2050';
chart.update();
var start = scale.left;
var scale = chart.scales.x;
var options = chart.options.scales.xAxes[0];
- options.time.min = '2012';
- options.time.max = '2050';
+ options.ticks.min = '2012';
+ options.ticks.max = '2050';
chart.update();
var start = scale.left;