Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
KIdriss
Contributor II
Contributor II

How to create a network graph with airport-country nodes based on travel direction

Hello,

I have a dataset containing information on airport departures and arrivals. 

airport sens country Value
A Arrival France 3
A Arrival Allemagne 8
A Departures France 10
A Departures Italie 3
B Arrival France 3
B Arrival France 3
B Arrival Allemagne 8
B Departures France 10
B Departures Italie 3
B Arrival France 3

 

Is it possible to create a chart like this: P is a country, A is a aeroport name. On the right we have arrivals and on the left we have departures

Sans titre.png

 

Labels (1)
  • Chart

1 Solution

Accepted Solutions
vincent_ardiet_
Specialist
Specialist

Like this

main:
load * inline
[airport,sens,country,value
A,Arrival,France,3
A,Arrival,Allemagne,8
A,Departures,France,10
A,Departures,Italie,3
B,Arrival,France,3
B,Arrival,France,3
B,Arrival,Allemagne,8
B,Departures,France,10
B,Departures,Italie,3
B,Arrival,France,3];


Network:
Load distinct autonumber(Label)-1 as Key,*;
Load airport as Label, 'Airport' as Group Resident main;

mapAirport:
Mapping Load Label, Key Resident Network;

Concatenate(Network)
Load 
   RowNo()-1 as Key
  ,country as Label
  ,sens as Group
  ,value as SegmentValue
  ,ApplyMap('mapAirport',airport,null()) as Parent
Resident main;

View solution in original post

6 Replies
vincent_ardiet_
Specialist
Specialist

With the network chart (if you modify your dataset, as is, it can not work), you will not be able to decide what should be displayed on the right or on the left.
However, with a Sankey chart, maybe you can achieve something close to your need.
You will need to change your dataset in order to have one table for the arrivals and one table for the departures, so you can use the dimensions departure_country, airport and arrival_country.

KIdriss
Contributor II
Contributor II
Author

I tried the Sankey chart but my data is not evenly distributed. It's quite illegible.

How can i modify my dataset to make it compatible with the network graph ? 

vincent_ardiet_
Specialist
Specialist

Look at the help section for the network chart, I think that this is well explained.
You need to build something like this:

Key Label Group Value Parent
0 A airport    
1 B airport    
2 France arrival 3 0
3 Allemagne arrival 8 0
4 France departure 10 0
5 Italie departure 3 0
6 France arrival 3 1
7 France arrival 3 1
8 Allemagne arrival 8 1
9 France departure 10 1
10 Italie departure 3 1
11 France arrival 3 1

 

KIdriss
Contributor II
Contributor II
Author

Hello,

In script i have my first table *main* and i  add a new table networktable for network chart.  I don't understand where should I put the code (`Autonumber("Label") as Key`) to create the 'key' column

main:
  LOAD
   sens,
   airport,
   Autonumber("airport") as airportID,
   Country
FROM [...]
(qvd);

networktable:
  LOAD
   Distinct(aeroport) as Label,
   'airport' as Group
RESIDENT main;
CONCATENATE (networktable)
  LOAD
   Country as Label,
   sens as Group,
   aeroportID as Parent,
   Value
RESIDENT main;
Concatenate (networktable)


 

vincent_ardiet_
Specialist
Specialist

Like this

main:
load * inline
[airport,sens,country,value
A,Arrival,France,3
A,Arrival,Allemagne,8
A,Departures,France,10
A,Departures,Italie,3
B,Arrival,France,3
B,Arrival,France,3
B,Arrival,Allemagne,8
B,Departures,France,10
B,Departures,Italie,3
B,Arrival,France,3];


Network:
Load distinct autonumber(Label)-1 as Key,*;
Load airport as Label, 'Airport' as Group Resident main;

mapAirport:
Mapping Load Label, Key Resident Network;

Concatenate(Network)
Load 
   RowNo()-1 as Key
  ,country as Label
  ,sens as Group
  ,value as SegmentValue
  ,ApplyMap('mapAirport',airport,null()) as Parent
Resident main;
KIdriss
Contributor II
Contributor II
Author

Hello,

On the graph I have a relationship for each row in my table. I want to group the data by airport, direction, country and sum(value).  I thought I should just add this code after the table main.

main:  ...

aggregateData:
   Load sens
       ,sum(value) as value, 
       ,airport
       ,Country
   Resident main
   Group By sens, airport, Country;

 

i get a $Syn table and aggregate table with only sum(value) data