This is how my graphs for wind direction looks like...

Mostly my wind direction is between W and NE, and I would like to have that part in the middle of the graph. Is it doable? Anyone with highchart skills here?
Moderator: mcrossley


Code: Select all
$.ajax({
url: 'api/graphdata/wdirdata.json',
dataType: 'json',
success: function (resp) {
chart.hideLoading();
chart.series[0].setData(resp.bearing);
chart.series[1].setData(resp.avgbearing);
}
});Code: Select all
$.ajax({
url: 'api/graphdata/wdirdata.json',
dataType: 'json',
success: function (resp) {
chart.hideLoading();
for (index = 0, len = resp.bearing.length; index < len; ++index) {
resp.bearing[index][1] = (resp.bearing[index][1] + 180)%360;
}
chart.series[0].setData(resp.bearing);
for (index = 0, len = resp.avgbearing.length; index < len; ++index) {
resp.avgbearing[index][1] = (resp.avgbearing[index][1] + 180)%360;
}
chart.series[1].setData(resp.avgbearing);
}
});Like thissteve wrote: You would also have to modify the array which sets the labels.
Code: Select all
var compassP = function (deg) {
var a = ['S', 'SW', 'W', 'NW', 'N', 'NE', 'E', 'SE'];
return a[Math.floor((deg + 22.5) / 45) % 8];
};