Euro indicators 5 August 2024 Next release: 4 September 2024
June 2024 compared with May 2024
Skip to the content
Down by 3.2% in the euro area and by 3.1% in the EU compared with June 2023
Overview
In June 2024, compared with May 2024, industrial producer prices increased by 0.5% in both the euro area and the EU, according to first estimates from Eurostat, the statistical office of the European Union. In May 2024, industrial producer prices fell by 0.2% in both the euro area and the EU.
In June 2024, compared with June 2023, industrial producer prices decreased by 3.2% the euro area and by 3.1% in the EU.
Monthly comparison by main industrial grouping and by Member State
In the euro area in June 2024, compared with May 2024, industrial producer prices
increased by 0.1% for intermediate goods,
increased by 1.6% for energy,
increased by 0.1% for capital goods,
remained stable for durable consumer goods,
increased by 0.1% for non-durable consumer goods.
Prices in total industry excluding energy increased by 0.1%.
In the EU, industrial producer prices
remained stable for intermediate goods,
increased by 1.6% for energy,
increased by 0.1% for capital goods,
increased by 0.1% for durable consumer goods,
increased by 0.1% for non-durable consumer goods.
Prices in total industry excluding energy increased by 0.1%.
The highest monthly increases in industrial producer prices were recorded in Estonia (+2.2%), Spain and Romania (both +1.9%) and Greece (+1.8%). The largest decreases were observed in Bulgaria (-1.0%), Czechia, France and Finland (each -0.3%).
Annual comparison by main industrial grouping and by Member State
In the euro area in June 2024, compared with June 2023, industrial producer prices
decreased by 2.2% for intermediate goods,
decreased by 9.4% for energy,
increased by 1.6% for capital goods,
increased by 0.4% for durable consumer goods,
increased by 1.2% for non-durable consumer goods.
Prices in total industry excluding energy decreased by 0.1%.
In the EU, industrial producer prices
decreased by 2.3% for intermediate goods,
decreased by 8.3% for energy,
increased by 1.7% for capital goods,
increased by 0.1% for durable consumer goods,
increased by 1.1% for non-durable consumer goods.
Prices in total industry excluding energy decreased by 0.2%.
The largest annual decreases in industrial producer prices were recorded in Slovakia (-19.0%), France (-6.0%) and Poland (-5.7%). The highest increases were observed in Luxembourg (+19.1%), Portugal (+2.4%) and Czechia (+1.0%).
Tables
Industrial producer prices on the domestic market % change compared with previous month | ||||||
---|---|---|---|---|---|---|
Jan-24 | Feb-24 | Mar-24 | Apr-24 | May-24 | Jun-24 | |
Euro area | ||||||
Total industry | -0.9 | -1.0 | -0.6 | -0.9 | -0.2 | 0.5 |
Total industry excluding energy | 0.3 | 0.1 | 0.3 | 0.3 | 0.1 | 0.1 |
Intermediate goods | -0.1 | -0.1 | 0.2 | 0.3 | 0.1 | 0.1 |
Energy | -2.9 | -3.6 | -2.3 | -3.6 | -1.1 | 1.6 |
Capital goods | 0.6 | 0.3 | 0.1 | 0.1 | 0.1 | 0.1 |
Durable consumer goods | -0.2 | 0.4 | 0.2 | 0.2 | -0.3 | 0.0 |
Non-durable consumer goods | 0.3 | 0.2 | 0.6 | 0.2 | 0.1 | 0.1 |
EU | ||||||
Total industry | -0.8 | -1.0 | -0.6 | -0.7 | -0.2 | 0.5 |
Total industry excluding energy | 0.3 | 0.1 | 0.3 | 0.2 | 0.2 | 0.1 |
Intermediate goods | -0.1 | -0.1 | 0.2 | 0.3 | 0.1 | 0.0 |
Energy | -2.5 | -3.2 | -2.5 | -2.5 | -1.2 | 1.6 |
Capital goods | 0.5 | 0.4 | 0.1 | 0.1 | 0.2 | 0.1 |
Durable consumer goods | -0.1 | 0.3 | 0.2 | 0.2 | -0.3 | 0.1 |
Non-durable consumer goods | 0.2 | 0.2 | 0.5 | 0.2 | 0.2 | 0.1 |
Source dataset: sts_inppd_m
Industrial producer prices on the domestic market % change compared with previous month | ||||||
---|---|---|---|---|---|---|
Jan-24 | Feb-24 | Mar-24 | Apr-24 | May-24 | Jun-24 | |
Euro area | -0.9 | -1.0 | -0.6 | -0.9 | -0.2 | 0.5 |
EU | -0.8 | -1.0 | -0.6 | -0.7 | -0.2 | 0.5 |
Belgium | -0.5 | 0.9 | -0.2 | 0.2 | -1.6 | 1.0 |
Bulgaria | -1.8 | -1.5 | -3.4 | -0.8 | 4.5 | -1.0 |
Czechia | 2.4 | 0.5 | 0.0 | 0.2 | -1.2 | -0.3 |
Denmark | 0.1 | -2.8 | -2.3 | 2.8 | -0.7 | 1.4 |
Germany | 0.2 | -0.4 | 0.2 | 0.2 | -0.1 | 0.1 |
Estonia | 5.3 | -7.2 | -0.9 | -0.3 | 2.1 | 2.2 |
Ireland | 4.0 | -4.2 | 0.9 | 0.8 | 7.7 | -0.1 |
Greece | 0.7 | -1.6 | -2.3 | -1.8 | -2.9 | 1.8 |
Spain | 0.2 | -2.6 | -2.2 | -0.3 | 0.9 | 1.9 |
France | -1.0 | -1.5 | -1.2 | -3.6 | -1.6 | -0.3 |
Croatia | -0.9 | 0.1 | 0.2 | -1.9 | -4.1 | 0.9 |
Italy | -2.5 | -1.5 | -0.4 | -1.4 | 0.3 | 1.0 |
Cyprus | -1.6 | 0.0 | -0.6 | 0.2 | 0.5 | 0.1 |
Latvia | 1.2 | -3.0 | -1.1 | -0.1 | 0.4 | 0.4 |
Lithuania | 6.5 | -3.3 | -2.0 | 0.0 | -1.6 | 0.4 |
Luxembourg | -0.8 | 0.8 | -0.4 | -1.1 | 0.0 | 0.1 |
Hungary | -1.2 | 0.7 | -0.3 | -0.3 | -0.9 | 1.2 |
Malta | 0.3 | 0.0 | 0.0 | 0.0 | -0.1 | 0.0 |
Netherlands | -0.6 | 0.1 | 0.1 | -0.5 | -0.2 | 0.2 |
Austria | -2.2 | -0.9 | -1.3 | -0.8 | 0.3 | 0.2 |
Poland | -3.0 | 0.3 | -0.3 | 0.2 | -0.2 | 0.6 |
Portugal | 0.8 | 0.3 | -0.5 | -0.3 | 0.2 | 1.6 |
Romania | -0.4 | -1.2 | -2.6 | -0.2 | 0.6 | 1.9 |
Slovenia | -0.2 | -1.1 | -0.1 | 0.1 | 0.1 | -0.2 |
Slovakia | -14.3 | -5.6 | -0.5 | -0.5 | 0.5 | 1.4 |
Finland | 0.7 | -0.8 | -0.4 | 0.3 | -0.9 | -0.3 |
Sweden | 1.1 | -1.3 | 0.9 | -0.6 | -1.8 | -0.1 |
Norway | 0.4 | -0.7 | 1.2 | 0.0 | -1.7 | -0.2 |
Switzerland | 0.4 | 0.2 | 0.1 | 0.0 | 0.4 | 0.0 |
Source dataset: sts_inppd_m |
Industrial producer prices on the domestic market % change compared with same month of previous year | ||||||
---|---|---|---|---|---|---|
Jan-24 | Feb-24 | Mar-24 | Apr-24 | May-24 | Jun-24 | |
Euro area | ||||||
Total industry | -8.0 | -8.3 | -7.8 | -5.6 | -4.1 | -3.2 |
Total industry excluding energy | -1.2 | -1.3 | -1.3 | -0.9 | -0.4 | -0.1 |
Intermediate goods | -5.4 | -5.4 | -4.8 | -3.9 | -2.9 | -2.2 |
Energy | -19.9 | -21.1 | -20.2 | -14.6 | -11.3 | -9.4 |
Capital goods | 2.2 | 2.1 | 2.0 | 1.5 | 1.6 | 1.6 |
Durable consumer goods | 1.1 | 1.1 | 1.0 | 1.0 | 0.3 | 0.4 |
Non-durable consumer goods | 2.1 | 1.5 | 1.2 | 1.0 | 1.1 | 1.2 |
EU | ||||||
Total industry | -7.8 | -8.1 | -7.6 | -5.4 | -3.9 | -3.1 |
Total industry excluding energy | -1.3 | -1.5 | -1.4 | -1.2 | -0.6 | -0.2 |
Intermediate goods | -5.7 | -5.6 | -5.0 | -4.1 | -3.0 | -2.3 |
Energy | -18.9 | -19.6 | -18.8 | -13.4 | -10.2 | -8.3 |
Capital goods | 2.0 | 2.0 | 1.9 | 1.6 | 1.8 | 1.7 |
Durable consumer goods | 0.6 | 0.4 | 0.3 | 0.5 | -0.1 | 0.1 |
Non-durable consumer goods | 1.7 | 1.3 | 0.9 | 0.6 | 0.9 | 1.1 |
Source dataset: sts_inppd_m
Industrial producer prices on the domestic market % change compared with same month of previous year | ||||||
---|---|---|---|---|---|---|
Jan-24 | Feb-24 | Mar-24 | Apr-24 | May-24 | Jun-24 | |
Euro area | -8.0 | -8.3 | -7.8 | -5.6 | -4.1 | -3.2 |
EU | -7.8 | -8.1 | -7.6 | -5.4 | -3.9 | -3.1 |
Belgium | -15.7 | -12.2 | -11.6 | -2.6 | -2.3 | 0.8 |
Bulgaria | -17.8 | -12.1 | -12.8 | -10.6 | -4.2 | -2.8 |
Czechia | -1.9 | -1.0 | 0.0 | 1.4 | 1.0 | 1.0 |
Denmark | -4.0 | -5.9 | -6.9 | -4.4 | -4.2 | -2.9 |
Germany | -4.5 | -4.1 | -2.9 | -3.2 | -2.3 | -1.9 |
Estonia | -0.6 | -7.7 | -7.7 | -7.0 | -3.8 | -2.3 |
Ireland | -21.5 | -24.2 | -19.8 | -13.7 | 0.4 | -3.5 |
Greece | -7.9 | -6.3 | -1.3 | -3.3 | -3.8 | -2.4 |
Spain | -4.0 | -8.6 | -8.2 | -6.7 | -4.5 | -3.5 |
France | -4.8 | -5.3 | -8.2 | -6.6 | -6.7 | -6.0 |
Croatia | -1.1 | -1.7 | -2.0 | -2.0 | -4.4 | -4.8 |
Italy | -14.0 | -14.2 | -12.7 | -8.0 | -4.9 | -3.5 |
Cyprus | -3.6 | -3.7 | -4.2 | -4.2 | -3.0 | -2.8 |
Latvia | -11.9 | -13.6 | -12.1 | -9.2 | -6.7 | -4.0 |
Lithuania | -2.7 | -6.3 | -5.4 | -2.5 | -1.8 | -1.2 |
Luxembourg | 16.5 | 17.2 | 16.5 | 16.7 | 17.7 | 19.1 |
Hungary | -7.8 | -5.9 | -5.4 | -5.0 | -3.9 | -0.3 |
Malta | 0.8 | 0.7 | 0.7 | 0.8 | 0.5 | 0.2 |
Netherlands | -10.1 | -10.1 | -8.2 | -5.1 | -3.6 | -3.0 |
Austria | -11.7 | -10.5 | -10.3 | -8.6 | -6.5 | -5.1 |
Poland | -11.0 | -10.0 | -9.9 | -8.3 | -6.8 | -5.7 |
Portugal | -1.9 | -2.4 | -1.7 | -1.1 | 0.3 | 2.4 |
Romania | -8.0 | -9.0 | -11.0 | -5.7 | -2.2 | 0.9 |
Slovenia | 0.3 | -3.4 | -3.7 | -3.8 | -3.1 | -2.7 |
Slovakia | -12.1 | -25.5 | -24.6 | -22.8 | -20.7 | -19.0 |
Finland | -4.5 | -4.5 | -4.3 | -2.1 | 0.0 | -0.9 |
Sweden | -1.4 | -1.5 | -0.4 | 0.6 | 1.3 | -0.1 |
Norway | 4.2 | 2.6 | 2.8 | 3.1 | 2.8 | 2.4 |
Switzerland | 2.3 | 1.9 | 1.6 | 1.6 | 1.0 | 0.8 |
Source dataset: sts_inppd_m |
Industrial producer prices indices on the domestic market for total industry | ||||||
---|---|---|---|---|---|---|
Jan-24 | Feb-24 | Mar-24 | Apr-24 | May-24 | Jun-24 | |
Euro area | 126.5 | 125.2 | 124.5 | 123.4 | 123.1 | 123.7 |
EU | 127.9 | 126.6 | 125.9 | 125.0 | 124.7 | 125.3 |
Belgium | 126.1 | 127.2 | 127.0 | 127.2 | 125.2 | 126.4 |
Bulgaria | 123.7 | 121.8 | 117.7 | 116.7 | 122.0 | 120.8 |
Czechia | 131.7 | 132.4 | 132.4 | 132.7 | 131.1 | 130.7 |
Denmark | 144.1 | 140.1 | 136.9 | 140.8 | 139.8 | 141.7 |
Germany | 128.5 | 128.0 | 128.2 | 128.4 | 128.3 | 128.4 |
Estonia | 138.0 | 128.0 | 126.9 | 126.5 | 129.1 | 132.0 |
Ireland | 92.0 | 88.1 | 88.9 | 89.6 | 96.5 | 96.4 |
Greece | 126.0 | 124.0 | 121.2 | 119.0 | 115.5 | 117.6 |
Spain | 126.3 | 123.0 | 120.3 | 119.9 | 121.0 | 123.3 |
France | 130.3 | 128.3 | 126.7 | 122.2 | 120.3 | 119.9 |
Croatia | 132.3 | 132.4 | 132.7 | 130.2 | 124.8 | 125.9 |
Italy | 123.6 | 121.8 | 121.3 | 119.6 | 119.9 | 121.1 |
Cyprus | 124.6 | 124.6 | 123.8 | 124.0 | 124.6 | 124.7 |
Latvia | 145.7 | 141.4 | 139.8 | 139.6 | 140.2 | 140.8 |
Lithuania | 145.4 | 140.6 | 137.8 | 137.8 | 135.6 | 136.1 |
Luxembourg | 155.2 | 156.4 | 155.8 | 154.1 | 154.1 | 154.2 |
Hungary | 179.7 | 180.9 | 180.3 | 179.8 | 178.2 | 180.4 |
Malta | 108.9 | 108.9 | 108.9 | 108.9 | 108.8 | 108.8 |
Netherlands | 122.6 | 122.7 | 122.8 | 122.2 | 121.9 | 122.2 |
Austria | 123.6 | 122.5 | 120.9 | 119.9 | 120.2 | 120.4 |
Poland | 125.0 | 125.4 | 125.0 | 125.3 | 125.0 | 125.8 |
Portugal | 117.7 | 118.1 | 117.5 | 117.1 | 117.3 | 119.2 |
Romania | 161.1 | 159.1 | 155.0 | 154.7 | 155.6 | 158.5 |
Slovenia | 131.7 | 130.2 | 130.1 | 130.2 | 130.3 | 130.1 |
Slovakia | 140.5 | 132.7 | 132.1 | 131.4 | 132.1 | 134.0 |
Finland | 119.6 | 118.6 | 118.1 | 118.5 | 117.4 | 117.0 |
Sweden | 119.1 | 117.6 | 118.6 | 117.9 | 115.8 | 115.7 |
Norway | 137.7 | 136.7 | 138.3 | 138.3 | 135.9 | 135.6 |
Switzerland | 112.3 | 112.5 | 112.6 | 112.6 | 113.1 | 113.1 |
Source dataset: sts_inppd_m |
Industrial producer prices indices on the domestic market for total industry excluding energy (base year 2021) | ||||||
---|---|---|---|---|---|---|
Jan-24 | Feb-24 | Mar-24 | Apr-24 | May-24 | Jun-24 | |
Euro area | 117.4 | 117.5 | 117.8 | 118.1 | 118.2 | 118.3 |
EU | 117.7 | 117.8 | 118.1 | 118.3 | 118.5 | 118.6 |
Belgium | 121.1 | 122.4 | 123.6 | 124.8 | 124.6 | 125.1 |
Bulgaria | 128.4 | 128.9 | 129.2 | 129.8 | 130.2 | 130.3 |
Czechia | 119.2 | 119.8 | 120.3 | 120.4 | 119.7 | 119.6 |
Denmark | 117.3 | 117.3 | 117.9 | 118.0 | 118.1 | 118.0 |
Germany | 118.3 | 118.3 | 118.6 | 118.9 | 119.1 | 119.2 |
Estonia | 119.0 | 118.8 | 118.9 | 120.3 | 120.5 | 120.3 |
Ireland | 108.7 | 111.7 | 111.9 | 111.9 | 111.9 | 111.6 |
Greece | 112.7 | 112.8 | 112.8 | 113.2 | 113.3 | 113.3 |
Spain | 118.0 | 118.1 | 118.4 | 118.3 | 118.5 | 118.5 |
France | 116.8 | 116.8 | 117.1 | 117.1 | 117.4 | 117.4 |
Croatia | 115.6 | 115.4 | 116.0 | 116.2 | 116.1 | 116.8 |
Italy | 114.3 | 114.1 | 114.2 | 114.4 | 114.5 | 114.6 |
Cyprus | 119.5 | 119.5 | 119.5 | 119.6 | 119.7 | 119.8 |
Latvia | 127.0 | 127.3 | 127.2 | 127.6 | 127.7 | 127.5 |
Lithuania | 125.2 | 125.1 | 124.0 | 124.6 | 123.7 | 123.6 |
Luxembourg | 107.7 | 108.6 | 108.2 | 108.5 | 108.5 | 108.7 |
Hungary | 139.9 | 140.8 | 141.5 | 141.6 | 141.8 | 142.5 |
Malta | 119.5 | 119.5 | 119.5 | 119.5 | 119.3 | 119.4 |
Netherlands | 118.8 | 119.3 | 119.9 | 120.0 | 119.7 | 119.7 |
Austria | 115.3 | 115.6 | 116.0 | 116.4 | 116.8 | 116.8 |
Poland | 115.0 | 114.8 | 115.0 | 114.8 | 114.8 | 115.2 |
Portugal | 121.2 | 121.4 | 121.4 | 121.9 | 122.0 | 122.3 |
Romania | 126.0 | 126.4 | 127.1 | 127.5 | 127.7 | 128.0 |
Slovenia | 123.7 | 123.7 | 123.6 | 123.7 | 124.1 | 123.7 |
Slovakia | 118.0 | 117.1 | 117.4 | 117.2 | 117.9 | 117.7 |
Finland | 116.6 | 116.7 | 117.1 | 117.4 | 117.9 | 117.9 |
Sweden | 121.0 | 121.7 | 122.1 | 123.2 | 124.5 | 124.3 |
Norway | 128.4 | 129.2 | 129.2 | 129.9 | 130.1 | 130.1 |
Switzerland | 108.0 | 108.0 | 108.0 | 107.9 | 108.0 | 108.1 |
Source dataset: sts_inppd_m |
Notes for users
Revisions and timetable
Compared with data issued in the News Release of 3 July 2024, the monthly percentage decrease for May 2024 remained unchanged at -0.2% in the euro area and has been revised from -0.3% to -0.2% in the EU. The annual percentage decreases have been revised from -4.2% to -4.1% in the euro area and from -4.0% to -3.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