Skip to main content
This site and Lume package is currently under development and may not be stable.

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

  1. Simple ranking chart
  2. Customise the lines
  3. Coloured lines
  4. Lines coloured using a scale
  5. Add a legend
  6. Limit to the top x entries
  7. Limit to the bottom x entries
  8. 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.

<strong>Switzerland</strong>: 2018: 1st; 2019: 1st; 2020: 1stSwitzerland<strong>Iceland</strong>: 2018: 2nd; 2019: 2nd; 2020: 2ndIceland<strong>Netherlands</strong>: 2018: 3rd; 2019: 3rd; 2020: 4thNetherlands<strong>Germany</strong>: 2018: 4th; 2019: 4th; 2020: 3rdGermany<strong>Japan</strong>: 2018: 5th; 2019: 5th; 2020: 5thJapan<strong>Slovenia</strong>: 2018: 6th; 2019: 6th; 2020: 16thSlovenia<strong>Austria</strong>: 2018: 7th; 2019: 8th; 2020: 6thAustria<strong>Lithuania</strong>: 2018: 8th; 2019: 7th; 2020: 14thLithuania<strong>Estonia</strong>: 2018: 9th; 2019: 9th; 2020: 15thEstonia<strong>Latvia</strong>: 2018: 10th; 2019: 14th; 2020: 9thLatvia<strong>Australia</strong>: 2018: 11th; 2019: 10th; 2020: 11thAustralia<strong>Denmark</strong>: 2018: 12th; 2019: 11th; 2020: 7thDenmark<strong>Norway</strong>: 2018: 13th; 2019: 13th; 2020: 8thNorway<strong>Czech Republic</strong>: 2018: 14th; 2019: 12th; 2020: 10thCzech Republic<strong>United States</strong>: 2018: 15th; 2019: 15th; 2020: 13thUnited States<strong>New Zealand</strong>: 2018: 16th; 2019: 18th; 2020: 12thNew Zealand<strong>Sweden</strong>: 2018: 17th; 2019: 21st; 2020: 20thSweden<strong>Canada</strong>: 2018: 18th; 2019: 17th; 2020: 26thCanada<strong>Finland</strong>: 2018: 19th; 2019: 19th; 2020: 22ndFinland<strong>Poland</strong>: 2018: 20th; 2019: 16th; 2020: 17thPoland<strong>United Kingdom</strong>: 2018: 21st; 2019: 20th; 2020: 18thUnited Kingdom<strong>Israel</strong>: 2018: 22nd; 2019: 22nd; 2020: 19thIsrael<strong>Ireland</strong>: 2018: 23rd; 2019: 23rd; 2020: 24thIreland<strong>Korea</strong>: 2018: 24th; 2019: 25th; 2020: 23rdKorea<strong>Luxembourg</strong>: 2018: 25th; 2019: 28th; 2020: 31stLuxembourg<strong>Hungary</strong>: 2018: 26th; 2019: 26th; 2020: 25thHungary<strong>Belgium</strong>: 2018: 27th; 2019: 24th; 2020: 21stBelgium<strong>Slovak Republic</strong>: 2018: 28th; 2019: 29th; 2020: 29thSlovak Republic<strong>Mexico</strong>: 2018: 29th; 2019: 31st; 2020: 27thMexico<strong>France</strong>: 2018: 30th; 2019: 30th; 2020: 28thFrance<strong>Portugal</strong>: 2018: 31st; 2019: 27th; 2020: 30thPortugal<strong>Chile</strong>: 2018: 32nd; 2019: 32nd; 2020: 32ndChile<strong>Colombia</strong>: 2018: 33rd; 2019: 34th; 2020: 37thColombia<strong>Turkey</strong>: 2018: 34th; 2019: 35th; 2020: 35thTurkey<strong>Costa Rica</strong>: 2018: 35th; 2019: 36th; 2020: 36thCosta Rica<strong>Spain</strong>: 2018: 36th; 2019: 33rd; 2020: 33rdSpain<strong>Greece</strong>: 2018: 37th; 2019: 37th; 2020: 34thGreece<strong>Italy</strong>: 2018: 38th; 2019: 38th; 2020: 38thItaly201820192020

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).

