on the top of my component I have declared variable selectedTimeSlot
now, on UI I have chart which calls this method to format X axis
dateTickFormatting(val: Moment): string {
switch(this.selectedTimeSlot) {
case TimeSlot.Hour:
return val.format('H');
case TimeSlot.Day:
return val.format('D');
case TimeSlot.Week:
return val.format('ddd');
case TimeSlot.Month:
return val.format('M');
case TimeSlot.Year:
return val.format('Y');
}
}
but this.selectedTimeSlot
is undefined
, how can I access my variable inside this function ?