From b5b8e6929524b13a63b94c9ff2e8c06acaf02bcb Mon Sep 17 00:00:00 2001 From: Harold Garbeil Date: Fri, 22 Nov 2024 04:39:56 -1000 Subject: [PATCH] formatting and energymix chart --- css/style.css | 33 +++++++++ js/country.js | 181 +++++++++++++++++++++++++++++--------------------- 2 files changed, 138 insertions(+), 76 deletions(-) diff --git a/css/style.css b/css/style.css index 4aafd0d..d531e29 100644 --- a/css/style.css +++ b/css/style.css @@ -312,6 +312,39 @@ tbody th, tbody td { } +.main-full { + width: 90% ; + border: 1px solid var(--clr-sky-900) ; + border-radius : 10px ; + padding: 5px 15px ; + /* margin: auto ; */ +} +.split-div { + display:flex ; + justify-content: space-around ; + + + +} +.split-div .split-div-left { + flex: 1 0 25% ; + display: flex ; + flex-direction: column ; +} +.split-div .split-div-right { + flex: 1 1 70% ; + display: flex ; + flex-direction: column ; + +} + +.split-div-right canvas { + width : 90% ; +} +.countryList ul { + list-style-type: none ; +} + @media only screen and (max-width: 900px) { .divimage img { display: none ; diff --git a/js/country.js b/js/country.js index c8cc046..e1f2c0b 100644 --- a/js/country.js +++ b/js/country.js @@ -5,6 +5,7 @@ let countryString = [] ; let tableRows= [] ; let country_chart=null ; let countries = ['World','China','United States','India','Russia','Japan','Iran','Germany','Brazil','United Kingdom','France'] ; +let countries_sub = ['World','China','Russia','Iran'] ; let ctx_country = null ; let energymix_chart = null ; @@ -32,13 +33,21 @@ let mainstring = `
-
- -

Time series plot showing the selected country's total - CO2 emissions and the share produced - from the major fossil fuel sources.

+
+

Per capita primary energy consumption by source, 2023

+
+
+
+ +
+ +

Bar chart showing the sources for energy consumption of the top 10 greenhouse emitting countries. +

+
+
-
` ; + + ` ; function loadCountry () { @@ -82,11 +91,47 @@ function loadCountry () { }, false) ; + let cboxstring = '
' ; + document.querySelector("div.countryList").innerHTML = cboxstring ; } // country,code,year,total,Coal,Oil,Gas,Nuclear,Hydro,Wind,Solar,Other -function loadCountryMix (country) { +function loadCountryMix () { + + var checkboxes = document.querySelectorAll('.countryCB'); + var selected = []; + for (var i=0; i