<strong>Switzerland</strong>: 2018: 1st; 2019: 1st; 2020: 1stSwitzerland111<strong>Iceland</strong>: 2018: 2nd; 2019: 2nd; 2020: 2ndIceland222<strong>Netherlands</strong>: 2018: 3rd; 2019: 3rd; 2020: 4thNetherlands334<strong>Germany</strong>: 2018: 4th; 2019: 4th; 2020: 3rdGermany443<strong>Japan</strong>: 2018: 5th; 2019: 5th; 2020: 5thJapan555<strong>Slovenia</strong>: 2018: 6th; 2019: 6th; 2020: 16thSlovenia6616<strong>Austria</strong>: 2018: 7th; 2019: 8th; 2020: 6thAustria786<strong>Lithuania</strong>: 2018: 8th; 2019: 7th; 2020: 14thLithuania8714<strong>Estonia</strong>: 2018: 9th; 2019: 9th; 2020: 15thEstonia9915<strong>Latvia</strong>: 2018: 10th; 2019: 14th; 2020: 9thLatvia10149<strong>Australia</strong>: 2018: 11th; 2019: 10th; 2020: 11thAustralia111011<strong>Denmark</strong>: 2018: 12th; 2019: 11th; 2020: 7thDenmark12117<strong>Norway</strong>: 2018: 13th; 2019: 13th; 2020: 8thNorway13138<strong>Czech Republic</strong>: 2018: 14th; 2019: 12th; 2020: 10thCzech Republic141210<strong>United States</strong>: 2018: 15th; 2019: 15th; 2020: 13thUnited States151513<strong>New Zealand</strong>: 2018: 16th; 2019: 18th; 2020: 12thNew Zealand161812<strong>Sweden</strong>: 2018: 17th; 2019: 21st; 2020: 20thSweden172120<strong>Canada</strong>: 2018: 18th; 2019: 17th; 2020: 26thCanada181726<strong>Finland</strong>: 2018: 19th; 2019: 19th; 2020: 22ndFinland191922<strong>Poland</strong>: 2018: 20th; 2019: 16th; 2020: 17thPoland201617<strong>United Kingdom</strong>: 2018: 21st; 2019: 20th; 2020: 18thUnited Kingdom212018<strong>Israel</strong>: 2018: 22nd; 2019: 22nd; 2020: 19thIsrael222219<strong>Ireland</strong>: 2018: 23rd; 2019: 23rd; 2020: 24thIreland232324<strong>Korea</strong>: 2018: 24th; 2019: 25th; 2020: 23rdKorea242523<strong>Luxembourg</strong>: 2018: 25th; 2019: 28th; 2020: 31stLuxembourg252831<strong>Hungary</strong>: 2018: 26th; 2019: 26th; 2020: 25thHungary262625<strong>Belgium</strong>: 2018: 27th; 2019: 24th; 2020: 21stBelgium272421<strong>Slovak Republic</strong>: 2018: 28th; 2019: 29th; 2020: 29thSlovak Republic282929<strong>Mexico</strong>: 2018: 29th; 2019: 31st; 2020: 27thMexico293127<strong>France</strong>: 2018: 30th; 2019: 30th; 2020: 28thFrance303028<strong>Portugal</strong>: 2018: 31st; 2019: 27th; 2020: 30thPortugal312730<strong>Chile</strong>: 2018: 32nd; 2019: 32nd; 2020: 32ndChile323232<strong>Colombia</strong>: 2018: 33rd; 2019: 34th; 2020: 37thColombia333437<strong>Turkey</strong>: 2018: 34th; 2019: 35th; 2020: 35thTurkey343535<strong>Costa Rica</strong>: 2018: 35th; 2019: 36th; 2020: 36thCosta Rica353636<strong>Spain</strong>: 2018: 36th; 2019: 33rd; 2020: 33rdSpain363333<strong>Greece</strong>: 2018: 37th; 2019: 37th; 2020: 34thGreece373734<strong>Italy</strong>: 2018: 38th; 2019: 38th; 2020: 38thItaly383838201820192020

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

