I would like to override YTD button behaviour. Currently clicking on the button sets min date range to 01.01 of the year. However I would like to have 31.12 previous year.
I already tried to override on click event (2018 is hardcoded and perhaps could be changed to calculate it dynamically):
Code: Select all
type: 'ytd',
text: 'YTD',
events: {
click: function(e) {
scope.chart.xAxis[0].setExtremes(Date.UTC(2018, 11, 31), Date.now());
return false;
}
}
But there are two problems with such approach:
- YTD button is then not highlighted. As I understand it's perhaps because of "return false", but when returning true, the min date range is not adapted;
- it works only on click event, but there is still a problem with initial button selection which doesn't fire this callback.
I tried also definining xAxis events and override setExtremes or afterSetExtremes callbacks, however the results were nearly the same.
I tried also defining quite new button with providing different type, like 'day' and count = 1, but it also doesn't help.
I would appreciate any help.
Best regards,
Robert