Euro indicators 3 October 2024 Next release: 6 November 2024
August 2024 compared with July 2024
Skip to the content
Down by 2.3% in the euro area and by 2.1% in the EU compared with August 2023
Overview
In August 2024, compared with July 2024, industrial producer prices increased by 0.6% in the euro area and by 0.4% in the EU, according to first estimates from Eurostat, the statistical office of the European Union. In July 2024, industrial producer prices grew by 0.7% in the euro area and by 0.8% in the EU.
In August 2024, compared with August 2023, industrial producer prices decreased by 2.3% the euro area and by 2.1% in the EU.
Monthly comparison by main industrial grouping and by Member State
In the euro area in August 2024, compared with July 2024, industrial producer prices
decreased by 0.1% for intermediate goods,
increased by 1.9% for energy,
increased by 0.1% for capital goods,
remained stable for durable consumer goods,
remained stable for non-durable consumer goods.
Prices in total industry excluding energy decreased by 0.1%.
In the EU, industrial producer prices
decreased by 0.1% for intermediate goods,
increased by 1.1% for energy,
increased by 0.2% for capital goods,
decreased by 0.1% for durable consumer goods,
increased by 0.1% for non-durable consumer goods.
Prices in total industry excluding energy remained stable.
The highest monthly increases in industrial producer prices were recorded in Estonia (+2.2%), Greece (+1.7%) and Spain (+1.5%). The largest decreases were observed in Ireland (-3.8%), Lithuania (-1.7%) and Romania (-1.6%).
Annual comparison by main industrial grouping and by Member State
In the euro area in August 2024, compared with August 2023, industrial producer prices
decreased by 0.8% for intermediate goods,
decreased by 7.7% for energy,
increased by 1.4% for capital goods,
increased by 0.3% for durable consumer goods,
increased by 1.1% for non-durable consumer goods.
Prices in total industry excluding energy increased by 0.3%.
In the EU, industrial producer prices
decreased by 0.8% for intermediate goods,
decreased by 7.0% for energy,
increased by 1.7% for capital goods,
increased by 0.1% for durable consumer goods,
increased by 1.0% for non-durable consumer goods.
Prices in total industry excluding energy increased by 0.4%.
The largest annual decreases in industrial producer prices were recorded in Slovakia (-18.3%), Luxembourg (-6.9%) and France (-6.3%). The highest increases were observed in Romania (+2.8%), Bulgaria and Portugal (both +1.9%) and Estonia (+1.7%).
Tables
Industrial producer prices on the domestic market % change compared with previous month | ||||||
---|---|---|---|---|---|---|
Mar-24 | Apr-24 | May-24 | Jun-24 | Jul-24 | Aug-24 | |
Euro area | ||||||
Total industry | -0.6 | -0.9 | -0.2 | 0.6 | 0.7 | 0.6 |
Total industry excluding energy | 0.3 | 0.2 | 0.2 | 0.1 | 0.0 | -0.1 |
Intermediate goods | 0.2 | 0.3 | 0.1 | 0.1 | 0.0 | -0.1 |
Energy | -2.4 | -3.7 | -1.1 | 1.7 | 2.6 | 1.9 |
Capital goods | 0.1 | 0.1 | 0.2 | 0.1 | 0.0 | 0.1 |
Durable consumer goods | 0.2 | 0.2 | -0.3 | 0.0 | -0.1 | 0.0 |
Non-durable consumer goods | 0.5 | 0.2 | 0.2 | 0.1 | 0.0 | 0.0 |
EU | ||||||
Total industry | -0.6 | -0.7 | -0.2 | 0.5 | 0.8 | 0.4 |
Total industry excluding energy | 0.3 | 0.2 | 0.2 | 0.1 | 0.0 | 0.0 |
Intermediate goods | 0.3 | 0.3 | 0.1 | 0.0 | 0.0 | -0.1 |
Energy | -2.5 | -2.6 | -1.2 | 1.6 | 2.5 | 1.1 |
Capital goods | 0.1 | 0.2 | 0.1 | 0.1 | 0.0 | 0.2 |
Durable consumer goods | 0.2 | 0.2 | -0.3 | 0.1 | -0.1 | -0.1 |
Non-durable consumer goods | 0.5 | 0.2 | 0.2 | 0.2 | -0.1 | 0.1 |
Source dataset: sts_inppd_m |
Industrial producer prices on the domestic market % change compared with previous month | ||||||
---|---|---|---|---|---|---|
Mar-24 | Apr-24 | May-24 | Jun-24 | Jul-24 | Aug-24 | |
Euro area | -0.6 | -0.9 | -0.2 | 0.6 | 0.7 | 0.6 |
EU | -0.6 | -0.7 | -0.2 | 0.5 | 0.8 | 0.4 |
Belgium | 0.2 | 0.3 | -0.9 | 0.6 | 0.2 | -0.1 |
Bulgaria | -3.4 | -0.8 | 4.5 | -1.0 | 3.6 | 1.0 |
Czechia | 0.0 | 0.2 | -1.2 | -0.3 | 0.5 | -0.4 |
Denmark | -2.3 | 2.8 | -0.7 | 1.4 | 0.1 | 1.3 |
Germany | 0.2 | 0.2 | -0.1 | 0.1 | 0.2 | 0.2 |
Estonia | -0.9 | -0.3 | 2.1 | 2.2 | 0.0 | 2.2 |
Ireland | 0.9 | 0.8 | 7.7 | -0.1 | 1.1 | -3.8 |
Greece | -2.3 | -1.8 | -2.9 | 1.8 | 2.9 | 1.7 |
Spain | -2.2 | -0.3 | 0.9 | 2.2 | 1.5 | 1.5 |
France | -1.2 | -3.6 | -1.7 | -0.3 | 0.3 | 0.2 |
Croatia | 0.2 | -1.9 | -4.1 | 0.9 | 1.7 | -0.5 |
Italy | -0.4 | -1.4 | 0.3 | 1.0 | 2.0 | 1.2 |
Cyprus | -0.6 | 0.2 | 1.2 | 0.1 | 1.0 | 0.0 |
Latvia | -1.1 | -0.1 | 0.4 | 0.4 | -0.5 | 0.4 |
Lithuania | -2.0 | 0.0 | -1.6 | 0.5 | 0.7 | -1.7 |
Luxembourg | -0.4 | -4.1 | 0.0 | -0.1 | 0.1 | -0.3 |
Hungary | -0.3 | -0.3 | -0.9 | 1.2 | 2.0 | 0.2 |
Malta | 0.0 | 0.0 | -0.1 | 0.0 | 0.0 | 0.0 |
Netherlands | 0.2 | -0.7 | -0.5 | 0.2 | -0.3 | -0.1 |
Austria | -1.3 | -0.8 | 0.3 | 0.2 | -0.2 | 0.5 |
Poland | -0.3 | 0.2 | -0.2 | 0.6 | 0.2 | -0.7 |
Portugal | -0.5 | -0.3 | 0.3 | 1.6 | 1.3 | -0.1 |
Romania | -2.6 | -0.2 | 0.6 | 1.9 | 2.5 | -1.6 |
Slovenia | -0.1 | 0.1 | 0.1 | -0.2 | 0.1 | 0.2 |
Slovakia | -0.5 | -0.5 | 0.5 | 1.4 | 1.9 | 0.4 |
Finland | -0.4 | 0.3 | -0.9 | -0.3 | -0.7 | -0.9 |
Sweden | 0.9 | -0.6 | -1.8 | -0.1 | -0.9 | -0.7 |
Norway | 1.2 | 0.0 | -1.7 | -0.2 | 0.4 | -0.8 |
Switzerland | 0.1 | 0.0 | 0.4 | 0.0 | 0.3 | -0.4 |
Source dataset: sts_inppd_m |
Industrial producer prices on the domestic market % change compared with same month of previous year | ||||||
---|---|---|---|---|---|---|
Mar-24 | Apr-24 | May-24 | Jun-24 | Jul-24 | Aug-24 | |
Euro area | ||||||
Total industry | -7.7 | -5.6 | -4.2 | -3.3 | -2.2 | -2.3 |
Total industry excluding energy | -1.3 | -1.0 | -0.5 | -0.2 | 0.3 | 0.3 |
Intermediate goods | -4.9 | -3.9 | -3.1 | -2.3 | -1.1 | -0.8 |
Energy | -20.4 | -15.0 | -11.8 | -9.8 | -7.3 | -7.7 |
Capital goods | 1.9 | 1.5 | 1.7 | 1.6 | 1.4 | 1.4 |
Durable consumer goods | 1.1 | 1.2 | 0.6 | 0.7 | 0.3 | 0.3 |
Non-durable consumer goods | 1.1 | 0.7 | 1.0 | 1.1 | 1.1 | 1.1 |
EU | ||||||
Total industry | -7.5 | -5.5 | -4.0 | -3.2 | -1.9 | -2.1 |
Total industry excluding energy | -1.4 | -1.2 | -0.6 | -0.3 | 0.3 | 0.4 |
Intermediate goods | -5.0 | -4.1 | -3.1 | -2.3 | -1.2 | -0.8 |
Energy | -19.0 | -13.7 | -10.5 | -8.7 | -6.1 | -7.0 |
Capital goods | 1.9 | 1.7 | 1.7 | 1.7 | 1.5 | 1.7 |
Durable consumer goods | 0.5 | 0.6 | 0.2 | 0.3 | 0.2 | 0.1 |
Non-durable consumer goods | 0.7 | 0.5 | 0.7 | 0.9 | 0.9 | 1.0 |
Source dataset: sts_inppd_m |
Industrial producer prices on the domestic market % change compared with same month of previous year | ||||||
---|---|---|---|---|---|---|
Mar-24 | Apr-24 | May-24 | Jun-24 | Jul-24 | Aug-24 | |
Euro area | -7.7 | -5.6 | -4.2 | -3.3 | -2.2 | -2.3 |
EU | -7.5 | -5.5 | -4.0 | -3.2 | -1.9 | -2.1 |
Belgium | -10.4 | -3.0 | -2.7 | -1.3 | -0.5 | -1.3 |
Bulgaria | -12.8 | -10.6 | -4.2 | -2.8 | 0.9 | 1.9 |
Czechia | 0.0 | 1.4 | 1.0 | 1.0 | 1.7 | 1.2 |
Denmark | -6.9 | -4.4 | -4.2 | -2.9 | -1.7 | -0.8 |
Germany | -2.9 | -3.2 | -2.3 | -1.9 | -1.1 | -1.1 |
Estonia | -7.7 | -7.0 | -3.8 | -2.3 | -0.7 | 1.7 |
Ireland | -19.8 | -13.7 | 0.4 | -3.5 | 6.1 | -1.6 |
Greece | -1.3 | -3.3 | -3.8 | -2.4 | -0.5 | -0.7 |
Spain | -8.2 | -6.7 | -4.5 | -3.2 | -1.6 | -1.3 |
France | -8.2 | -6.6 | -6.9 | -6.1 | -5.7 | -6.3 |
Croatia | -2.0 | -2.0 | -4.4 | -4.8 | -4.5 | -5.6 |
Italy | -12.7 | -8.0 | -4.9 | -3.5 | -1.6 | -1.1 |
Cyprus | -4.2 | -4.2 | -2.3 | -2.1 | -0.5 | -0.3 |
Latvia | -12.1 | -9.2 | -6.7 | -4.0 | -6.4 | -5.6 |
Lithuania | -5.4 | -2.5 | -1.8 | -1.1 | -0.9 | -3.6 |
Luxembourg | -14.9 | -11.1 | -10.8 | -10.6 | -6.7 | -6.9 |
Hungary | -5.4 | -5.0 | -3.9 | -0.3 | 1.3 | 1.2 |
Malta | 0.7 | 0.8 | 0.5 | 0.2 | 0.2 | 0.2 |
Netherlands | -8.1 | -5.2 | -4.0 | -3.4 | -1.3 | -2.6 |
Austria | -10.3 | -8.6 | -6.5 | -5.1 | -4.5 | -4.5 |
Poland | -9.9 | -8.3 | -6.8 | -5.7 | -4.3 | -4.9 |
Portugal | -1.7 | -1.1 | 0.4 | 2.5 | 2.0 | 1.9 |
Romania | -11.0 | -5.7 | -2.2 | 0.9 | 2.5 | 2.8 |
Slovenia | -3.7 | -3.8 | -3.1 | -2.7 | -2.8 | -1.9 |
Slovakia | -24.6 | -22.8 | -20.7 | -19.0 | -18.9 | -18.3 |
Finland | -4.3 | -2.1 | 0.0 | -0.9 | -1.0 | -4.2 |
Sweden | -0.4 | 0.6 | 1.3 | -0.1 | 1.0 | 0.3 |
Norway | 2.8 | 3.1 | 2.8 | 2.4 | 3.1 | 1.5 |
Switzerland | 1.6 | 1.6 | 1.0 | 0.8 | 1.0 | 0.4 |
Source dataset: sts_inppd_m |
Industrial producer prices indices on the domestic market for total industry | ||||||
---|---|---|---|---|---|---|
Mar-24 | Apr-24 | May-24 | Jun-24 | Jul-24 | Aug-24 | |
Euro area | 124.0 | 122.9 | 122.6 | 123.3 | 124.2 | 124.9 |
EU | 125.5 | 124.6 | 124.3 | 124.9 | 125.9 | 126.4 |
Belgium | 117.6 | 117.9 | 116.8 | 117.5 | 117.7 | 117.6 |
Bulgaria | 117.7 | 116.7 | 122.0 | 120.8 | 125.1 | 126.3 |
Czechia | 132.4 | 132.7 | 131.1 | 130.7 | 131.4 | 130.9 |
Denmark | 136.9 | 140.8 | 139.8 | 141.7 | 141.9 | 143.8 |
Germany | 128.2 | 128.4 | 128.3 | 128.4 | 128.6 | 128.9 |
Estonia | 126.9 | 126.5 | 129.1 | 132.0 | 132.0 | 134.9 |
Ireland | 88.9 | 89.6 | 96.5 | 96.4 | 97.5 | 93.8 |
Greece | 121.2 | 119.0 | 115.5 | 117.6 | 121.0 | 123.1 |
Spain | 120.3 | 119.9 | 121.0 | 123.7 | 125.6 | 127.5 |
France | 126.7 | 122.2 | 120.1 | 119.7 | 120.0 | 120.2 |
Croatia | 132.7 | 130.2 | 124.8 | 125.9 | 128.0 | 127.4 |
Italy | 121.3 | 119.6 | 119.9 | 121.1 | 123.5 | 125.0 |
Cyprus | 123.8 | 124.0 | 125.5 | 125.6 | 126.8 | 126.8 |
Latvia | 139.8 | 139.6 | 140.2 | 140.8 | 140.1 | 140.6 |
Lithuania | 137.8 | 137.8 | 135.6 | 136.3 | 137.3 | 135.0 |
Luxembourg | 158.8 | 152.3 | 152.3 | 152.2 | 152.4 | 151.9 |
Hungary | 180.3 | 179.8 | 178.2 | 180.4 | 184.0 | 184.4 |
Malta | 108.9 | 108.9 | 108.8 | 108.8 | 108.8 | 108.8 |
Netherlands | 122.9 | 122.0 | 121.4 | 121.7 | 121.3 | 121.2 |
Austria | 120.9 | 119.9 | 120.2 | 120.4 | 120.2 | 120.8 |
Poland | 125.0 | 125.3 | 125.0 | 125.8 | 126.1 | 125.2 |
Portugal | 117.5 | 117.1 | 117.4 | 119.3 | 120.8 | 120.7 |
Romania | 155.0 | 154.7 | 155.6 | 158.5 | 162.4 | 159.8 |
Slovenia | 130.1 | 130.2 | 130.3 | 130.1 | 130.2 | 130.4 |
Slovakia | 132.1 | 131.4 | 132.1 | 134.0 | 136.5 | 137.1 |
Finland | 118.1 | 118.5 | 117.4 | 117.0 | 116.2 | 115.2 |
Sweden | 118.6 | 117.9 | 115.8 | 115.7 | 114.7 | 113.9 |
Norway | 138.3 | 138.3 | 135.9 | 135.6 | 136.1 | 135.0 |
Switzerland | 112.6 | 112.6 | 113.1 | 113.1 | 113.4 | 113.0 |
Source dataset: sts_inppd_m |
Industrial producer prices indices on the domestic market for total industry excluding energy (base year 2021) | ||||||
---|---|---|---|---|---|---|
Mar-24 | Apr-24 | May-24 | Jun-24 | Jul-24 | Aug-24 | |
Euro area | 117.7 | 117.9 | 118.1 | 118.2 | 118.2 | 118.1 |
EU | 118.0 | 118.2 | 118.4 | 118.5 | 118.5 | 118.5 |
Belgium | 121.8 | 122.8 | 122.3 | 122.9 | 122.3 | 122.7 |
Bulgaria | 129.2 | 129.8 | 130.2 | 130.3 | 130.3 | 129.6 |
Czechia | 120.3 | 120.4 | 119.7 | 119.6 | 120.3 | 120.2 |
Denmark | 117.9 | 118.0 | 118.1 | 118.0 | 118.2 | 118.5 |
Germany | 118.6 | 118.9 | 119.1 | 119.2 | 119.2 | 119.2 |
Estonia | 118.9 | 120.3 | 120.5 | 120.3 | 119.4 | 120.7 |
Ireland | 111.9 | 111.9 | 111.9 | 111.6 | 111.7 | 111.7 |
Greece | 112.8 | 113.2 | 113.3 | 113.3 | 113.4 | 113.6 |
Spain | 118.4 | 118.3 | 118.5 | 118.6 | 118.3 | 118.0 |
France | 117.1 | 117.1 | 117.4 | 117.4 | 117.5 | 117.5 |
Croatia | 116.0 | 116.2 | 116.1 | 116.8 | 116.8 | 117.0 |
Italy | 114.2 | 114.4 | 114.5 | 114.6 | 114.7 | 114.7 |
Cyprus | 119.5 | 119.6 | 119.6 | 119.7 | 119.9 | 119.9 |
Latvia | 127.2 | 127.6 | 127.7 | 127.5 | 127.4 | 127.4 |
Lithuania | 124.0 | 124.6 | 123.7 | 123.6 | 123.4 | 123.6 |
Luxembourg | 116.0 | 116.4 | 116.4 | 116.3 | 116.6 | 116.0 |
Hungary | 141.5 | 141.6 | 141.8 | 142.5 | 142.9 | 143.6 |
Malta | 119.5 | 119.5 | 119.3 | 119.4 | 119.4 | 119.4 |
Netherlands | 119.9 | 120.0 | 119.7 | 119.7 | 119.7 | 119.7 |
Austria | 116.0 | 116.4 | 116.8 | 116.8 | 116.8 | 116.6 |
Poland | 115.0 | 114.8 | 114.8 | 115.2 | 115.0 | 114.9 |
Portugal | 121.4 | 121.9 | 122.1 | 122.3 | 122.6 | 122.2 |
Romania | 127.1 | 127.5 | 127.7 | 128.0 | 127.9 | 128.2 |
Slovenia | 123.6 | 123.7 | 124.1 | 123.7 | 123.6 | 123.9 |
Slovakia | 117.4 | 117.2 | 117.9 | 117.7 | 118.0 | 117.7 |
Finland | 117.1 | 117.4 | 117.9 | 117.9 | 117.7 | 117.9 |
Sweden | 122.1 | 123.2 | 124.5 | 124.3 | 123.9 | 124.1 |
Norway | 129.2 | 129.9 | 130.1 | 130.1 | 130.8 | 130.8 |
Switzerland | 108.0 | 107.9 | 108.0 | 108.1 | 108.2 | 108.1 |
Source dataset: sts_inppd_m |
Notes for users
Revisions and timetable
Compared with data issued in the News Release of 4 September 2024, the monthly percentage increase for July 2024 has been revised from +0.8% to +0.7% in the euro area and remained unchanged at +0.8% in the EU. The annual percentage decrease has been revised from -2.1% to -2.2% in the euro area and remained unchanged at -1.9% in the EU.
Methods and definitions
The index of producer prices shows (in the national currency of the country concerned) changes in the ex-works sale prices of all products sold on the domestic market, excluding imports. Euro area and EU indices refer to overall weighted price changes. The figures are not calendar day or seasonally adjusted.
Total industry covers NACE rev.2 sections B to D + E36.
Starting with reference period January 2024, the base year of the data has been changed to 2021, since 2018 the base year had been 2015. More information on the reasons for and impact of the base year change can be found in the related Statistics Explained article.
Geographical information
The euro area (EA20) includes Belgium, Germany, Estonia, Ireland, Greece, Spain, France, Croatia, Italy, Cyprus, Latvia, Lithuania, Luxembourg, Malta, the Netherlands, Austria, Portugal, Slovenia, Slovakia and Finland.
The European Union (EU27) includes Belgium, Bulgaria, Czechia, Denmark, Germany, Estonia, Ireland, Greece, Spain, France, Croatia, Italy, Cyprus, Latvia, Lithuania, Luxembourg, Hungary, Malta, the Netherlands, Austria, Poland, Portugal, Romania, Slovenia, Slovakia, Finland and Sweden.
For more information
Eurostat database section on short-term business statistics
Statistics Explained article on the industrial producer price index
The weights of the Member States in the EU and euro area aggregates
(See file Base year 2021 weights - Euro indicators releases)Euro indicators dashboard
Release calendar for Euro indicators
European Statistics Code of Practice
Get in touch
Media requests
Eurostat Media Support
Phone: (+352) 4301 33 408
E-mail: eurostat-mediasupport@ec.europa.eu
Further information on data
E-mail: ESTAT-STS-DATA@ec.europa.eu
Share component will be rendered here.
'; /** Retrieve the order from the tooltip option */ var sortOrder = option.tooltip.order; /** Sort the 'params' array based on the 'sortOrder' parameter. */ switch (sortOrder) { /** Sort by series name in ascending order. */ case 'seriesAsc': params = params.sort((a, b) => a.seriesName.localeCompare(b.seriesName)); break; /** Sort by series name in descending order. */ case 'seriesDesc': params = params.sort((a, b) => b.seriesName.localeCompare(a.seriesName)); break; /** Sort by numerical value in ascending order. */ case 'valueAsc': params = params.sort((a, b) => parseFloat(a.value) - parseFloat(b.value)); break; /** Sort by numerical value in descending order. */ case 'valueDesc': params = params.sort((a, b) => parseFloat(b.value) - parseFloat(a.value)); break; /** Reverse the current order. */ case 'reverse': params.reverse(); break; default: break; } /** Iterate over each series in the tooltip parameters */ for (var i = 0; i < params.length; i++) { /** Retrieve the name and value of the current series */ var seriesName = params[i].seriesName; var value = params[i].value; /** Replace every specific apostrphe by simple one. */ seriesName = seriesName.replaceAll("’", "'"); /** Convert the numeric value to its string representation. */ var strValue = String(value); /** Retrieve the axis used as value */ var axis = option.yAxis.type === 'value' ? option.yAxis : option.xAxis; /** Initialize the number of decimal places */ var decimals = option.tooltip.decimals; /** Check if decimals configuration is set to default and the value contains decimal places */ if (!decimals && strValue.indexOf('.') > -1) { /** Calculate the number of decimal places */ decimals = strValue.substring(strValue.indexOf('.'), strValue.length - 1).length; } else { /** If there are no decimal places, format the value with 1 decimal place */ decimals = decimals ? decimals : 1; /** Convert the value to a fixed-point notation string with a specified number of decimal places. */ value = Number(value).toFixed(decimals); } /** Convert -0 value to 0 with the specified or calculated number of decimal places.*/ if (Number(value) == -0) { value = (Number(value) + 0).toFixed(decimals); } /** Extract the unit from within the axis label */ var unit = axis.axisLabel.unit ? axis.axisLabel.unit : ''; /** Format the value using the appropriate number of decimal places */ value = isNaN(value) ? 'N/A' : Number(value).toLocaleString(option.lang ? option.lang : 'en', { minimumFractionDigits: decimals }) + unit; /** Retrieve the color of the current series */ const color = params[i].color; /** * Add the series name and value to the tooltip content * Use a circle icon with the series color */ tooltipContent += '
' + '' + '' + '' + seriesName + '' + '' + '' + value + '' + '
'; } /** Close the tooltip content container */ tooltipContent += '
'; /** Return the formatted tooltip content */ return tooltipContent; }}/* * This content is licensed according to the W3C Software License at * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document * * File: sortable-table.js * * Desc: Adds sorting to a HTML data table that implements ARIA Authoring Practices */'use strict';class SortableTable { constructor(tableNode) { this.tableNode = tableNode; this.columnHeaders = tableNode.querySelectorAll('thead th.sortable'); this.sortColumns = []; for (var i = 0; i < this.columnHeaders.length; i++) { var ch = this.columnHeaders[i]; var buttonNode = ch.querySelector('button'); if (buttonNode) { this.sortColumns.push(i); // buttonNode.setAttribute('data-column-index', i); // buttonNode.addEventListener('click', this.handleClick.bind(this)); ch.setAttribute('data-column-index', i); ch.addEventListener('click', this.handleClick.bind(this)); } } this.optionCheckbox = document.querySelector( 'input[type="checkbox"][value="show-unsorted-icon"]' ); if (this.optionCheckbox) { this.optionCheckbox.addEventListener( 'change', this.handleOptionChange.bind(this) ); if (this.optionCheckbox.checked) { this.tableNode.classList.add('show-unsorted-icon'); } } } setColumnHeaderSort(columnIndex) { if (typeof columnIndex === 'string') { columnIndex = parseInt(columnIndex); } for (var i = 0; i < this.columnHeaders.length; i++) { var ch = this.columnHeaders[i]; var buttonNode = ch.querySelector('button'); if (i === columnIndex) { var value = ch.getAttribute('aria-sort'); if (value === 'ascending') { ch.setAttribute('aria-sort', 'descending'); this.sortColumn( columnIndex, 'descending', ch.classList.contains('num')); } else if (value === 'descending') { ch.removeAttribute('aria-sort'); this.sortColumn( columnIndex, 'initial', true ); } else { ch.setAttribute('aria-sort', 'ascending'); this.sortColumn( columnIndex, 'ascending', ch.classList.contains('num') ); } } else { if (ch.hasAttribute('aria-sort') && buttonNode) { ch.removeAttribute('aria-sort'); } } } } sortColumn(columnIndex, sortValue, isNumber) { function compareValues(a, b) { if (a.value === b.value) return 0; if (sortValue === 'descending') { return isNumber ? b.value - a.value : (a.value > b.value ? -1 : 1); } else { return isNumber ? a.value - b.value : (a.value < b.value ? -1 : 1); } } if (typeof isNumber !== 'boolean') { isNumber = false; } var tbodyNode = this.tableNode.querySelector('tbody'); var rowNodes = []; var dataCells = []; var rowNode = tbodyNode.firstElementChild; var index = 0; while (rowNode) { rowNodes.push(rowNode); var rowCells = rowNode.querySelectorAll('th, td'); var dataCell = rowCells[columnIndex]; var data = {}; data.index = index; if (sortValue !== 'initial') { data.value = dataCell.textContent.toLowerCase().trim(); } else { data.value = rowNode.getAttribute('initial-position').toLowerCase().trim(); } if (isNumber) { data.value = parseFloat(data.value); } dataCells.push(data); rowNode = rowNode.nextElementSibling; index += 1; } dataCells.sort(compareValues); // remove rows while (tbodyNode.firstChild) { tbodyNode.removeChild(tbodyNode.lastChild); } // add sorted rows for (var i = 0; i < dataCells.length; i += 1) { let pos = [dataCells[i].index]; if (sortValue === "initial") { rowNodes[pos].classList.remove("sorted"); } else { rowNodes[pos].classList.add("sorted"); } tbodyNode.appendChild(rowNodes[pos]); } } /* EVENT HANDLERS */ handleClick(event) { var tgt = event.currentTarget; this.setColumnHeaderSort(tgt.getAttribute('data-column-index')); } handleOptionChange(event) { var tgt = event.currentTarget; if (tgt.checked) { this.tableNode.classList.add('show-unsorted-icon'); } else { this.tableNode.classList.remove('show-unsorted-icon'); } }}$(document).ready(function() { load(); });;}());
Subscribe to receive the latest Eurostat Euro indicators releases