<strong>Switzerland</strong>: 2018: 1st; 2019: 1st; 2020: 1stSwitzerland111<strong>Iceland</strong>: 2018: 2nd; 2019: 2nd; 2020: 2ndIceland222<strong>Netherlands</strong>: 2018: 3rd; 2019: 3rd; 2020: 4thNetherlands334<strong>Germany</strong>: 2018: 4th; 2019: 4th; 2020: 3rdGermany443<strong>Japan</strong>: 2018: 5th; 2019: 5th; 2020: 5thJapan555<strong>Slovenia</strong>: 2018: 6th; 2019: 6th; 2020: 16thSlovenia6616<strong>Austria</strong>: 2018: 7th; 2019: 8th; 2020: 6thAustria786<strong>Lithuania</strong>: 2018: 8th; 2019: 7th; 2020: 14thLithuania8714<strong>Estonia</strong>: 2018: 9th; 2019: 9th; 2020: 15thEstonia9915<strong>Latvia</strong>: 2018: 10th; 2019: 14th; 2020: 9thLatvia10149<strong>Australia</strong>: 2018: 11th; 2019: 10th; 2020: 11thAustralia111011<strong>Denmark</strong>: 2018: 12th; 2019: 11th; 2020: 7thDenmark12117<strong>Norway</strong>: 2018: 13th; 2019: 13th; 2020: 8thNorway13138<strong>Czech Republic</strong>: 2018: 14th; 2019: 12th; 2020: 10thCzech Republic141210<strong>United States</strong>: 2018: 15th; 2019: 15th; 2020: 13thUnited States151513<strong>New Zealand</strong>: 2018: 16th; 2019: 18th; 2020: 12thNew Zealand161812<strong>Sweden</strong>: 2018: 17th; 2019: 21st; 2020: 20thSweden172120<strong>Canada</strong>: 2018: 18th; 2019: 17th; 2020: 26thCanada181726<strong>Finland</strong>: 2018: 19th; 2019: 19th; 2020: 22ndFinland191922<strong>Poland</strong>: 2018: 20th; 2019: 16th; 2020: 17thPoland201617<strong>United Kingdom</strong>: 2018: 21st; 2019: 20th; 2020: 18thUnited Kingdom212018<strong>Israel</strong>: 2018: 22nd; 2019: 22nd; 2020: 19thIsrael222219<strong>Ireland</strong>: 2018: 23rd; 2019: 23rd; 2020: 24thIreland232324<strong>Korea</strong>: 2018: 24th; 2019: 25th; 2020: 23rdKorea242523<strong>Luxembourg</strong>: 2018: 25th; 2019: 28th; 2020: 31stLuxembourg252831<strong>Hungary</strong>: 2018: 26th; 2019: 26th; 2020: 25thHungary262625<strong>Belgium</strong>: 2018: 27th; 2019: 24th; 2020: 21stBelgium272421<strong>Slovak Republic</strong>: 2018: 28th; 2019: 29th; 2020: 29thSlovak Republic282929<strong>Mexico</strong>: 2018: 29th; 2019: 31st; 2020: 27thMexico293127<strong>France</strong>: 2018: 30th; 2019: 30th; 2020: 28thFrance303028<strong>Portugal</strong>: 2018: 31st; 2019: 27th; 2020: 30thPortugal312730<strong>Chile</strong>: 2018: 32nd; 2019: 32nd; 2020: 32ndChile323232<strong>Colombia</strong>: 2018: 33rd; 2019: 34th; 2020: 37thColombia333437<strong>Turkey</strong>: 2018: 34th; 2019: 35th; 2020: 35thTurkey343535<strong>Costa Rica</strong>: 2018: 35th; 2019: 36th; 2020: 36thCosta Rica353636<strong>Spain</strong>: 2018: 36th; 2019: 33rd; 2020: 33rdSpain363333<strong>Greece</strong>: 2018: 37th; 2019: 37th; 2020: 34thGreece373734<strong>Italy</strong>: 2018: 38th; 2019: 38th; 2020: 38thItaly383838201820192020

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.

