Flask page, having some trouble figuring out the issue

Here is the link to my project: Glitch :・゚✧

Basically, in the vehicle comparison route, I want to be able to select the vehicles, and then select the data type, and have it generate a table and a graph with the data defined in my main.py.

The cost toggle works fine. It displays the data and graph as expected.

However, the environmental impact toggle does not. It displays no data, and the wrong graph, it displays the same cost graph, as well as a blank environmental impact graph.

Why is this? Is it something wrong with how the data is being rendered? It should generate the stacked bar graph and have the environment data. Why doesn’t it do this?