Ranking chart Since 0.8.0
A chart which shows how the rank of something varies.
Usage
To use this component in a Nunjucks template you would add the following (assumes you've loaded OI Lume Viz into componentNamespace: 'oi'
):
{% comp 'oi.chart.ranking' , { "config": config } % }{% endcomp % }
where config
is replaced by an object that contains some or all of these variables:
data
- Either a reference to a CSV file in the Lume site or an array of rows with named attributes
columns
- An ordered array of columns to use to build the ranking chart. Each must have a name
but these can also be virtual columns . This allows you to use fewer columns than exist in the data. There can also be an optional fillna
which will be used in the tooltip in place of null or NaN values.
colours
- Define some visualisation-specific named colours .
width
- Set a specific width for the visualisation.
height
- Set a specific height for the visualisation.
key
- The title of the column that contains the things to be ranked.
circles
- Add rank values on the lines by setting this in the range 0-1
. The default is 0
.
curvature
- This sets the amount of curvature (between 0 and 1) for the line. The default is 1
.
stroke-width
- This can be in the range 0 and 1. The default is 0.5.
font-size
- Sets the size of the font to use.
colour
- The title of the column to use to set the colour of each line. The value can either be a hex colour value or use a colour scale
.
scale
- A colour scale to use to set a line's stroke colour.
min
- Used with scale
and max
to define the colour scale.
max
- Used with scale
and min
to define the colour scale.
legend
- Define the legend
top
- Limit the visualisation to the top x . Note that because things can move in and out of the top 10 the chart will also show those as a compressed group underneath.
gap
- (number) The size of the gap between any top x and the compressed group below. The default is 1
.
divider
- (object) The SVG properties of the dividing line.
tooltip
- This is to add tooltips to days. Either provide the name of an existing/virtual column in the data or construct one using string templates .
reverse
- (boolean) By default the ranking is by the lowest value. However you can set it to use the highest value as the ranking by setting this to true
.
attribution
- Add a line of attribution text under the visualisation.
Examples
Simple ranking chart
Customise the lines
Coloured lines
Lines coloured using a scale
Add a legend
Limit to the top x entries
Limit to the bottom x entries
A more complex example
1. Simple ranking chart§
Embeddable version
Series are created by referencing a column in the data using key
e.g. the Country
column. They will be ranked by the first item in columns
.
Skip ranking chart <strong>Switzerland</strong>:
2018: 1st;
2019: 1st;
2020: 1st Switzerland <strong>Iceland</strong>:
2018: 2nd;
2019: 2nd;
2020: 2nd Iceland <strong>Netherlands</strong>:
2018: 3rd;
2019: 3rd;
2020: 4th Netherlands <strong>Germany</strong>:
2018: 4th;
2019: 4th;
2020: 3rd Germany <strong>Japan</strong>:
2018: 5th;
2019: 5th;
2020: 5th Japan <strong>Slovenia</strong>:
2018: 6th;
2019: 6th;
2020: 16th Slovenia <strong>Austria</strong>:
2018: 7th;
2019: 8th;
2020: 6th Austria <strong>Lithuania</strong>:
2018: 8th;
2019: 7th;
2020: 14th Lithuania <strong>Estonia</strong>:
2018: 9th;
2019: 9th;
2020: 15th Estonia <strong>Latvia</strong>:
2018: 10th;
2019: 14th;
2020: 9th Latvia <strong>Australia</strong>:
2018: 11th;
2019: 10th;
2020: 11th Australia <strong>Denmark</strong>:
2018: 12th;
2019: 11th;
2020: 7th Denmark <strong>Norway</strong>:
2018: 13th;
2019: 13th;
2020: 8th Norway <strong>Czech Republic</strong>:
2018: 14th;
2019: 12th;
2020: 10th Czech Republic <strong>United States</strong>:
2018: 15th;
2019: 15th;
2020: 13th United States <strong>New Zealand</strong>:
2018: 16th;
2019: 18th;
2020: 12th New Zealand <strong>Sweden</strong>:
2018: 17th;
2019: 21st;
2020: 20th Sweden <strong>Canada</strong>:
2018: 18th;
2019: 17th;
2020: 26th Canada <strong>Finland</strong>:
2018: 19th;
2019: 19th;
2020: 22nd Finland <strong>Poland</strong>:
2018: 20th;
2019: 16th;
2020: 17th Poland <strong>United Kingdom</strong>:
2018: 21st;
2019: 20th;
2020: 18th United Kingdom <strong>Israel</strong>:
2018: 22nd;
2019: 22nd;
2020: 19th Israel <strong>Ireland</strong>:
2018: 23rd;
2019: 23rd;
2020: 24th Ireland <strong>Korea</strong>:
2018: 24th;
2019: 25th;
2020: 23rd Korea <strong>Luxembourg</strong>:
2018: 25th;
2019: 28th;
2020: 31st Luxembourg <strong>Hungary</strong>:
2018: 26th;
2019: 26th;
2020: 25th Hungary <strong>Belgium</strong>:
2018: 27th;
2019: 24th;
2020: 21st Belgium <strong>Slovak Republic</strong>:
2018: 28th;
2019: 29th;
2020: 29th Slovak Republic <strong>Mexico</strong>:
2018: 29th;
2019: 31st;
2020: 27th Mexico <strong>France</strong>:
2018: 30th;
2019: 30th;
2020: 28th France <strong>Portugal</strong>:
2018: 31st;
2019: 27th;
2020: 30th Portugal <strong>Chile</strong>:
2018: 32nd;
2019: 32nd;
2020: 32nd Chile <strong>Colombia</strong>:
2018: 33rd;
2019: 34th;
2020: 37th Colombia <strong>Turkey</strong>:
2018: 34th;
2019: 35th;
2020: 35th Turkey <strong>Costa Rica</strong>:
2018: 35th;
2019: 36th;
2020: 36th Costa Rica <strong>Spain</strong>:
2018: 36th;
2019: 33rd;
2020: 33rd Spain <strong>Greece</strong>:
2018: 37th;
2019: 37th;
2020: 34th Greece <strong>Italy</strong>:
2018: 38th;
2019: 38th;
2020: 38th Italy 2018 2019 2020 Go to the start of ranking chart
This example was made with config
:
YAML
data: test.data.heatmap
key: Country
columns:
- name: 2018
template: '{{ Ranks→2018 }} '
- name: 2019
template: '{{ Ranks→2019 }} '
- name: 2020
template: '{{ Ranks→2020 }} '
JSON
{
"data" : "test.data.heatmap" ,
"key" : "Country" ,
"columns" : [{
"name" : 2018 ,
"template" : "{{ Ranks→2018 }}"
},{
"name" : 2019 ,
"template" : "{{ Ranks→2019 }}"
},{
"name" : 2020 ,
"template" : "{{ Ranks→2020 }}"
}]
}
2. Customise the lines§
Embeddable version
The curvature
of the lines can be in the range 0-1 (default of 1
). The stroke-width
can be in the range 0-1 (default of 0.5
). You can add ranks on the lines by setting circle
in the range 0-1 (default of 0
).
Skip ranking chart <strong>Switzerland</strong>:
2018: 1st;
2019: 1st;
2020: 1st Switzerland 1 1 1 <strong>Iceland</strong>:
2018: 2nd;
2019: 2nd;
2020: 2nd Iceland 2 2 2 <strong>Netherlands</strong>:
2018: 3rd;
2019: 3rd;
2020: 4th Netherlands 3 3 4 <strong>Germany</strong>:
2018: 4th;
2019: 4th;
2020: 3rd Germany 4 4 3 <strong>Japan</strong>:
2018: 5th;
2019: 5th;
2020: 5th Japan 5 5 5 <strong>Slovenia</strong>:
2018: 6th;
2019: 6th;
2020: 16th Slovenia 6 6 16 <strong>Austria</strong>:
2018: 7th;
2019: 8th;
2020: 6th Austria 7 8 6 <strong>Lithuania</strong>:
2018: 8th;
2019: 7th;
2020: 14th Lithuania 8 7 14 <strong>Estonia</strong>:
2018: 9th;
2019: 9th;
2020: 15th Estonia 9 9 15 <strong>Latvia</strong>:
2018: 10th;
2019: 14th;
2020: 9th Latvia 10 14 9 <strong>Australia</strong>:
2018: 11th;
2019: 10th;
2020: 11th Australia 11 10 11 <strong>Denmark</strong>:
2018: 12th;
2019: 11th;
2020: 7th Denmark 12 11 7 <strong>Norway</strong>:
2018: 13th;
2019: 13th;
2020: 8th Norway 13 13 8 <strong>Czech Republic</strong>:
2018: 14th;
2019: 12th;
2020: 10th Czech Republic 14 12 10 <strong>United States</strong>:
2018: 15th;
2019: 15th;
2020: 13th United States 15 15 13 <strong>New Zealand</strong>:
2018: 16th;
2019: 18th;
2020: 12th New Zealand 16 18 12 <strong>Sweden</strong>:
2018: 17th;
2019: 21st;
2020: 20th Sweden 17 21 20 <strong>Canada</strong>:
2018: 18th;
2019: 17th;
2020: 26th Canada 18 17 26 <strong>Finland</strong>:
2018: 19th;
2019: 19th;
2020: 22nd Finland 19 19 22 <strong>Poland</strong>:
2018: 20th;
2019: 16th;
2020: 17th Poland 20 16 17 <strong>United Kingdom</strong>:
2018: 21st;
2019: 20th;
2020: 18th United Kingdom 21 20 18 <strong>Israel</strong>:
2018: 22nd;
2019: 22nd;
2020: 19th Israel 22 22 19 <strong>Ireland</strong>:
2018: 23rd;
2019: 23rd;
2020: 24th Ireland 23 23 24 <strong>Korea</strong>:
2018: 24th;
2019: 25th;
2020: 23rd Korea 24 25 23 <strong>Luxembourg</strong>:
2018: 25th;
2019: 28th;
2020: 31st Luxembourg 25 28 31 <strong>Hungary</strong>:
2018: 26th;
2019: 26th;
2020: 25th Hungary 26 26 25 <strong>Belgium</strong>:
2018: 27th;
2019: 24th;
2020: 21st Belgium 27 24 21 <strong>Slovak Republic</strong>:
2018: 28th;
2019: 29th;
2020: 29th Slovak Republic 28 29 29 <strong>Mexico</strong>:
2018: 29th;
2019: 31st;
2020: 27th Mexico 29 31 27 <strong>France</strong>:
2018: 30th;
2019: 30th;
2020: 28th France 30 30 28 <strong>Portugal</strong>:
2018: 31st;
2019: 27th;
2020: 30th Portugal 31 27 30 <strong>Chile</strong>:
2018: 32nd;
2019: 32nd;
2020: 32nd Chile 32 32 32 <strong>Colombia</strong>:
2018: 33rd;
2019: 34th;
2020: 37th Colombia 33 34 37 <strong>Turkey</strong>:
2018: 34th;
2019: 35th;
2020: 35th Turkey 34 35 35 <strong>Costa Rica</strong>:
2018: 35th;
2019: 36th;
2020: 36th Costa Rica 35 36 36 <strong>Spain</strong>:
2018: 36th;
2019: 33rd;
2020: 33rd Spain 36 33 33 <strong>Greece</strong>:
2018: 37th;
2019: 37th;
2020: 34th Greece 37 37 34 <strong>Italy</strong>:
2018: 38th;
2019: 38th;
2020: 38th Italy 38 38 38 2018 2019 2020 Go to the start of ranking chart
This example was made with config
:
YAML
data: test.data.heatmap
key: Country
circles: 0.9
columns:
- name: 2018
template: '{{ Ranks→2018 }} '
- name: 2019
template: '{{ Ranks→2019 }} '
- name: 2020
template: '{{ Ranks→2020 }} '
curvature: 0
stroke-width: 0.2
font-size: 24
JSON
{
"data" : "test.data.heatmap" ,
"key" : "Country" ,
"circles" : 0.9 ,
"columns" : [{
"name" : 2018 ,
"template" : "{{ Ranks→2018 }}"
},{
"name" : 2019 ,
"template" : "{{ Ranks→2019 }}"
},{
"name" : 2020 ,
"template" : "{{ Ranks→2020 }}"
}],
"curvature" : 0 ,
"stroke-width" : 0.2 ,
"font-size" : 24
}
3. Coloured lines§
Embeddable version
The colour of each series can be scaled by the column referenced by colour
. This column contains a colour as a text string. In this example we will also add circles
showing the ranks.
Key: Asia Australia Europe N. America S. America
Skip ranking chart <strong>Switzerland</strong>:
2018: 1st;
2019: 1st;
2020: 1st Switzerland 1 1 1 <strong>Iceland</strong>:
2018: 2nd;
2019: 2nd;
2020: 2nd Iceland 2 2 2 <strong>Netherlands</strong>:
2018: 3rd;
2019: 3rd;
2020: 4th Netherlands 3 3 4 <strong>Germany</strong>:
2018: 4th;
2019: 4th;
2020: 3rd Germany 4 4 3 <strong>Japan</strong>:
2018: 5th;
2019: 5th;
2020: 5th Japan 5 5 5 <strong>Slovenia</strong>:
2018: 6th;
2019: 6th;
2020: 16th Slovenia 6 6 16 <strong>Austria</strong>:
2018: 7th;
2019: 8th;
2020: 6th Austria 7 8 6 <strong>Lithuania</strong>:
2018: 8th;
2019: 7th;
2020: 14th Lithuania 8 7 14 <strong>Estonia</strong>:
2018: 9th;
2019: 9th;
2020: 15th Estonia 9 9 15 <strong>Latvia</strong>:
2018: 10th;
2019: 14th;
2020: 9th Latvia 10 14 9 <strong>Australia</strong>:
2018: 11th;
2019: 10th;
2020: 11th Australia 11 10 11 <strong>Denmark</strong>:
2018: 12th;
2019: 11th;
2020: 7th Denmark 12 11 7 <strong>Norway</strong>:
2018: 13th;
2019: 13th;
2020: 8th Norway 13 13 8 <strong>Czech Republic</strong>:
2018: 14th;
2019: 12th;
2020: 10th Czech Republic 14 12 10 <strong>United States</strong>:
2018: 15th;
2019: 15th;
2020: 13th United States 15 15 13 <strong>New Zealand</strong>:
2018: 16th;
2019: 18th;
2020: 12th New Zealand 16 18 12 <strong>Sweden</strong>:
2018: 17th;
2019: 21st;
2020: 20th Sweden 17 21 20 <strong>Canada</strong>:
2018: 18th;
2019: 17th;
2020: 26th Canada 18 17 26 <strong>Finland</strong>:
2018: 19th;
2019: 19th;
2020: 22nd Finland 19 19 22 <strong>Poland</strong>:
2018: 20th;
2019: 16th;
2020: 17th Poland 20 16 17 <strong>United Kingdom</strong>:
2018: 21st;
2019: 20th;
2020: 18th United Kingdom 21 20 18 <strong>Israel</strong>:
2018: 22nd;
2019: 22nd;
2020: 19th Israel 22 22 19 <strong>Ireland</strong>:
2018: 23rd;
2019: 23rd;
2020: 24th Ireland 23 23 24 <strong>Korea</strong>:
2018: 24th;
2019: 25th;
2020: 23rd Korea 24 25 23 <strong>Luxembourg</strong>:
2018: 25th;
2019: 28th;
2020: 31st Luxembourg 25 28 31 <strong>Hungary</strong>:
2018: 26th;
2019: 26th;
2020: 25th Hungary 26 26 25 <strong>Belgium</strong>:
2018: 27th;
2019: 24th;
2020: 21st Belgium 27 24 21 <strong>Slovak Republic</strong>:
2018: 28th;
2019: 29th;
2020: 29th Slovak Republic 28 29 29 <strong>Mexico</strong>:
2018: 29th;
2019: 31st;
2020: 27th Mexico 29 31 27 <strong>France</strong>:
2018: 30th;
2019: 30th;
2020: 28th France 30 30 28 <strong>Portugal</strong>:
2018: 31st;
2019: 27th;
2020: 30th Portugal 31 27 30 <strong>Chile</strong>:
2018: 32nd;
2019: 32nd;
2020: 32nd Chile 32 32 32 <strong>Colombia</strong>:
2018: 33rd;
2019: 34th;
2020: 37th Colombia 33 34 37 <strong>Turkey</strong>:
2018: 34th;
2019: 35th;
2020: 35th Turkey 34 35 35 <strong>Costa Rica</strong>:
2018: 35th;
2019: 36th;
2020: 36th Costa Rica 35 36 36 <strong>Spain</strong>:
2018: 36th;
2019: 33rd;
2020: 33rd Spain 36 33 33 <strong>Greece</strong>:
2018: 37th;
2019: 37th;
2020: 34th Greece 37 37 34 <strong>Italy</strong>:
2018: 38th;
2019: 38th;
2020: 38th Italy 38 38 38 2018 2019 2020 Go to the start of ranking chart
This example was made with config
:
YAML
colours:
test: '#999000'
data: test.data.heatmap
key: Country
colour: Colour
circles: 0.9
columns:
- name: 2018
template: '{{ Ranks→2018 }} '
- name: 2019
template: '{{ Ranks→2019 }} '
- name: 2020
template: '{{ Ranks→2020 }} '
JSON
{
"colours" : {
"test" : "#999000"
},
"data" : "test.data.heatmap" ,
"key" : "Country" ,
"colour" : "Colour" ,
"circles" : 0.9 ,
"columns" : [{
"name" : 2018 ,
"template" : "{{ Ranks→2018 }}"
},{
"name" : 2019 ,
"template" : "{{ Ranks→2019 }}"
},{
"name" : 2020 ,
"template" : "{{ Ranks→2020 }}"
}]
}
4. Lines coloured using a scale§
Embeddable version
We can use a colour scale
along with a colour
column in the data (with optional min
and max
values) to set the colour using numeric values. In this case we will use the initial rank (found in the Ranks→2018
column) to set the colours.
Skip ranking chart <strong>Switzerland</strong>:
2018: 1st;
2019: 1st;
2020: 1st Switzerland <strong>Iceland</strong>:
2018: 2nd;
2019: 2nd;
2020: 2nd Iceland <strong>Netherlands</strong>:
2018: 3rd;
2019: 3rd;
2020: 4th Netherlands <strong>Germany</strong>:
2018: 4th;
2019: 4th;
2020: 3rd Germany <strong>Japan</strong>:
2018: 5th;
2019: 5th;
2020: 5th Japan <strong>Slovenia</strong>:
2018: 6th;
2019: 6th;
2020: 16th Slovenia <strong>Austria</strong>:
2018: 7th;
2019: 8th;
2020: 6th Austria <strong>Lithuania</strong>:
2018: 8th;
2019: 7th;
2020: 14th Lithuania <strong>Estonia</strong>:
2018: 9th;
2019: 9th;
2020: 15th Estonia <strong>Latvia</strong>:
2018: 10th;
2019: 14th;
2020: 9th Latvia <strong>Australia</strong>:
2018: 11th;
2019: 10th;
2020: 11th Australia <strong>Denmark</strong>:
2018: 12th;
2019: 11th;
2020: 7th Denmark <strong>Norway</strong>:
2018: 13th;
2019: 13th;
2020: 8th Norway <strong>Czech Republic</strong>:
2018: 14th;
2019: 12th;
2020: 10th Czech Republic <strong>United States</strong>:
2018: 15th;
2019: 15th;
2020: 13th United States <strong>New Zealand</strong>:
2018: 16th;
2019: 18th;
2020: 12th New Zealand <strong>Sweden</strong>:
2018: 17th;
2019: 21st;
2020: 20th Sweden <strong>Canada</strong>:
2018: 18th;
2019: 17th;
2020: 26th Canada <strong>Finland</strong>:
2018: 19th;
2019: 19th;
2020: 22nd Finland <strong>Poland</strong>:
2018: 20th;
2019: 16th;
2020: 17th Poland <strong>United Kingdom</strong>:
2018: 21st;
2019: 20th;
2020: 18th United Kingdom <strong>Israel</strong>:
2018: 22nd;
2019: 22nd;
2020: 19th Israel <strong>Ireland</strong>:
2018: 23rd;
2019: 23rd;
2020: 24th Ireland <strong>Korea</strong>:
2018: 24th;
2019: 25th;
2020: 23rd Korea <strong>Luxembourg</strong>:
2018: 25th;
2019: 28th;
2020: 31st Luxembourg <strong>Hungary</strong>:
2018: 26th;
2019: 26th;
2020: 25th Hungary <strong>Belgium</strong>:
2018: 27th;
2019: 24th;
2020: 21st Belgium <strong>Slovak Republic</strong>:
2018: 28th;
2019: 29th;
2020: 29th Slovak Republic <strong>Mexico</strong>:
2018: 29th;
2019: 31st;
2020: 27th Mexico <strong>France</strong>:
2018: 30th;
2019: 30th;
2020: 28th France <strong>Portugal</strong>:
2018: 31st;
2019: 27th;
2020: 30th Portugal <strong>Chile</strong>:
2018: 32nd;
2019: 32nd;
2020: 32nd Chile <strong>Colombia</strong>:
2018: 33rd;
2019: 34th;
2020: 37th Colombia <strong>Turkey</strong>:
2018: 34th;
2019: 35th;
2020: 35th Turkey <strong>Costa Rica</strong>:
2018: 35th;
2019: 36th;
2020: 36th Costa Rica <strong>Spain</strong>:
2018: 36th;
2019: 33rd;
2020: 33rd Spain <strong>Greece</strong>:
2018: 37th;
2019: 37th;
2020: 34th Greece <strong>Italy</strong>:
2018: 38th;
2019: 38th;
2020: 38th Italy 2018 2019 2020 Go to the start of ranking chart
This example was made with config
:
YAML
data: test.data.heatmap
key: Country
colour: Ranks→2018
scale: Viridis
columns:
- name: 2018
template: '{{ Ranks→2018 }} '
- name: 2019
template: '{{ Ranks→2019 }} '
- name: 2020
template: '{{ Ranks→2020 }} '
JSON
{
"data" : "test.data.heatmap" ,
"key" : "Country" ,
"colour" : "Ranks→2018" ,
"scale" : "Viridis" ,
"columns" : [{
"name" : 2018 ,
"template" : "{{ Ranks→2018 }}"
},{
"name" : 2019 ,
"template" : "{{ Ranks→2019 }}"
},{
"name" : 2020 ,
"template" : "{{ Ranks→2020 }}"
}]
}
5. Add a legend§
Embeddable version
We can use a colour scale
along with a colour
column in the data (with optional min
and max
values) to set the colour using numeric values. In this case we will use the initial rank (found in the Ranks→2018
column) to set the colours.
Skip ranking chart <strong>Switzerland</strong>:
2018: 1st;
2019: 1st;
2020: 1st Switzerland <strong>Iceland</strong>:
2018: 2nd;
2019: 2nd;
2020: 2nd Iceland <strong>Netherlands</strong>:
2018: 3rd;
2019: 3rd;
2020: 4th Netherlands <strong>Germany</strong>:
2018: 4th;
2019: 4th;
2020: 3rd Germany <strong>Japan</strong>:
2018: 5th;
2019: 5th;
2020: 5th Japan <strong>Slovenia</strong>:
2018: 6th;
2019: 6th;
2020: 16th Slovenia <strong>Austria</strong>:
2018: 7th;
2019: 8th;
2020: 6th Austria <strong>Lithuania</strong>:
2018: 8th;
2019: 7th;
2020: 14th Lithuania <strong>Estonia</strong>:
2018: 9th;
2019: 9th;
2020: 15th Estonia <strong>Latvia</strong>:
2018: 10th;
2019: 14th;
2020: 9th Latvia <strong>Australia</strong>:
2018: 11th;
2019: 10th;
2020: 11th Australia <strong>Denmark</strong>:
2018: 12th;
2019: 11th;
2020: 7th Denmark <strong>Norway</strong>:
2018: 13th;
2019: 13th;
2020: 8th Norway <strong>Czech Republic</strong>:
2018: 14th;
2019: 12th;
2020: 10th Czech Republic <strong>United States</strong>:
2018: 15th;
2019: 15th;
2020: 13th United States <strong>New Zealand</strong>:
2018: 16th;
2019: 18th;
2020: 12th New Zealand <strong>Sweden</strong>:
2018: 17th;
2019: 21st;
2020: 20th Sweden <strong>Canada</strong>:
2018: 18th;
2019: 17th;
2020: 26th Canada <strong>Finland</strong>:
2018: 19th;
2019: 19th;
2020: 22nd Finland <strong>Poland</strong>:
2018: 20th;
2019: 16th;
2020: 17th Poland <strong>United Kingdom</strong>:
2018: 21st;
2019: 20th;
2020: 18th United Kingdom <strong>Israel</strong>:
2018: 22nd;
2019: 22nd;
2020: 19th Israel <strong>Ireland</strong>:
2018: 23rd;
2019: 23rd;
2020: 24th Ireland <strong>Korea</strong>:
2018: 24th;
2019: 25th;
2020: 23rd Korea <strong>Luxembourg</strong>:
2018: 25th;
2019: 28th;
2020: 31st Luxembourg <strong>Hungary</strong>:
2018: 26th;
2019: 26th;
2020: 25th Hungary <strong>Belgium</strong>:
2018: 27th;
2019: 24th;
2020: 21st Belgium <strong>Slovak Republic</strong>:
2018: 28th;
2019: 29th;
2020: 29th Slovak Republic <strong>Mexico</strong>:
2018: 29th;
2019: 31st;
2020: 27th Mexico <strong>France</strong>:
2018: 30th;
2019: 30th;
2020: 28th France <strong>Portugal</strong>:
2018: 31st;
2019: 27th;
2020: 30th Portugal <strong>Chile</strong>:
2018: 32nd;
2019: 32nd;
2020: 32nd Chile <strong>Colombia</strong>:
2018: 33rd;
2019: 34th;
2020: 37th Colombia <strong>Turkey</strong>:
2018: 34th;
2019: 35th;
2020: 35th Turkey <strong>Costa Rica</strong>:
2018: 35th;
2019: 36th;
2020: 36th Costa Rica <strong>Spain</strong>:
2018: 36th;
2019: 33rd;
2020: 33rd Spain <strong>Greece</strong>:
2018: 37th;
2019: 37th;
2020: 34th Greece <strong>Italy</strong>:
2018: 38th;
2019: 38th;
2020: 38th Italy 2018 2019 2020 Go to the start of ranking chart
This example was made with config
:
YAML
data: test.data.heatmap
key: Country
colour: Ranks→2018
scale: Viridis
columns:
- name: 2018
template: '{{ Ranks→2018 }} '
- name: 2019
template: '{{ Ranks→2019 }} '
- name: 2020
template: '{{ Ranks→2020 }} '
legend:
show: true
position: top
items:
- value: 40
label: 40
- value: 30
label: 30
- value: 20
label: 20
- value: 10
label: 10
- value: 1
label: 1
JSON
{
"data" : "test.data.heatmap" ,
"key" : "Country" ,
"colour" : "Ranks→2018" ,
"scale" : "Viridis" ,
"columns" : [{
"name" : 2018 ,
"template" : "{{ Ranks→2018 }}"
},{
"name" : 2019 ,
"template" : "{{ Ranks→2019 }}"
},{
"name" : 2020 ,
"template" : "{{ Ranks→2020 }}"
}],
"legend" : {
"show" : true ,
"position" : "top" ,
"items" : [{
"value" : 40 ,
"label" : 40
},{
"value" : 30 ,
"label" : 30
},{
"value" : 20 ,
"label" : 20
},{
"value" : 10 ,
"label" : 10
},{
"value" : 1 ,
"label" : 1
}]
}
}
6. Limit to the top x entries§
Embeddable version
It may be that we have a long list of entries and we only want to show the top few. We can limit the visualisation using e.g. top: 10
to get the top 10. But note that because things can move in and out of the top 10 the chart will also show those as a compressed group underneath. We will assign colours based on the Ranks→2020
column in the data so we'll also set the max
value to 10
. To help make things clearer, we'll also add rank circles
and make the stroke-width
narrower.
Skip ranking chart <strong>Switzerland</strong>:
2018: 1st;
2019: 1st;
2020: 1st Switzerland 1 1 1 <strong>Iceland</strong>:
2018: 2nd;
2019: 2nd;
2020: 2nd Iceland 2 2 2 <strong>Netherlands</strong>:
2018: 3rd;
2019: 3rd;
2020: 4th Netherlands 3 3 4 <strong>Germany</strong>:
2018: 4th;
2019: 4th;
2020: 3rd Germany 4 4 3 <strong>Japan</strong>:
2018: 5th;
2019: 5th;
2020: 5th Japan 5 5 5 <strong>Slovenia</strong>:
2018: 6th;
2019: 6th;
2020: 16th Slovenia 6 6 16 <strong>Austria</strong>:
2018: 7th;
2019: 8th;
2020: 6th Austria 7 8 6 <strong>Lithuania</strong>:
2018: 8th;
2019: 7th;
2020: 14th Lithuania 8 7 14 <strong>Estonia</strong>:
2018: 9th;
2019: 9th;
2020: 15th Estonia 9 9 15 <strong>Latvia</strong>:
2018: 10th;
2019: 14th;
2020: 9th Latvia 10 14 9 <strong>Australia</strong>:
2018: 11th;
2019: 10th;
2020: 11th Australia 11 10 11 <strong>Denmark</strong>:
2018: 12th;
2019: 11th;
2020: 7th Denmark 12 11 7 <strong>Norway</strong>:
2018: 13th;
2019: 13th;
2020: 8th Norway 13 13 8 <strong>Czech Republic</strong>:
2018: 14th;
2019: 12th;
2020: 10th Czech Republic 14 12 10 2018 2019 2020 Go to the start of ranking chart
This example was made with config
:
YAML
data: test.data.heatmap
key: Country
colour: Ranks→2020
max: 10
scale: Viridis
circles: 0.9
columns:
- name: 2018
template: '{{ Ranks→2018 }} '
- name: 2019
template: '{{ Ranks→2019 }} '
- name: 2020
template: '{{ Ranks→2020 }} '
top: 10
stroke-width: 0.2
JSON
{
"data" : "test.data.heatmap" ,
"key" : "Country" ,
"colour" : "Ranks→2020" ,
"max" : 10 ,
"scale" : "Viridis" ,
"circles" : 0.9 ,
"columns" : [{
"name" : 2018 ,
"template" : "{{ Ranks→2018 }}"
},{
"name" : 2019 ,
"template" : "{{ Ranks→2019 }}"
},{
"name" : 2020 ,
"template" : "{{ Ranks→2020 }}"
}],
"top" : 10 ,
"stroke-width" : 0.2
}
7. Limit to the bottom x entries§
Embeddable version
It may be that we have a long list of entries and we only want to show the bottom few. We make use of top: 10
but set reverse: true
to change the direction on which the rank is calculated. As things can move in and out of the bottom group, the chart will also show those as a compressed group underneath. We will assign colours based on the Ranks→2020
column in the data so we'll also set the max
value to 10
. To help make things clearer, we'll also add rank circles
and make the stroke-width
narrower.
Skip ranking chart <strong>Italy</strong>:
2018: 1st;
2019: 1st;
2020: 1st Italy 1 1 1 <strong>Greece</strong>:
2018: 2nd;
2019: 2nd;
2020: 5th Greece 2 2 5 <strong>Spain</strong>:
2018: 3rd;
2019: 6th;
2020: 6th Spain 3 6 6 <strong>Costa Rica</strong>:
2018: 4th;
2019: 3rd;
2020: 3rd Costa Rica 4 3 3 <strong>Turkey</strong>:
2018: 5th;
2019: 4th;
2020: 4th Turkey 5 4 4 <strong>Colombia</strong>:
2018: 6th;
2019: 5th;
2020: 2nd Colombia 6 5 2 <strong>Chile</strong>:
2018: 7th;
2019: 7th;
2020: 7th Chile 7 7 7 <strong>Portugal</strong>:
2018: 8th;
2019: 12th;
2020: 9th Portugal 8 12 9 <strong>France</strong>:
2018: 9th;
2019: 9th;
2020: 11th France 9 9 11 <strong>Mexico</strong>:
2018: 10th;
2019: 8th;
2020: 12th Mexico 10 8 12 <strong>Slovak Republic</strong>:
2018: 11th;
2019: 10th;
2020: 10th Slovak Republic 11 10 10 <strong>Luxembourg</strong>:
2018: 14th;
2019: 11th;
2020: 8th Luxembourg 14 11 8 2018 2019 2020 Go to the start of ranking chart
This example was made with config
:
YAML
data: test.data.heatmap
key: Country
colour: Ranks→2020
scale: Viridis
circles: 0.9
debug: true
columns:
- name: 2018
template: '{{ Ranks→2018 }} '
- name: 2019
template: '{{ Ranks→2019 }} '
- name: 2020
template: '{{ Ranks→2020 }} '
reverse: true
max: 10
top: 10
stroke-width: 0.2
JSON
{
"data" : "test.data.heatmap" ,
"key" : "Country" ,
"colour" : "Ranks→2020" ,
"scale" : "Viridis" ,
"circles" : 0.9 ,
"debug" : true ,
"columns" : [{
"name" : 2018 ,
"template" : "{{ Ranks→2018 }}"
},{
"name" : 2019 ,
"template" : "{{ Ranks→2019 }}"
},{
"name" : 2020 ,
"template" : "{{ Ranks→2020 }}"
}],
"reverse" : true ,
"max" : 10 ,
"top" : 10 ,
"stroke-width" : 0.2
}
8. A more complex example§
Embeddable version
This uses a dataset of private sector long term empty properties by ward in Leeds taken from Data Mill North. The CSV file contains the percentage of empty properties in each ward by month. We find the rank for each key
(e.g. Ward
) in each of the columns
. As we want larger percentages to give lower ranks, we set reverse
to true
. We colour
the lines by the ranking of the 2019
column in the data by referring to 2019_rank
.
Skip ranking chart <strong>City and Hunslet</strong>:
2009: 1st;
2010: 1st;
2011: 2nd;
2012: 3rd;
2013: 3rd;
2014: 3rd;
2015: 3rd;
2016: 3rd;
2017: 3rd;
2018: 3rd;
2019: 3rd City and Hunslet <strong>Headingley</strong>:
2009: 2nd;
2010: 2nd;
2011: 1st;
2012: 1st;
2013: 1st;
2014: 1st;
2015: 1st;
2016: 1st;
2017: 1st;
2018: 1st;
2019: 1st Headingley <strong>Hyde park and Woodhouse</strong>:
2009: 3rd;
2010: joint 3rd;
2011: 3rd;
2012: 2nd;
2013: 2nd;
2014: 2nd;
2015: 2nd;
2016: 2nd;
2017: 2nd;
2018: 2nd;
2019: 2nd Hyde park and Woodhouse <strong>Beeston and Holbeck</strong>:
2009: 4th;
2010: joint 3rd;
2011: 8th;
2012: 9th;
2013: 4th;
2014: 4th;
2015: 5th;
2016: joint 8th;
2017: 12th;
2018: 8th;
2019: 8th Beeston and Holbeck <strong>Gipton and Harehills</strong>:
2009: 5th;
2010: 6th;
2011: 9th;
2012: 7th;
2013: 6th;
2014: joint 7th;
2015: 4th;
2016: 4th;
2017: 4th;
2018: 5th;
2019: 5th Gipton and Harehills <strong>Chapel Allerton</strong>:
2009: 6th;
2010: 7th;
2011: 6th;
2012: 8th;
2013: 10th;
2014: 9th;
2015: 7th;
2016: 5th;
2017: 8th;
2018: 9th;
2019: 6th Chapel Allerton <strong>Armley</strong>:
2009: 7th;
2010: 9th;
2011: joint 11th;
2012: 12th;
2013: 12th;
2014: 12th;
2015: 12th;
2016: 12th;
2017: 14th;
2018: 10th;
2019: joint 9th Armley <strong>Kirkstall</strong>:
2009: 8th;
2010: 8th;
2011: 4th;
2012: 6th;
2013: 8th;
2014: 6th;
2015: 9th;
2016: 10th;
2017: 6th;
2018: 4th;
2019: 4th Kirkstall <strong>Guiseley and Rawdon</strong>:
2009: joint 9th;
2010: 11th;
2011: 13th;
2012: 14th;
2013: 21st;
2014: 17th;
2015: 13th;
2016: 15th;
2017: 16th;
2018: 17th;
2019: 19th Guiseley and Rawdon <strong>Weetwood</strong>:
2009: joint 9th;
2010: 10th;
2011: 7th;
2012: 5th;
2013: 7th;
2014: joint 7th;
2015: 6th;
2016: 14th;
2017: 7th;
2018: 6th;
2019: joint 9th Weetwood <strong>Roundhay</strong>:
2009: 11th;
2010: 12th;
2011: 10th;
2012: 10th;
2013: 9th;
2014: 10th;
2015: 10th;
2016: joint 8th;
2017: 9th;
2018: 13th;
2019: 12th Roundhay <strong>Burmantofts and Richmond Hill</strong>:
2009: 12th;
2010: 5th;
2011: 5th;
2012: 4th;
2013: 5th;
2014: 5th;
2015: 8th;
2016: 6th;
2017: 5th;
2018: 7th;
2019: 11th Burmantofts and Richmond Hill <strong>Harewood</strong>:
2009: 13th;
2010: joint 13th;
2011: joint 11th;
2012: 11th;
2013: 11th;
2014: 11th;
2015: 11th;
2016: 7th;
2017: 10th;
2018: 12th;
2019: 7th Harewood <strong>Wetherby</strong>:
2009: 14th;
2010: joint 13th;
2011: 16th;
2012: joint 18th;
2013: 16th;
2014: 15th;
2015: joint 21st;
2016: 20th;
2017: 20th;
2018: 15th;
2019: 15th Wetherby <strong>Alwoodley</strong>:
2009: 15th;
2010: 17th;
2011: 14th;
2012: 15th;
2013: 15th;
2014: 14th;
2015: 17th;
2016: 11th;
2017: 11th;
2018: 16th;
2019: 17th Alwoodley <strong>Calverley and Farsley</strong>:
2009: 16th;
2010: 21st;
2011: 19th;
2012: joint 18th;
2013: 14th;
2014: 19th;
2015: 15th;
2016: 16th;
2017: 18th;
2018: 19th;
2019: 14th Calverley and Farsley <strong>Adel and Wharfedale</strong>:
2009: joint 17th;
2010: 23rd;
2011: 20th;
2012: 13th;
2013: 13th;
2014: 13th;
2015: 14th;
2016: 13th;
2017: 13th;
2018: 14th;
2019: 16th Adel and Wharfedale <strong>Otley and Yeadon</strong>:
2009: joint 17th;
2010: 15th;
2011: 17th;
2012: 20th;
2013: 18th;
2014: 18th;
2015: 18th;
2016: 18th;
2017: 15th;
2018: 11th;
2019: 13th Otley and Yeadon <strong>Killingbeck and Seacroft</strong>:
2009: 19th;
2010: joint 29th;
2011: 30th;
2012: 25th;
2013: 33rd;
2014: 33rd;
2015: 33rd;
2016: 31st;
2017: 32nd;
2018: 32nd;
2019: 25th Killingbeck and Seacroft <strong>Morley South</strong>:
2009: 20th;
2010: joint 18th;
2011: 21st;
2012: joint 16th;
2013: joint 19th;
2014: 16th;
2015: 20th;
2016: joint 29th;
2017: 25th;
2018: 18th;
2019: 28th Morley South <strong>Moortown</strong>:
2009: 21st;
2010: 22nd;
2011: 15th;
2012: joint 16th;
2013: 24th;
2014: 21st;
2015: 19th;
2016: 17th;
2017: 17th;
2018: joint 20th;
2019: 21st Moortown <strong>Horsforth</strong>:
2009: 22nd;
2010: 20th;
2011: 22nd;
2012: 22nd;
2013: joint 19th;
2014: 22nd;
2015: 16th;
2016: 19th;
2017: 22nd;
2018: joint 20th;
2019: 20th Horsforth <strong>Pudsey</strong>:
2009: 23rd;
2010: joint 18th;
2011: 23rd;
2012: 23rd;
2013: 17th;
2014: 20th;
2015: 24th;
2016: 21st;
2017: 23rd;
2018: 23rd;
2019: 18th Pudsey <strong>Farnley and Wortley</strong>:
2009: 24th;
2010: 25th;
2011: 27th;
2012: 32nd;
2013: joint 25th;
2014: 31st;
2015: 30th;
2016: joint 27th;
2017: 26th;
2018: 27th;
2019: 31st Farnley and Wortley <strong>Kippax and Methley</strong>:
2009: 25th;
2010: 16th;
2011: 18th;
2012: 21st;
2013: 22nd;
2014: 23rd;
2015: 28th;
2016: 22nd;
2017: 21st;
2018: joint 24th;
2019: joint 26th Kippax and Methley <strong>Ardsley and Robin hood</strong>:
2009: 26th;
2010: joint 27th;
2011: 24th;
2012: joint 29th;
2013: 31st;
2014: 29th;
2015: 25th;
2016: joint 27th;
2017: joint 30th;
2018: 26th;
2019: joint 22nd Ardsley and Robin hood <strong>Morley North</strong>:
2009: 27th;
2010: 24th;
2011: 25th;
2012: 26th;
2013: 23rd;
2014: 28th;
2015: 23rd;
2016: 23rd;
2017: 19th;
2018: joint 24th;
2019: joint 22nd Morley North <strong>Garforth and Swillington</strong>:
2009: 28th;
2010: 32nd;
2011: 31st;
2012: joint 29th;
2013: 28th;
2014: joint 24th;
2015: 26th;
2016: joint 25th;
2017: 24th;
2018: 22nd;
2019: joint 22nd Garforth and Swillington <strong>Rothwell</strong>:
2009: 29th;
2010: joint 29th;
2011: 26th;
2012: 27th;
2013: joint 25th;
2014: joint 24th;
2015: 29th;
2016: joint 29th;
2017: 27th;
2018: 31st;
2019: 29th Rothwell <strong>Bramley and Stanningley</strong>:
2009: 30th;
2010: joint 27th;
2011: 32nd;
2012: joint 29th;
2013: joint 25th;
2014: 26th;
2015: joint 21st;
2016: 24th;
2017: 29th;
2018: 29th;
2019: joint 26th Bramley and Stanningley <strong>Cross Gates and Whinmoor</strong>:
2009: 31st;
2010: 26th;
2011: 28th;
2012: 28th;
2013: 32nd;
2014: 32nd;
2015: 31st;
2016: 32nd;
2017: joint 30th;
2018: 30th;
2019: 32nd Cross Gates and Whinmoor <strong>Temple Newsam</strong>:
2009: 32nd;
2010: 31st;
2011: 29th;
2012: 24th;
2013: 29th;
2014: 30th;
2015: 27th;
2016: joint 25th;
2017: 28th;
2018: 28th;
2019: 30th Temple Newsam <strong>Middleton Park</strong>:
2009: 33rd;
2010: 33rd;
2011: 33rd;
2012: 33rd;
2013: 30th;
2014: 27th;
2015: 32nd;
2016: 33rd;
2017: 33rd;
2018: 33rd;
2019: 33rd Middleton Park 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 Go to the start of ranking chart
This example was made with config
:
YAML
data: test.data.dmn-lcc-private-sector-long-term-empties
key: Ward
colour: 2019_rank
scale: Viridis
stroke-width: 0.75
reverse: true
columns:
- name: '2009'
template: '{{ Jan-09 % }} '
- name: '2010'
template: '{{ Jan-10 % }} '
- name: '2011'
template: '{{ Jan-11 % }} '
- name: '2012'
template: '{{ Jan-12 % }} '
- name: '2013'
template: '{{ Jan-13 % }} '
- name: '2014'
template: '{{ Jan-14 % }} '
- name: '2015'
template: '{{ Jan-15 % }} '
- name: '2016'
template: '{{ Jan-16 % }} '
- name: '2017'
template: '{{ Jan-17 % }} '
- name: '2018'
template: '{{ Jan-18 % }} '
- name: '2019'
template: '{{ Jan-19 % }} '
JSON
{
"data" : "test.data.dmn-lcc-private-sector-long-term-empties" ,
"key" : "Ward" ,
"colour" : "2019_rank" ,
"scale" : "Viridis" ,
"stroke-width" : 0.75 ,
"reverse" : true ,
"columns" : [{
"name" : "2009" ,
"template" : "{{ Jan-09 % }}"
},{
"name" : "2010" ,
"template" : "{{ Jan-10 % }}"
},{
"name" : "2011" ,
"template" : "{{ Jan-11 % }}"
},{
"name" : "2012" ,
"template" : "{{ Jan-12 % }}"
},{
"name" : "2013" ,
"template" : "{{ Jan-13 % }}"
},{
"name" : "2014" ,
"template" : "{{ Jan-14 % }}"
},{
"name" : "2015" ,
"template" : "{{ Jan-15 % }}"
},{
"name" : "2016" ,
"template" : "{{ Jan-16 % }}"
},{
"name" : "2017" ,
"template" : "{{ Jan-17 % }}"
},{
"name" : "2018" ,
"template" : "{{ Jan-18 % }}"
},{
"name" : "2019" ,
"template" : "{{ Jan-19 % }}"
}]
}