<strong>Switzerland</strong>: 2018: 1st; 2019: 1st; 2020: 1stSwitzerland<strong>Iceland</strong>: 2018: 2nd; 2019: 2nd; 2020: 2ndIceland<strong>Netherlands</strong>: 2018: 3rd; 2019: 3rd; 2020: 4thNetherlands<strong>Germany</strong>: 2018: 4th; 2019: 4th; 2020: 3rdGermany<strong>Japan</strong>: 2018: 5th; 2019: 5th; 2020: 5thJapan<strong>Slovenia</strong>: 2018: 6th; 2019: 6th; 2020: 16thSlovenia<strong>Austria</strong>: 2018: 7th; 2019: 8th; 2020: 6thAustria<strong>Lithuania</strong>: 2018: 8th; 2019: 7th; 2020: 14thLithuania<strong>Estonia</strong>: 2018: 9th; 2019: 9th; 2020: 15thEstonia<strong>Latvia</strong>: 2018: 10th; 2019: 14th; 2020: 9thLatvia<strong>Australia</strong>: 2018: 11th; 2019: 10th; 2020: 11thAustralia<strong>Denmark</strong>: 2018: 12th; 2019: 11th; 2020: 7thDenmark<strong>Norway</strong>: 2018: 13th; 2019: 13th; 2020: 8thNorway<strong>Czech Republic</strong>: 2018: 14th; 2019: 12th; 2020: 10thCzech Republic<strong>United States</strong>: 2018: 15th; 2019: 15th; 2020: 13thUnited States<strong>New Zealand</strong>: 2018: 16th; 2019: 18th; 2020: 12thNew Zealand<strong>Sweden</strong>: 2018: 17th; 2019: 21st; 2020: 20thSweden<strong>Canada</strong>: 2018: 18th; 2019: 17th; 2020: 26thCanada<strong>Finland</strong>: 2018: 19th; 2019: 19th; 2020: 22ndFinland<strong>Poland</strong>: 2018: 20th; 2019: 16th; 2020: 17thPoland<strong>United Kingdom</strong>: 2018: 21st; 2019: 20th; 2020: 18thUnited Kingdom<strong>Israel</strong>: 2018: 22nd; 2019: 22nd; 2020: 19thIsrael<strong>Ireland</strong>: 2018: 23rd; 2019: 23rd; 2020: 24thIreland<strong>Korea</strong>: 2018: 24th; 2019: 25th; 2020: 23rdKorea<strong>Luxembourg</strong>: 2018: 25th; 2019: 28th; 2020: 31stLuxembourg<strong>Hungary</strong>: 2018: 26th; 2019: 26th; 2020: 25thHungary<strong>Belgium</strong>: 2018: 27th; 2019: 24th; 2020: 21stBelgium<strong>Slovak Republic</strong>: 2018: 28th; 2019: 29th; 2020: 29thSlovak Republic<strong>Mexico</strong>: 2018: 29th; 2019: 31st; 2020: 27thMexico<strong>France</strong>: 2018: 30th; 2019: 30th; 2020: 28thFrance<strong>Portugal</strong>: 2018: 31st; 2019: 27th; 2020: 30thPortugal<strong>Chile</strong>: 2018: 32nd; 2019: 32nd; 2020: 32ndChile<strong>Colombia</strong>: 2018: 33rd; 2019: 34th; 2020: 37thColombia<strong>Turkey</strong>: 2018: 34th; 2019: 35th; 2020: 35thTurkey<strong>Costa Rica</strong>: 2018: 35th; 2019: 36th; 2020: 36thCosta Rica<strong>Spain</strong>: 2018: 36th; 2019: 33rd; 2020: 33rdSpain<strong>Greece</strong>: 2018: 37th; 2019: 37th; 2020: 34thGreece<strong>Italy</strong>: 2018: 38th; 2019: 38th; 2020: 38thItaly201820192020

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.

