When i try to use a global variable in this function i always get undefined. On the y axis I need to have fixed values, for example: Fault and Healthy, but chart.js work dynamically and add values.
ticks: {
beginAtZero: true,
max: this.numberOfMax,
// autoSkip: false,
callback: function(value, index, values) {
console.log(value)
if (values.length == 7) {
console.log(this.currentClicked)
switch(value) {
case 0:
return "Healthy"
case 1.0:
return "Inner Race Fault"
case 2.0:
return "Outer Race Fault"
case 3.0:
return "Roller Element Fault"
}
} else if (values.length == 11) {
switch(value) {
case 0:
return "Healthy"
case 1.0:
return "Fault"
}
}
}
So when for example i set max: 1, then values have length 11 or when i set max: 3 then is 7. Maybe is there a way to set number of Values this same as max property?