I'm struggling to extract the highest and lowest values from my dataset. While resources like Get the largest value from Json object with Javascript and Math.min.apply returns 0 for null seem promising, my data is more complex than I anticipated.
My dataset consists of life expectancy data for all countries from 1995 to 2016:
[{"country":"Abkhazia","1995":null,"1996":null,"1997":null,"1998":null,"1999":null,"2000":null,"2001":null,"2002":null,"2003":null,"2004":null,"2005":null,"2006":null,"2007":null,"2008":null,"2009":null,"2010":null},
{"country":"Afghanistan","1995":null,"1996":null,"1997":null,"1998":null,"1999":null,"2000":null,"2001":null,"2002":5.7,"2003":6.8,"2004":6.4,"2005":6.6,"2006":6.8,"2007":7.3,"2008":7.0,"2009":7.6,"2010":7.6},
{"country":"Akrotiri and Dhekelia","1995":null,"1996":null,"1997":null,"1998":null,"1999":null,"2000":null,"2001":null,"2002":null,"2003":null,"2004":null,"2005":null,"2006":null,"2007":null,"2008":null,"2009":null,"2010":null},
{"country":"Albania","1995":2.6,"1996":4.0,"1997":4.8,"1998":5.3,"1999":5.8,"2000":6.4,"2001":6.0,"2002":6.3,"2003":6.2,"2004":6.9,"2005":6.8,"2006":6.7,"2007":6.9,"2008":6.7,"2009":6.9,"2010":6.5},
etc.
Requested Information:
I need to identify the highest and lowest values in the entire dataset.
In this sample, it would be:
min: 2.6
max: 7.6
I am working on a datamap using D3 and intend to use these values to establish a color range.
Attempted Code:
Although I believe a combination of the provided links could solve my issue, I have been struggling to implement it. For instance, while the second link allows me to find the minimum value for a specific country, I cannot determine the overall minimum across all countries.
Hoping for assistance!