1
10
20
30
40
<strong>Switzerland</strong>: 2018: 1st; 2019: 1st; 2020: 1stSwitzerland<strong>Iceland</strong>: 2018: 2nd; 2019: 2nd; 2020: 2ndIceland<strong>Netherlands</strong>: 2018: 3rd; 2019: 3rd; 2020: 4thNetherlands<strong>Germany</strong>: 2018: 4th; 2019: 4th; 2020: 3rdGermany<strong>Japan</strong>: 2018: 5th; 2019: 5th; 2020: 5thJapan<strong>Slovenia</strong>: 2018: 6th; 2019: 6th; 2020: 16thSlovenia<strong>Austria</strong>: 2018: 7th; 2019: 8th; 2020: 6thAustria<strong>Lithuania</strong>: 2018: 8th; 2019: 7th; 2020: 14thLithuania<strong>Estonia</strong>: 2018: 9th; 2019: 9th; 2020: 15thEstonia<strong>Latvia</strong>: 2018: 10th; 2019: 14th; 2020: 9thLatvia<strong>Australia</strong>: 2018: 11th; 2019: 10th; 2020: 11thAustralia<strong>Denmark</strong>: 2018: 12th; 2019: 11th; 2020: 7thDenmark<strong>Norway</strong>: 2018: 13th; 2019: 13th; 2020: 8thNorway<strong>Czech Republic</strong>: 2018: 14th; 2019: 12th; 2020: 10thCzech Republic<strong>United States</strong>: 2018: 15th; 2019: 15th; 2020: 13thUnited States<strong>New Zealand</strong>: 2018: 16th; 2019: 18th; 2020: 12thNew Zealand<strong>Sweden</strong>: 2018: 17th; 2019: 21st; 2020: 20thSweden<strong>Canada</strong>: 2018: 18th; 2019: 17th; 2020: 26thCanada<strong>Finland</strong>: 2018: 19th; 2019: 19th; 2020: 22ndFinland<strong>Poland</strong>: 2018: 20th; 2019: 16th; 2020: 17thPoland<strong>United Kingdom</strong>: 2018: 21st; 2019: 20th; 2020: 18thUnited Kingdom<strong>Israel</strong>: 2018: 22nd; 2019: 22nd; 2020: 19thIsrael<strong>Ireland</strong>: 2018: 23rd; 2019: 23rd; 2020: 24thIreland<strong>Korea</strong>: 2018: 24th; 2019: 25th; 2020: 23rdKorea<strong>Luxembourg</strong>: 2018: 25th; 2019: 28th; 2020: 31stLuxembourg<strong>Hungary</strong>: 2018: 26th; 2019: 26th; 2020: 25thHungary<strong>Belgium</strong>: 2018: 27th; 2019: 24th; 2020: 21stBelgium<strong>Slovak Republic</strong>: 2018: 28th; 2019: 29th; 2020: 29thSlovak Republic<strong>Mexico</strong>: 2018: 29th; 2019: 31st; 2020: 27thMexico<strong>France</strong>: 2018: 30th; 2019: 30th; 2020: 28thFrance<strong>Portugal</strong>: 2018: 31st; 2019: 27th; 2020: 30thPortugal<strong>Chile</strong>: 2018: 32nd; 2019: 32nd; 2020: 32ndChile<strong>Colombia</strong>: 2018: 33rd; 2019: 34th; 2020: 37thColombia<strong>Turkey</strong>: 2018: 34th; 2019: 35th; 2020: 35thTurkey<strong>Costa Rica</strong>: 2018: 35th; 2019: 36th; 2020: 36thCosta Rica<strong>Spain</strong>: 2018: 36th; 2019: 33rd; 2020: 33rdSpain<strong>Greece</strong>: 2018: 37th; 2019: 37th; 2020: 34thGreece<strong>Italy</strong>: 2018: 38th; 2019: 38th; 2020: 38thItaly201820192020

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.

