diff --git a/project/charts/demography/PopulationConsoComparisonChart.py b/project/charts/demography/PopulationConsoComparisonChart.py
index 2afa6e8f6..0a23d3fd3 100644
--- a/project/charts/demography/PopulationConsoComparisonChart.py
+++ b/project/charts/demography/PopulationConsoComparisonChart.py
@@ -35,7 +35,11 @@ def param(self):
"title": {"text": "Évolution démographique (hab)"},
"plotLines": [{"color": "#000", "width": 1, "value": 0, "zIndex": 3}],
},
- "yAxis": {"title": {"text": "Consommation d'espaces NAF (ha)"}, "maxPadding": 0.2, "min": 0},
+ "yAxis": {
+ "title": {"text": "Consommation d'espaces NAF (ha)"},
+ "maxPadding": 0.2,
+ "min": 0,
+ },
"tooltip": {
"pointFormat": (
"Consommation : {point.y} ha
"
@@ -83,70 +87,5 @@ def get_bubble_series(self):
for land in lands
]
- def get_trend_series(self):
- pop_comparison = PublicDataContainer.population_comparison_service().get_by_land(
- land=self.project.land_proxy,
- start_date=int(self.project.analyse_start_date),
- end_date=int(self.project.analyse_end_date),
- )
- pop_evolution_mediane = pop_comparison.evolution_median
- conso_mediane = (
- PublicDataContainer.consommation_comparison_service()
- .get_by_land(
- land=self.project.land_proxy,
- start_date=int(self.project.analyse_start_date),
- end_date=int(self.project.analyse_end_date),
- )
- .total_median
- )
- lands = self.project.comparison_lands_and_self_land()
- start_date = int(self.project.analyse_start_date)
- end_date = int(self.project.analyse_end_date)
-
- population_evolution = [
- p.evolution
- for p in PublicDataContainer.population_stats_service().get_by_lands(lands, start_date, end_date)
- ]
-
- max_population_evolution = max(population_evolution)
- min_population_evolution = min(population_evolution)
-
- max_conso = max(
- [
- c.total
- for c in PublicDataContainer.consommation_stats_service().get_by_lands(lands, start_date, end_date)
- ]
- )
-
- middle_point = {"x": pop_evolution_mediane, "y": conso_mediane}
- slope = (max_conso - conso_mediane) / (max_population_evolution - pop_evolution_mediane)
- low_point = {
- "x": min_population_evolution,
- "y": conso_mediane + slope * (min_population_evolution - pop_evolution_mediane),
- }
- high_point = {
- "x": max_population_evolution,
- "y": conso_mediane + slope * (max_population_evolution - pop_evolution_mediane),
- }
-
- return [
- {
- "name": (
- f"Médiane des {self.project.land.land_type_label.lower()}s
à "
- f"l'échelle de {pop_comparison.land.name}"
- ),
- "type": "line",
- "color": "black",
- "marker": {"enabled": False},
- "enableMouseTracking": False,
- "states": {"hover": {"enabled": False}},
- "data": [
- low_point,
- middle_point,
- high_point,
- ],
- }
- ]
-
def add_series(self):
- self.chart["series"] = self.get_bubble_series() + self.get_trend_series()
+ self.chart["series"] = self.get_bubble_series()