I am currently facing an issue with implementing highcharts in my Angular application that I am unable to resolve.
My goal is to display the week number on the xAxis using the 'datetime' type. I came across this JSFiddle that seems to provide a solution, but when I attempt to integrate it into my code, I encounter the error message
Cannot assign to 'dateFormats' because it is a constant or a read-only property.
. Towards the end of this explanation, you can find the description of dateFormats - shouldn't it be possible to implement this?
What am I missing here :)
THE ERROR OCCURS ON LINE 1 OF THE FOLLOWING CODE:
Highcharts.dateFormats = {
W: function (timestamp) {
console.log('timestamp', timestamp);
return 45;
}
};
Highcharts.setOptions({
xAxis = {
type: 'datetime',
labels: {
format: '{value:Week %W/%Y}'
},
minTickInterval: 1000 * 3600 * 24 * 7,
minRange: 1000 * 3600 * 24 * 7
};
});
FROM HIGHCHARTS FILE
/**
* A hook for defining additional date format specifiers. New specifiers are defined as key-value pairs by using the
* specifier as key, and a function which takes the timestamp as value. This function returns the formatted portion
* of the date.
*/
dateFormats: DateFormatSpecifiers;