Home › Forums › Chart Support › Wind direction degrees to description › Reply To: Wind direction degrees to description
Already found the solution in ‘labelFormatter’. For others who are looking for such a solution I briefly describe my solution.
Because I made it possible to dynamically add different data (sensor from a weather station) to the chart by clicking a weather icon, I use the setter of the corresponding axis after adding data to chart. See code below.
chart.axisY2[0].set('labelFormatter',function ( e ) { if ( e.value >= 11.25 && e.value < 33.75 ) return 'NNE'; else if ( e.value >= 33.75 && e.value < 56.25 ) return 'NE'; else if (e.value >= 56.25 && e.value < 78.75 ) return 'ENE'; else if (e.value >= 78.75 && e.value < 101.25 ) return 'E'; else if (e.value >= 101.25 && e.value < 123.75 ) return 'ESE'; else if (e.value >= 123.75 && e.value < 146.25 ) return 'SE'; else if (e.value >= 146.25 && e.value < 168.75 ) return 'SSE'; else if (e.value >= 168.75 && e.value < 191.25 ) return 'S'; else if (e.value >= 191.25 && e.value < 213.75 ) return 'SSW'; else if (e.value >= 213.75 && e.value < 236.25 ) return 'SW'; else if (e.value >= 236.25 && e.value < 258.75 ) return 'WSW'; else if (e.value >= 258.75 && e.value < 281.25 ) return 'W'; else if (e.value >= 281.25 && e.value < 303.75 ) return 'WNW'; else if (e.value >= 303.75 && e.value < 326.25 ) return 'NW'; else if (e.value >= 326.25 && e.value < 348.75 ) return 'NNW'; else if (e.value >= 348.75 ) return 'N'; else if (e.value < 11.25 ) return 'N'; return e.value; });