<strong>Switzerland</strong>: 2018: 1st; 2019: 1st; 2020: 1stSwitzerland111<strong>Iceland</strong>: 2018: 2nd; 2019: 2nd; 2020: 2ndIceland222<strong>Netherlands</strong>: 2018: 3rd; 2019: 3rd; 2020: 4thNetherlands334<strong>Germany</strong>: 2018: 4th; 2019: 4th; 2020: 3rdGermany443<strong>Japan</strong>: 2018: 5th; 2019: 5th; 2020: 5thJapan555<strong>Slovenia</strong>: 2018: 6th; 2019: 6th; 2020: 16thSlovenia6616<strong>Austria</strong>: 2018: 7th; 2019: 8th; 2020: 6thAustria786<strong>Lithuania</strong>: 2018: 8th; 2019: 7th; 2020: 14thLithuania8714<strong>Estonia</strong>: 2018: 9th; 2019: 9th; 2020: 15thEstonia9915<strong>Latvia</strong>: 2018: 10th; 2019: 14th; 2020: 9thLatvia10149<strong>Australia</strong>: 2018: 11th; 2019: 10th; 2020: 11thAustralia111011<strong>Denmark</strong>: 2018: 12th; 2019: 11th; 2020: 7thDenmark12117<strong>Norway</strong>: 2018: 13th; 2019: 13th; 2020: 8thNorway13138<strong>Czech Republic</strong>: 2018: 14th; 2019: 12th; 2020: 10thCzech Republic141210201820192020

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.

<strong>Italy</strong>: 2018: 1st; 2019: 1st; 2020: 1stItaly111<strong>Greece</strong>: 2018: 2nd; 2019: 2nd; 2020: 5thGreece225<strong>Spain</strong>: 2018: 3rd; 2019: 6th; 2020: 6thSpain366<strong>Costa Rica</strong>: 2018: 4th; 2019: 3rd; 2020: 3rdCosta Rica433<strong>Turkey</strong>: 2018: 5th; 2019: 4th; 2020: 4thTurkey544<strong>Colombia</strong>: 2018: 6th; 2019: 5th; 2020: 2ndColombia652<strong>Chile</strong>: 2018: 7th; 2019: 7th; 2020: 7thChile777<strong>Portugal</strong>: 2018: 8th; 2019: 12th; 2020: 9thPortugal8129<strong>France</strong>: 2018: 9th; 2019: 9th; 2020: 11thFrance9911<strong>Mexico</strong>: 2018: 10th; 2019: 8th; 2020: 12thMexico10812<strong>Slovak Republic</strong>: 2018: 11th; 2019: 10th; 2020: 10thSlovak Republic111010<strong>Luxembourg</strong>: 2018: 14th; 2019: 11th; 2020: 8thLuxembourg14118201820192020

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.

<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: 3rdCity 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: 1stHeadingley<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: 2ndHyde 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: 8thBeeston 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: 5thGipton 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: 6thChapel 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 9thArmley<strong>Kirkstall</strong>: 2009: 8th; 2010: 8th; 2011: 4th; 2012: 6th; 2013: 8th; 2014: 6th; 2015: 9th; 2016: 10th; 2017: 6th; 2018: 4th; 2019: 4thKirkstall<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: 19thGuiseley 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 9thWeetwood<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: 12thRoundhay<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: 11thBurmantofts 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: 7thHarewood<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: 15thWetherby<strong>Alwoodley</strong>: 2009: 15th; 2010: 17th; 2011: 14th; 2012: 15th; 2013: 15th; 2014: 14th; 2015: 17th; 2016: 11th; 2017: 11th; 2018: 16th; 2019: 17thAlwoodley<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: 14thCalverley 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: 16thAdel 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: 13thOtley 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: 25thKillingbeck 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: 28thMorley 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: 21stMoortown<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: 20thHorsforth<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: 18thPudsey<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: 31stFarnley 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 26thKippax 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 22ndArdsley 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 22ndMorley 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 22ndGarforth 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: 29thRothwell<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 26thBramley 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: 32ndCross 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: 30thTemple 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: 33rdMiddleton Park20092010201120122013201420152016201720182019

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 % }}"
		}]
}