Page 1 of 1

Wind direction graph line intervals

Posted: Wed 17 Aug 2016 12:41 pm
by freddie
I note that the wind direction graph horizontal line interval is set at 9 degrees. Is it possible to vary this to 5 or 10 degrees? It makes reading the average direction a bit easier.

Re: Wind direction graph line intervals

Posted: Wed 17 Aug 2016 1:29 pm
by steve
They're at 45 degree intervals for me? Corresponding to the compass points.

Re: Wind direction graph line intervals

Posted: Wed 17 Aug 2016 1:34 pm
by steve
Looking at your chart, it appears that Highcharts is drawing extra horizontal lines, 5 between each of the configured 45 degree lines, hence the 9 degree interval. I don't know what is causing it to do that on your chart, or how you might change it.

Re: Wind direction graph line intervals

Posted: Wed 17 Aug 2016 2:36 pm
by freddie
Looking at your chart, it appears that Highcharts is drawing extra horizontal lines, 5 between each of the configured 45 degree lines, hence the 9 degree interval. I don't know what is causing it to do that on your chart, or how you might change it.
Okay thanks - it's always best to ask. I have no idea why my chart is different, I haven't altered anything (other than the ordering of the tabs) to make it so.

Re: Wind direction graph line intervals

Posted: Wed 17 Aug 2016 2:46 pm
by steve
You could try setting a minorTickInterval - http://api.highcharts.com/highcharts#xA ... ckInterval

Looks like the default is a fifth of the tick interval, which explains what you're seeing. It must be deciding to do it on your chart based on your data.

Re: Wind direction graph line intervals

Posted: Wed 17 Aug 2016 7:22 pm
by mcrossley
Yep, you need to use the minorTickInterval as Steve suggested. I'd use a value of 15, if you use 10 then you will get lines 5 degrees either side of the cardinal points, and 5 is just too small.

Code: Select all

        yAxis: [{
                // left
                title: {text: 'Bearing'},
                opposite: false,
                min:0,
                max:360,
                tickInterval: 45,
                minorTickInterval: 15,
                labels: {
                    align: 'right',
                    x: -5,
                    formatter: function () {
                        return compassP(this.value);
                    }
                }                
            }, {
                // right
                linkedTo: 0,
                gridLineWidth: 0,
                opposite: true,
                title: {text: null},
                min:0,
                max:360,
                tickInterval: 45,
                minorTickInterval: 15,
  ....

Re: Wind direction graph line intervals

Posted: Wed 17 Aug 2016 8:15 pm
by freddie
Thanks Mark. I report wind to the nearest 10 degrees, and I was aware of the fact that NE, SE, sw, etc., are a multiple of 5. I can live with the reduced spacing of the 5 interval, as the wind direction trace is painted on top.

Re: Wind direction graph line intervals

Posted: Thu 18 Aug 2016 1:20 pm
by freddie
minorTickInterval set to 5 looks untidy, as the space between the grid lines is inconsistent. I changed tickInterval to 5, and altered the compassP() function such that it only returned a value under certain circumstances:

Code: Select all

var compassP = function (deg) {
        var a = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'];
        var bearing = deg % 45 == 0 ? a[Math.floor((deg + 22.5) / 45) % 8] : '';
        return bearing;
};
So I get labels every 45 degrees.

I've been experimenting with gridLineColor in order to emphasise the labelled lines right across the chart, but haven't had much luck as yet...