Skip to content

Commit

Permalink
Add density chart scale level
Browse files Browse the repository at this point in the history
  • Loading branch information
smdsgn committed Dec 13, 2024
1 parent 808dc26 commit 8f3a90b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions project/charts/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,3 @@ def missing_ocsge_diff_message(missing_indicateur: str) -> str:
DESARTIFICIALISATION_COLOR = "#00e272"
ARTIFICIALISATION_NETTE_COLOR = "#6a6af4"
HIGHLIGHT_COLOR = "#fa4b42"

DENSITY_MAX_IN_HA = 250 # Valeur arbitraire maximale de densité de population, Paris étant la plus elevée à 205 hab/ha
8 changes: 4 additions & 4 deletions project/charts/demography/PopulationDensityChart.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import math

from project.charts.base_project_chart import ProjectChart
from project.charts.constants import DENSITY_MAX_IN_HA
from public_data.domain.containers import PublicDataContainer


Expand All @@ -22,9 +21,9 @@ def param(self):
"title": {"text": f"Densité de population ({self.project.analyse_end_date})"},
"xAxis": {"lineColor": "transparent", "labels": {"enabled": False}, "tickLength": 0},
"yAxis": {
"tickPositions": [0, 50, 100, 150, 200, DENSITY_MAX_IN_HA],
"tickPositions": [0, 50, 100, 150, 200, 250, 300],
"min": 0,
"max": DENSITY_MAX_IN_HA,
"max": 300,
"gridLineWidth": 0,
"title": None,
"labels": {"format": "{value}"},
Expand All @@ -33,7 +32,8 @@ def param(self):
{"from": 50, "to": 100, "color": "rgb(242, 159, 142)"},
{"from": 100, "to": 150, "color": "rgb(242, 133, 111)"},
{"from": 150, "to": 200, "color": "rgb(242, 77, 45)"},
{"from": 200, "to": DENSITY_MAX_IN_HA, "color": "rgb(185, 52, 27)"},
{"from": 200, "to": 250, "color": "rgb(185, 52, 27)"},
{"from": 250, "to": 300, "color": "rgb(165, 24, 0)"},
],
},
"legend": {"enabled": False},
Expand Down

0 comments on commit 8f3a90b

Please sign in to comment.