Skip to content

Commit

Permalink
adjusted predictive CO2 graph on its minimum y axis domain
Browse files Browse the repository at this point in the history
  • Loading branch information
lrdossan committed Aug 1, 2024
1 parent 1368e33 commit 627a090
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions caimira/apps/calculator/static/js/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,15 @@ function draw_generic_concentration_plot(
h_lines,
) {

list_of_scenarios = (plot_svg_id === 'CO2_concentration_graph') ? {'CO₂ concentration': {'concentrations': CO2_concentrations}} : alternative_scenarios
if (plot_svg_id === 'CO2_concentration_graph') {
list_of_scenarios = {'CO₂ concentration': {'concentrations': CO2_concentrations}};
min_y_axis_domain = 400;
}
else {
list_of_scenarios = alternative_scenarios;
min_y_axis_domain = 0;
}

// H:M format
var time_format = d3.timeFormat('%H:%M');
// D3 array of ten categorical colors represented as RGB hexadecimal strings.
Expand Down Expand Up @@ -706,7 +714,7 @@ function draw_generic_concentration_plot(
highest_concentration = Math.max(highest_concentration, Math.max(...scenario_concentrations));
}

yRange.domain([0., highest_concentration*1.1]);
yRange.domain([min_y_axis_domain, highest_concentration*1.1]);
yAxisEl.transition().duration(1000).call(yAxis);

for (const [scenario_name, data] of Object.entries(data_for_scenarios)) {
Expand Down

0 comments on commit 627a090

Please sign in to comment.