adjusted predictive CO2 graph on its minimum y axis domain

This commit is contained in:
lrdossan 2024-08-01 09:54:02 +02:00
parent 1368e33864
commit 627a090171

View file

@ -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.
@ -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)) {