Skip to content
Merged
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
20 changes: 20 additions & 0 deletions src/components/NormalizedStackedAreaChart.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { describe, it, expect } from "vitest";
import { technologyColors } from "./NormalizedStackedAreaChart";
import { POWER_SECTOR_DEFINITION } from "../utils/timeseriesTaxonomy";

// Reported as capacity only, never as a share of generation, so it never
// reaches the technology mix chart.
const NOT_IN_TECHNOLOGY_MIX = ["energyStorage"];

describe("technologyColors", () => {
it("has a colour for every power technology that can appear in the technology mix", () => {
const missing = Object.keys(
POWER_SECTOR_DEFINITION.technologies ?? {},
).filter(
(tech) =>
!NOT_IN_TECHNOLOGY_MIX.includes(tech) && !(tech in technologyColors),
);

expect(missing).toEqual([]);
});
});
7 changes: 5 additions & 2 deletions src/components/NormalizedStackedAreaChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,21 @@ interface NormalizedStackedAreaChartProps {
onHoverPoint?: (point: HoveredPoint | null) => void;
}

const technologyColors = {
// Stacking and legend order follow key order: high-carbon reds first, then
// "other", then low-carbon blues. A technology missing here renders black at
// the bottom of the stack, which is why the test checks coverage.
export const technologyColors = {
coal: "#AB3C2C", // red-brown
oil: "#DF4E39", // deep red (hot)
gas: "#F7988B", // orange-pink
other: "#B3BCC5", // gray
biomass: "#91CBF2", // light blue
biofuels: "#77B8E4", // argentinian blue
geothermal: "#529CBA", // rmiblue-400
hydro: "#2888C9", // blue
nuclear: "#2274AA", // ucla blue
wind: "#005A96", // dark blue
solar: "#003B63", // navy blue
renewables: "#003152", // prussian blue
} as const;

export default function NormalizedStackedAreaChart({
Expand Down
3 changes: 0 additions & 3 deletions src/data/asean-centre-for-energy/ACE-ATS-2024.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@
"Wind",
"Solar",
"Biomass",
"Renewables",
"Other"
],
"scopeLimitations": "ASEAN aggregate power-system output. No separate captive or residential-rooftop time series."
Expand All @@ -327,7 +326,6 @@
"Wind",
"Solar",
"Biomass",
"Renewables",
"Other"
],
"scopeLimitations": "ASEAN aggregate power-system output. No separate captive or residential-rooftop time series."
Expand All @@ -348,7 +346,6 @@
"Wind",
"Solar",
"Biomass",
"Renewables",
"Other"
],
"scopeLimitations": "ASEAN aggregate power-system output. No separate captive or residential-rooftop time series."
Expand Down
3 changes: 0 additions & 3 deletions src/data/asean-centre-for-energy/ACE-BAS-2024.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@
"Wind",
"Solar",
"Biomass",
"Renewables",
"Other"
],
"scopeLimitations": "ASEAN aggregate power-system output. No separate captive or residential-rooftop time series."
Expand All @@ -313,7 +312,6 @@
"Wind",
"Solar",
"Biomass",
"Renewables",
"Other"
],
"scopeLimitations": "ASEAN aggregate power-system output. No separate captive or residential-rooftop time series."
Expand All @@ -333,7 +331,6 @@
"Wind",
"Solar",
"Biomass",
"Renewables",
"Other"
],
"scopeLimitations": "ASEAN aggregate power-system output. No separate captive or residential-rooftop time series."
Expand Down
3 changes: 0 additions & 3 deletions src/data/asean-centre-for-energy/ACE-CNS-2024.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@
"Wind",
"Solar",
"Biomass",
"Renewables",
"Other"
],
"scopeLimitations": "ASEAN aggregate power-system output. No separate captive or residential-rooftop time series."
Expand All @@ -356,7 +355,6 @@
"Wind",
"Solar",
"Biomass",
"Renewables",
"Other"
],
"scopeLimitations": "ASEAN aggregate power-system output. No separate captive or residential-rooftop time series."
Expand All @@ -377,7 +375,6 @@
"Wind",
"Solar",
"Biomass",
"Renewables",
"Other"
],
"scopeLimitations": "ASEAN aggregate power-system output. No separate captive or residential-rooftop time series."
Expand Down
3 changes: 0 additions & 3 deletions src/data/asean-centre-for-energy/ACE-RAS-2024.json
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@
"Wind",
"Solar",
"Biomass",
"Renewables",
"Other"
],
"scopeLimitations": "ASEAN aggregate power-system output. No separate captive or residential-rooftop time series."
Expand All @@ -348,7 +347,6 @@
"Wind",
"Solar",
"Biomass",
"Renewables",
"Other"
],
"scopeLimitations": "ASEAN aggregate power-system output. No separate captive or residential-rooftop time series."
Expand All @@ -369,7 +367,6 @@
"Wind",
"Solar",
"Biomass",
"Renewables",
"Other"
],
"scopeLimitations": "ASEAN aggregate power-system output. No separate captive or residential-rooftop time series."
Expand Down
Loading
Loading