Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Frontend/Analysis/analysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ <h3>🌪 Wind Speed</h3>
<div class="section-title">⚠ Climate Risk Analysis</div>


//Issue #67: Feature implementation: eplacing color-only signals with combined textual indicators
<!-- //Issue #67: Feature implementation: replacing color-only signals... -->

<div class="risk-grid-five">
<div class="risk-card flood" role="region" aria-labelledby="flood-title">
Expand Down
16 changes: 11 additions & 5 deletions Frontend/Analysis/analysis.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


const API_URL =
window.location.hostname === "127.0.0.1" ||
window.location.hostname === "localhost"
Expand Down Expand Up @@ -262,7 +264,7 @@ async function getWeatherData() {
// Risks scores
const floodCard = document.querySelector(".risk-card.flood");
const floodScore = data.risks.flood_risk;
document.getElementById("flood-risk").innerText = floodScore;
document.getElementById("flood-risk").innerText = toPercent(floodScore);
let score = floodScore;
let card = floodCard;
let level = getRiskLevel(score, "flood");
Expand All @@ -273,7 +275,7 @@ async function getWeatherData() {

const heatCard = document.querySelector(".risk-card.heat");
const heatScore = data.risks.heat_risk;
document.getElementById("heat-risk").innerText = heatScore;
document.getElementById("heat-risk").innerText = toPercent(heatScore);
score = heatScore;
card = heatCard;
level = getRiskLevel(score, "heat");
Expand All @@ -283,7 +285,7 @@ async function getWeatherData() {
card.querySelector(".risk-description").textContent = level.desc;
const wildfireCard = document.querySelector(".risk-card.wildfire");
const wildfireScore = data.risks.wildfire_risk;
document.getElementById("wildfire-risk").innerText = wildfireScore;
document.getElementById("wildfire-risk").innerText = toPercent(wildfireScore);
score = wildfireScore;
card = wildfireCard;
level = getRiskLevel(score, "wildfire");
Expand All @@ -294,7 +296,7 @@ async function getWeatherData() {

const cycloneCard = document.querySelector(".risk-card.cyclone");
const cycloneScore = data.risks.cyclone_risk;
document.getElementById("cyclone-risk").innerText = cycloneScore;
document.getElementById("cyclone-risk").innerText = toPercent(cycloneScore);
score = cycloneScore;
card = cycloneCard;
level = getRiskLevel(score, "cyclone");
Expand All @@ -305,7 +307,7 @@ async function getWeatherData() {

const droughtCard = document.querySelector(".risk-card.drought");
const droughtScore = data.risks.drought_risk;
document.getElementById("drought-risk").innerText = droughtScore;
document.getElementById("drought-risk").innerText = toPercent(droughtScore);
score = droughtScore;
card = droughtCard;
level = getRiskLevel(score, "drought");
Expand All @@ -327,6 +329,10 @@ async function getWeatherData() {
drought: droughtScore,
});

function toPercent(score) {
return (score * 100).toFixed(1) + "%";
}

recommendationsList.innerHTML = recommendations
.map((item) => `<li>✅ ${item}</li>`)
.join("");
Expand Down