Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
luminassv8
Contributor II
Contributor II

Compass direction as dimension in line chart

Hello everybody

I need to plot wind direction data from various weather stations against time stamps continiously.   My data is currently presented in wind directions (0 - 360 degrees) but this needs to be displayed in a line chart using compass directione ie N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW,NW, NNW.

Please could somebody assist wt script or expressions to achieve this.

Note that I do not want to use a radar chart as that would not allow me to express wind direction against time.

1 Solution

Accepted Solutions
MarcoWedel

Hi,

maybe one solution might be to hide the expression axis and add reference lines instead:

QlikCommunity_Thread_279464_Pic1.JPG

QlikCommunity_Thread_279464_Pic2.JPG

QlikCommunity_Thread_279464_Pic3.JPG

hope this helps

regards

Marco

View solution in original post

12 Replies
sergio0592
Specialist III
Specialist III

You can use Interval match for get compass direction. But i can't figure out how you will represent in line chart Timestamp VS Compass_direction?

Ref_wind:

LOAD * INLINE [

B1, B2, Direction

0,  90, North-East

91, 180,South-East

181,270,South-West

271,360,North-West

];

Wind:

LOAD * INLINE [

Timestamp,           Wind_deg, Speed

26/10/2017 08:01:55, 356,  56

26/10/2017 09:01:55, 356, 59

26/10/2017 10:01:55, 345, 67

26/10/2017 11:01:55, 358, 63      

26/10/2017 12:01:55, 234, 83

26/10/2017 13:01:55, 278, 91

26/10/2017 14:01:55, 234, 45

26/10/2017 15:01:55, 237, 57

26/10/2017 16:01:55, 167, 23

26/10/2017 17:01:55, 134, 26

26/10/2017 18:01:55, 73,  34

];

IntervalMatch (Wind_deg) LOAD B1, B2 Resident Ref_wind;

Anonymous
Not applicable

Hi,

There may be a better way using Pick(Match()) functions but I couldnt figure out how to get range of values in the Match criteria so I have made it in an if statement.

You will need to add some lines and change the criteria but that the gist of it. I have attached a QVW where it is applied

Code used:

if(Degree>=0 and Degree<=30 ,'N',

if(Degree>=31 and Degree<=60,'NE',

if(Degree>=61 and Degree<=120,'E',

if(Degree>=121 and Degree<=150,'SE',

if(Degree>=151 and Degree<=210,'S',

if(Degree>=211 and Degree<=240,'SW',

if(Degree>=241 and Degree<=300,'W',

if(Degree>=301 and Degree<=330,'NW','N'))))))))


Hope it helps


Anonymous
Not applicable

So I'm not 100% sure on the output you are trying to get could you draw a mock up of what it should look like once done.

You should be able to convert your degree's (0°) into N NE E... etc by doing the following resident load in your script:

Load *,

if(Degree>=0 and Degree<=30 ,'N',if(Degree>=31 and Degree<=60,'NE',if(Degree>=61 and Degree<=120,'E',if(Degree>=121 and Degree<=150,'SE',if(Degree>=151 and Degree<=210,'S',if(Degree>=211 and Degree<=240,'SW',if(Degree>=241 and Degree<=300,'W',if(Degree>=301 and Degree<=330,'NW','N')))))))) as Compas;

Load * Inline

[

County,Degree,WindSpeed,

Suffolk,248,40

Norfolk,123,10

Essex,42,10

Devon,350,40

Cornwall,230,60

];

??Untitled.png

luminassv8
Contributor II
Contributor II
Author

Thank you for the responses received

Below is part of a dataset from one of the monitors that I need to plot

On my graph I require time on the one axis and the compass direction on the other axis.  As said above, instead of showing the degrees we require the compass directions.

The graph below does not relate to this specific dataset but gives an ide of what the graph looks like.  Instead of showing degreed on the X axis this needs to be replaced with compass directions starting from N at the top and ending with NNW closest to the 0 point

   

WindDirection704PDate704PTime704P
277.0002017-03-1604:04:00 AM
297.0002017-03-1604:14:00 AM
294.0002017-03-1604:24:00 AM
303.0002017-03-1604:34:00 AM
274.0002017-03-1604:44:00 AM
260.0002017-03-1604:54:00 AM
285.0002017-03-1605:04:00 AM
240.0002017-03-1605:14:00 AM
297.0002017-03-1605:24:00 AM
294.0002017-03-1605:34:00 AM
311.0002017-03-1605:44:00 AM
286.0002017-03-1605:54:00 AM
275.0002017-03-1606:04:00 AM
268.0002017-03-1606:14:00 AM
295.0002017-03-1606:24:00 AM
271.0002017-03-1606:34:00 AM
262.0002017-03-1606:44:00 AM
242.0002017-03-1606:54:00 AM
315.0002017-03-1607:04:00 AM
301.0002017-03-1607:14:00 AM
281.0002017-03-1607:24:00 AM
211.0002017-03-1607:34:00 AM
165.0002017-03-1607:44:00 AM
238.0002017-03-1607:54:00 AM
282.0002017-03-1608:04:00 AM
235.0002017-03-1608:14:00 AM
185.0002017-03-1608:24:00 AM
238.0002017-03-1608:34:00 AM
173.0002017-03-1608:44:00 AM
179.0002017-03-1608:54:00 AM
172.0002017-03-1609:04:00 AM
153.0002017-03-1609:14:00 AM
153.0002017-03-1609:24:00 AM
151.0002017-03-16

09:34:00 AM

luminassv8
Contributor II
Contributor II
Author

HI Aaron

Thank you but I probably explained poorly.  My graph requires compass direction on the X axis,  Time on the Y axis and will show emissions recorded by a number of monitors in a line graph.  See my dataset and a snip of a current graph of which the degrees need to be relaced by wind compass direction

luminassv8
Contributor II
Contributor II
Author

Thank you for your reply.  Please refer to my further response to Aaron below

Best regards

Neil

effinty2112
Master
Master

Hi Neil.,

try:

=Pick(Ceil((WindBearing+11.25 - Floor((WindBearing+11.25)/360)*360)/22.5),'N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW','NW', 'NNW')

Regards

Andrew

Using your data we get:

WindDirection704P Compass Bearing
151.000SSE
153.000SSE
165.000SSE
172.000S
173.000S
179.000S
185.000S
211.000SSW
235.000SW
238.000WSW
240.000WSW
242.000WSW
260.000W
262.000W
268.000W
271.000W
274.000W
275.000W
277.000W
281.000W
282.000WNW
285.000WNW
286.000WNW
294.000WNW
295.000WNW
297.000WNW
301.000WNW
303.000WNW
311.000NW
315.000NW
luminassv8
Contributor II
Contributor II
Author

Thanks Andrew

I can get to this point in various ways but my challenge is getting this into a graph as described earlier

luminassv8
Contributor II
Contributor II
Author

Hi Aaron

I still have not been able to solve this challenge.

I notcice that I had my X and my Y mixed up earlier.

I require the ime on the X axis (Dimension)  and the compass directions on the Y axis   (expression)

I am graphing the wind direction over time