From 6634c3be74425a2ec49045d029498fa29ea1d401 Mon Sep 17 00:00:00 2001 From: Joaquim Nallar Date: Tue, 3 Dec 2024 11:43:46 +0100 Subject: [PATCH 1/2] feat: Add data source organism on species page (#538) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Un graphique de provenance des données a été rajouté afin de visualiser la participation de chaques organismes a l'observation d'un Taxon. --- atlas/atlasRoutes.py | 3 + atlas/configuration/config_schema.py | 3 +- atlas/messages.pot | 363 ++++++++++-------- .../repositories/vmCorTaxonOrganism.py | 17 + atlas/static/chart.js | 93 ++++- atlas/static/css/atlas.css | 1 + atlas/templates/speciesSheet/_main.html | 6 +- atlas/templates/speciesSheet/charts.html | 6 + atlas/translations/en/LC_MESSAGES/messages.mo | Bin 5802 -> 5852 bytes atlas/translations/en/LC_MESSAGES/messages.po | 6 +- atlas/translations/fr/LC_MESSAGES/messages.mo | Bin 6199 -> 6264 bytes atlas/translations/fr/LC_MESSAGES/messages.po | 6 +- atlas/translations/it/LC_MESSAGES/messages.mo | Bin 6054 -> 6117 bytes atlas/translations/it/LC_MESSAGES/messages.po | 6 +- docs/changelog.rst | 1 + 15 files changed, 335 insertions(+), 176 deletions(-) create mode 100644 atlas/modeles/repositories/vmCorTaxonOrganism.py diff --git a/atlas/atlasRoutes.py b/atlas/atlasRoutes.py index 21b95163d..e1a5f6c23 100644 --- a/atlas/atlasRoutes.py +++ b/atlas/atlasRoutes.py @@ -31,6 +31,7 @@ vmMedias, vmCorTaxonAttribut, vmTaxonsMostView, + vmCorTaxonOrganism, ) @@ -232,6 +233,7 @@ def ficheEspece(cd_nom): taxon = vmTaxrefRepository.searchEspece(connection, cd_ref) altitudes = vmAltitudesRepository.getAltitudesChilds(connection, cd_ref) months = vmMoisRepository.getMonthlyObservationsChilds(connection, cd_ref) + data_source_values = vmCorTaxonOrganism.getTaxonOrganism(connection, cd_ref) synonyme = vmTaxrefRepository.getSynonymy(connection, cd_ref) communes = vmCommunesRepository.getCommunesObservationsChilds(connection, cd_ref) taxonomyHierarchy = vmTaxrefRepository.getAllTaxonomy(db_session, cd_ref) @@ -274,6 +276,7 @@ def ficheEspece(cd_nom): cd_ref=cd_ref, altitudes=altitudes, months=months, + data_source_values=data_source_values, synonyme=synonyme, communes=communes, taxonomyHierarchy=taxonomyHierarchy, diff --git a/atlas/configuration/config_schema.py b/atlas/configuration/config_schema.py index e1e292cd1..fe52bad08 100644 --- a/atlas/configuration/config_schema.py +++ b/atlas/configuration/config_schema.py @@ -138,7 +138,8 @@ class Meta: AFFICHAGE_NOUVELLES_ESPECES = fields.Boolean(load_default=True) AFFICHAGE_RECHERCHE_AVANCEE = fields.Boolean(load_default=False) AFFICHAGE_GRAPH_ALTITUDES = fields.Boolean(load_default=True) - AFFICHAGE_GRAPH_PHENOLOGIE = fields.Boolean(load_default=True) + AFFICHAGE_GRAPH_PHENOLOGIE = fields.Boolean(load_default=False) + AFFICHAGE_GRAPH_PROVENANCE_DONNEE = fields.Boolean(load_default=False) RANG_STAT = fields.List( fields.Dict, diff --git a/atlas/messages.pot b/atlas/messages.pot index c36bb800d..26628d782 100644 --- a/atlas/messages.pot +++ b/atlas/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2024-09-27 10:32+0200\n" +"POT-Creation-Date: 2024-12-02 12:01+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,470 +17,503 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.9.1\n" -#: static/custom/templates/bandeaulogoshome.html:6 -#: static/custom/templates/bandeaulogoshome.html.sample:6 +#: atlas/static/custom/templates/bandeaulogoshome.html:6 +#: atlas/static/custom/templates/bandeaulogoshome.html.sample:6 msgid "home.partners" msgstr "" -#: static/custom/templates/footer.html:2 -#: static/custom/templates/footer.html.sample:2 templates/home/_main.html:3 +#: atlas/static/custom/templates/footer.html:2 +#: atlas/static/custom/templates/footer.html.sample:2 +#: atlas/templates/home/_main.html:3 msgid "home" msgstr "" -#: static/custom/templates/footer.html:5 static/custom/templates/footer.html:29 -#: static/custom/templates/footer.html.sample:5 -#: static/custom/templates/footer.html.sample:29 +#: atlas/static/custom/templates/footer.html:5 +#: atlas/static/custom/templates/footer.html:30 +#: atlas/static/custom/templates/footer.html.sample:5 +#: atlas/static/custom/templates/footer.html.sample:29 msgid "credits" msgstr "" -#: static/custom/templates/footer.html:7 static/custom/templates/footer.html:46 -#: static/custom/templates/footer.html.sample:7 -#: static/custom/templates/footer.html.sample:46 +#: atlas/static/custom/templates/footer.html:7 +#: atlas/static/custom/templates/footer.html:47 +#: atlas/static/custom/templates/footer.html.sample:7 +#: atlas/static/custom/templates/footer.html.sample:46 msgid "legal" msgstr "" -#: static/custom/templates/footer.html:11 -#: static/custom/templates/footer.html:64 -#: static/custom/templates/footer.html.sample:11 -#: static/custom/templates/footer.html.sample:64 +#: atlas/static/custom/templates/footer.html:11 +#: atlas/static/custom/templates/footer.html:65 +#: atlas/static/custom/templates/footer.html.sample:11 +#: atlas/static/custom/templates/footer.html.sample:64 msgid "personal_data" msgstr "" -#: static/custom/templates/footer.html:17 -#: static/custom/templates/footer.html.sample:17 +#: atlas/static/custom/templates/footer.html:12 +msgid "preferences_cookies" +msgstr "" + +#: atlas/static/custom/templates/footer.html:18 +#: atlas/static/custom/templates/footer.html.sample:17 msgid "atlas.fauna.flora" msgstr "" -#: static/custom/templates/footer.html:17 -#: static/custom/templates/footer.html.sample:17 -#: static/custom/templates/introduction.html:7 -#: static/custom/templates/introduction.html.sample:7 +#: atlas/static/custom/templates/footer.html:18 +#: atlas/static/custom/templates/footer.html.sample:17 +#: atlas/static/custom/templates/introduction.html:7 +#: atlas/static/custom/templates/introduction.html.sample:7 msgid "from1" msgstr "" -#: static/custom/templates/footer.html:19 -#: static/custom/templates/footer.html.sample:19 +#: atlas/static/custom/templates/footer.html:20 +#: atlas/static/custom/templates/footer.html.sample:19 msgid "powered.by" msgstr "" -#: static/custom/templates/footer.html:19 -#: static/custom/templates/footer.html.sample:19 +#: atlas/static/custom/templates/footer.html:20 +#: atlas/static/custom/templates/footer.html.sample:19 msgid "developed.by" msgstr "" -#: static/custom/templates/footer.html:20 -#: static/custom/templates/footer.html.sample:20 +#: atlas/static/custom/templates/footer.html:21 +#: atlas/static/custom/templates/footer.html.sample:20 msgid "ecrins.national.park" msgstr "" -#: static/custom/templates/introduction.html:6 -#: static/custom/templates/introduction.html.sample:6 +#: atlas/static/custom/templates/introduction.html:6 +#: atlas/static/custom/templates/introduction.html.sample:6 msgid "welcome.message" msgstr "" -#: static/custom/templates/introduction.html:7 -#: static/custom/templates/introduction.html.sample:7 +#: atlas/static/custom/templates/introduction.html:7 +#: atlas/static/custom/templates/introduction.html.sample:7 msgid "from2" msgstr "" -#: static/custom/templates/introduction.html:7 -#: static/custom/templates/introduction.html.sample:7 +#: atlas/static/custom/templates/introduction.html:7 +#: atlas/static/custom/templates/introduction.html.sample:7 msgid "from3" msgstr "" -#: static/custom/templates/introduction.html:7 -#: static/custom/templates/introduction.html.sample:7 +#: atlas/static/custom/templates/introduction.html:7 +#: atlas/static/custom/templates/introduction.html.sample:7 msgid "from4" msgstr "" -#: static/custom/templates/introduction.html:7 -#: static/custom/templates/introduction.html.sample:7 +#: atlas/static/custom/templates/introduction.html:7 +#: atlas/static/custom/templates/introduction.html.sample:7 msgid "from5" msgstr "" -#: static/custom/templates/introduction.html:11 -#: static/custom/templates/introduction.html.sample:11 +#: atlas/static/custom/templates/introduction.html:11 +#: atlas/static/custom/templates/introduction.html.sample:11 msgid "home.introduction.message" msgstr "" -#: static/custom/templates/navbar.html:34 -#: static/custom/templates/navbar.html.sample:34 -#: templates/home/globalStats.html:35 templates/photoGalery/_main.html:77 +#: atlas/static/custom/templates/navbar.html:34 +#: atlas/static/custom/templates/navbar.html.sample:34 +#: atlas/templates/home/globalStats.html:35 +#: atlas/templates/photoGalery/_main.html:77 msgid "search.species" msgstr "" -#: static/custom/templates/navbar.html:47 -#: static/custom/templates/navbar.html.sample:47 -#: templates/home/globalStats.html:55 +#: atlas/static/custom/templates/navbar.html:47 +#: atlas/static/custom/templates/navbar.html.sample:47 +#: atlas/templates/home/globalStats.html:55 msgid "search.city" msgstr "" -#: static/custom/templates/presentation.html:4 -#: static/custom/templates/presentation.html.sample:4 +#: atlas/static/custom/templates/presentation.html:4 +#: atlas/static/custom/templates/presentation.html.sample:4 msgid "atlas.presentation" msgstr "" -#: templates/areaSheet/_main.html:6 templates/areaSheet/_main.html:59 +#: atlas/templates/areaSheet/_main.html:6 +#: atlas/templates/areaSheet/_main.html:59 msgid "municipality.of" msgstr "" -#: templates/areaSheet/_main.html:70 +#: atlas/templates/areaSheet/_main.html:70 msgid "last.obs.municipality" msgstr "" -#: templates/areaSheet/_main.html:73 +#: atlas/templates/areaSheet/_main.html:73 msgid "last.obs.zone" msgstr "" -#: templates/areaSheet/surrounding_areas.html:10 +#: atlas/templates/areaSheet/surrounding_areas.html:10 msgid "associate.zone" msgstr "" -#: templates/areaSheet/surrounding_areas.html:23 +#: atlas/templates/areaSheet/surrounding_areas.html:23 msgid "check.area.sheet" msgstr "" -#: templates/core/advanced_search.html:4 -#: templates/core/advanced_search.html:382 templates/core/sideBar.html:30 +#: atlas/templates/core/advanced_search.html:4 +#: atlas/templates/core/advanced_search.html:382 +#: atlas/templates/core/sideBar.html:30 msgid "advanced_search" msgstr "" -#: templates/core/advanced_search.html:350 +#: atlas/templates/core/advanced_search.html:350 msgid "information" msgstr "" -#: templates/core/advanced_search.html:351 -#: templates/core/advanced_search.html:361 +#: atlas/templates/core/advanced_search.html:351 +#: atlas/templates/core/advanced_search.html:361 msgid "close" msgstr "" -#: templates/core/advanced_search.html:357 +#: atlas/templates/core/advanced_search.html:357 msgid "asearch.information" msgstr "" -#: templates/core/advanced_search.html:373 +#: atlas/templates/core/advanced_search.html:373 msgid "page.information" msgstr "" -#: templates/core/advanced_search.html:385 -#: templates/core/advanced_search.html:408 +#: atlas/templates/core/advanced_search.html:385 +#: atlas/templates/core/advanced_search.html:408 msgid "asearch.max" msgstr "" -#: templates/core/advanced_search.html:392 +#: atlas/templates/core/advanced_search.html:392 msgid "asearch.search.species" msgstr "" -#: templates/core/advanced_search.html:395 +#: atlas/templates/core/advanced_search.html:395 msgid "asearch.search.start" msgstr "" -#: templates/core/advanced_search.html:419 +#: atlas/templates/core/advanced_search.html:419 msgid "asearch.remove.selection" msgstr "" -#: templates/core/advanced_search.html:427 templates/core/listTaxons.html:87 -#: templates/home/lastObs.html:44 templates/home/mostViewNow.html:33 -#: templates/home/newSpecies.html:45 templates/home/taxoRank.html:61 -#: templates/organismSheet/topSpecies.html:67 +#: atlas/templates/core/advanced_search.html:427 +#: atlas/templates/core/listTaxons.html:87 atlas/templates/home/lastObs.html:44 +#: atlas/templates/home/mostViewNow.html:33 +#: atlas/templates/home/newSpecies.html:45 +#: atlas/templates/home/taxoRank.html:61 +#: atlas/templates/organismSheet/topSpecies.html:67 msgid "species.sheet" msgstr "" -#: templates/core/advanced_search.html:429 templates/core/listTaxons.html:86 -#: templates/core/tabTaxons.html:87 templates/organismSheet/topSpecies.html:66 -#: templates/speciesSheet/identityCard.html:180 +#: atlas/templates/core/advanced_search.html:429 +#: atlas/templates/core/listTaxons.html:86 +#: atlas/templates/core/tabTaxons.html:87 +#: atlas/templates/organismSheet/topSpecies.html:66 +#: atlas/templates/speciesSheet/identityCard.html:180 msgid "check.species.sheet" msgstr "" -#: templates/core/extended_areas_search.html:13 +#: atlas/templates/core/extended_areas_search.html:13 msgid "search.other.zones.type" msgstr "" -#: templates/core/listTaxons.html:14 +#: atlas/templates/core/listTaxons.html:14 msgid "filter.species" msgstr "" -#: templates/core/listTaxons.html:23 +#: atlas/templates/core/listTaxons.html:23 msgid "display.municipality.obs" msgstr "" -#: templates/core/listTaxons.html:49 templates/core/tabTaxons.html:62 -#: templates/organismSheet/topSpecies.html:36 -#: templates/speciesSheet/identityCard.html:64 -#: templates/speciesSheet/identityCard.html:158 +#: atlas/templates/core/listTaxons.html:49 +#: atlas/templates/core/tabTaxons.html:62 +#: atlas/templates/organismSheet/topSpecies.html:36 +#: atlas/templates/speciesSheet/identityCard.html:64 +#: atlas/templates/speciesSheet/identityCard.html:158 msgid "this.taxon.has.a.protected.status" msgstr "" -#: templates/core/listTaxons.html:80 templates/core/statHierarchy.html:7 -#: templates/organismSheet/topSpecies.html:61 -#: templates/speciesSheet/map.html:15 -#: templates/speciesSheet/otherInformations.html:144 +#: atlas/templates/core/listTaxons.html:80 +#: atlas/templates/core/statHierarchy.html:7 +#: atlas/templates/organismSheet/topSpecies.html:61 +#: atlas/templates/speciesSheet/map.html:15 +#: atlas/templates/speciesSheet/otherInformations.html:144 msgid "observation" msgstr "" -#: templates/core/listTaxons.html:81 templates/core/statHierarchy.html:7 -#: templates/core/tabTaxons.html:19 templates/home/globalStats.html:16 -#: templates/organismSheet/statsInfos.html:11 -#: templates/organismSheet/topSpecies.html:61 -#: templates/speciesSheet/identityCard.html:135 -#: templates/speciesSheet/map.html:15 -#: templates/speciesSheet/otherInformations.html:142 +#: atlas/templates/core/listTaxons.html:81 +#: atlas/templates/core/statHierarchy.html:7 +#: atlas/templates/core/tabTaxons.html:19 +#: atlas/templates/home/globalStats.html:16 +#: atlas/templates/organismSheet/statsInfos.html:11 +#: atlas/templates/organismSheet/topSpecies.html:61 +#: atlas/templates/speciesSheet/identityCard.html:135 +#: atlas/templates/speciesSheet/map.html:15 +#: atlas/templates/speciesSheet/otherInformations.html:142 msgid "observations" msgstr "" -#: templates/core/listTaxons.html:82 +#: atlas/templates/core/listTaxons.html:82 msgid "last.obs.in" msgstr "" -#: templates/core/loaderSpinner.html:3 +#: atlas/templates/core/loaderSpinner.html:3 msgid "loading" msgstr "" -#: templates/core/sideBar.html:3 +#: atlas/templates/core/sideBar.html:3 msgid "back.to.home" msgstr "" -#: templates/core/sideBar.html:35 templates/home/globalStats.html:68 -#: templates/photoGalery/_main.html:5 templates/photoGalery/_main.html:51 +#: atlas/templates/core/sideBar.html:35 +#: atlas/templates/home/globalStats.html:68 +#: atlas/templates/photoGalery/_main.html:5 +#: atlas/templates/photoGalery/_main.html:51 msgid "gallery.title" msgstr "" -#: templates/core/statHierarchy.html:12 templates/home/globalStats.html:28 -#: templates/home/taxoRank.html:32 templates/organismSheet/statsInfos.html:21 +#: atlas/templates/core/statHierarchy.html:12 +#: atlas/templates/home/globalStats.html:28 +#: atlas/templates/home/taxoRank.html:32 +#: atlas/templates/organismSheet/statsInfos.html:21 msgid "species" msgstr "" -#: templates/core/statHierarchy.html:17 templates/speciesSheet/map.html:25 -#: templates/speciesSheet/otherInformations.html:28 +#: atlas/templates/core/statHierarchy.html:17 +#: atlas/templates/speciesSheet/map.html:25 +#: atlas/templates/speciesSheet/otherInformations.html:28 msgid "observers" msgstr "" -#: templates/core/statHierarchy.html:17 templates/speciesSheet/map.html:25 -#: templates/speciesSheet/otherInformations.html:28 +#: atlas/templates/core/statHierarchy.html:17 +#: atlas/templates/speciesSheet/map.html:25 +#: atlas/templates/speciesSheet/otherInformations.html:28 msgid "observer" msgstr "" -#: templates/core/tabTaxons.html:7 +#: atlas/templates/core/tabTaxons.html:7 msgid "group" msgstr "" -#: templates/core/tabTaxons.html:8 templates/speciesSheet/identityCard.html:128 +#: atlas/templates/core/tabTaxons.html:8 +#: atlas/templates/speciesSheet/identityCard.html:128 msgid "scientific.name" msgstr "" -#: templates/core/tabTaxons.html:9 templates/speciesSheet/identityCard.html:127 +#: atlas/templates/core/tabTaxons.html:9 +#: atlas/templates/speciesSheet/identityCard.html:127 msgid "common.name" msgstr "" -#: templates/core/tabTaxons.html:16 +#: atlas/templates/core/tabTaxons.html:16 msgid "obs.number.s" msgstr "" -#: templates/core/tabTaxons.html:17 templates/speciesSheet/map.html:38 +#: atlas/templates/core/tabTaxons.html:17 +#: atlas/templates/speciesSheet/map.html:38 msgid "last.obs" msgstr "" -#: templates/core/tabTaxons.html:21 -#: templates/speciesSheet/identityCard.html:136 +#: atlas/templates/core/tabTaxons.html:21 +#: atlas/templates/speciesSheet/identityCard.html:136 msgid "sheet" msgstr "" -#: templates/core/tabTaxons.html:82 +#: atlas/templates/core/tabTaxons.html:82 msgid "display.city.infos" msgstr "" -#: templates/home/globalStats.html:4 +#: atlas/templates/home/globalStats.html:4 msgid "home.insomefigures" msgstr "" -#: templates/home/globalStats.html:18 +#: atlas/templates/home/globalStats.html:18 msgid "home.seelatestobs" msgstr "" -#: templates/home/globalStats.html:47 templates/speciesSheet/map.html:20 -#: templates/speciesSheet/otherInformations.html:10 -#: templates/speciesSheet/otherInformations.html:14 +#: atlas/templates/home/globalStats.html:47 +#: atlas/templates/speciesSheet/map.html:20 +#: atlas/templates/speciesSheet/otherInformations.html:10 +#: atlas/templates/speciesSheet/otherInformations.html:14 msgid "municipalities" msgstr "" -#: templates/home/globalStats.html:67 +#: atlas/templates/home/globalStats.html:67 msgid "photos" msgstr "" -#: templates/home/mostViewNow.html:5 +#: atlas/templates/home/mostViewNow.html:5 msgid "see.at.the.moment" msgstr "" -#: templates/home/mostViewNow.html:7 +#: atlas/templates/home/mostViewNow.html:7 msgid "species.most.obs.last.15.days" msgstr "" -#: templates/home/newSpecies.html:10 +#: atlas/templates/home/newSpecies.html:10 msgid "new.species.observed" msgstr "" -#: templates/home/taxoRank.html:8 +#: atlas/templates/home/taxoRank.html:8 msgid "species.to.discover" msgstr "" -#: templates/organismSheet/blocInfos.html:4 +#: atlas/templates/organismSheet/blocInfos.html:4 msgid "other.informations" msgstr "" -#: templates/organismSheet/groupChart.html:3 +#: atlas/templates/organismSheet/groupChart.html:3 msgid "part.graph" msgstr "" -#: templates/organismSheet/identityCard.html:20 +#: atlas/templates/organismSheet/identityCard.html:20 msgid "Adresse" msgstr "" -#: templates/organismSheet/identityCard.html:21 +#: atlas/templates/organismSheet/identityCard.html:21 msgid "Téléphone" msgstr "" -#: templates/organismSheet/identityCard.html:22 +#: atlas/templates/organismSheet/identityCard.html:22 msgid "Email" msgstr "" -#: templates/organismSheet/identityCard.html:23 +#: atlas/templates/organismSheet/identityCard.html:23 msgid "Site" msgstr "" -#: templates/organismSheet/mapObs.html:5 +#: atlas/templates/organismSheet/mapObs.html:5 msgid "map.observations" msgstr "" -#: templates/organismSheet/statsInfos.html:4 +#: atlas/templates/organismSheet/statsInfos.html:4 msgid "organism.stats" msgstr "" -#: templates/organismSheet/statsInfos.html:16 +#: atlas/templates/organismSheet/statsInfos.html:16 msgid "atlas.participation" msgstr "" -#: templates/organismSheet/topSpecies.html:5 +#: atlas/templates/organismSheet/topSpecies.html:5 msgid "top.species" msgstr "" -#: templates/organismSheet/topSpecies.html:62 +#: atlas/templates/organismSheet/topSpecies.html:62 msgid "from.organism.observations" msgstr "" -#: templates/photoGalery/_main.html:65 templates/photoGalery/_main.html:66 +#: atlas/templates/photoGalery/_main.html:65 +#: atlas/templates/photoGalery/_main.html:66 msgid "all.groups" msgstr "" -#: templates/photoGalery/_main.html:71 +#: atlas/templates/photoGalery/_main.html:71 msgid "order.photos" msgstr "" -#: templates/speciesSheet/audioVideo.html:7 +#: atlas/templates/speciesSheet/audioVideo.html:7 msgid "Video" msgstr "" -#: templates/speciesSheet/blocInfos.html:11 +#: atlas/templates/speciesSheet/blocInfos.html:11 msgid "species.infos" msgstr "" -#: templates/speciesSheet/blocInfos.html:14 -#: templates/speciesSheet/descriptionMedia.html:16 -#: templates/speciesSheet/otherInformations.html:69 +#: atlas/templates/speciesSheet/blocInfos.html:14 +#: atlas/templates/speciesSheet/descriptionMedia.html:16 +#: atlas/templates/speciesSheet/otherInformations.html:69 msgid "description" msgstr "" -#: templates/speciesSheet/blocInfos.html:17 +#: atlas/templates/speciesSheet/blocInfos.html:17 msgid "read.more" msgstr "" -#: templates/speciesSheet/blocInfos.html:19 +#: atlas/templates/speciesSheet/blocInfos.html:19 msgid "environment" msgstr "" -#: templates/speciesSheet/blocInfos.html:20 +#: atlas/templates/speciesSheet/blocInfos.html:20 msgid "repartition" msgstr "" -#: templates/speciesSheet/blocInfos.html:21 +#: atlas/templates/speciesSheet/blocInfos.html:21 msgid "synonyms" msgstr "" -#: templates/speciesSheet/blocInfos.html:27 -#: templates/speciesSheet/blocInfos.html:39 -#: templates/speciesSheet/blocInfos.html:46 +#: atlas/templates/speciesSheet/blocInfos.html:27 +#: atlas/templates/speciesSheet/blocInfos.html:39 +#: atlas/templates/speciesSheet/blocInfos.html:46 msgid "not.resigned.for.the.moment" msgstr "" -#: templates/speciesSheet/blocInfos.html:53 +#: atlas/templates/speciesSheet/blocInfos.html:53 msgid "no.synonym.for.this.taxon" msgstr "" -#: templates/speciesSheet/charts.html:4 +#: atlas/templates/speciesSheet/charts.html:4 msgid "alt.classes.obs" msgstr "" -#: templates/speciesSheet/charts.html:10 +#: atlas/templates/speciesSheet/charts.html:10 msgid "monthly.obs" msgstr "" -#: templates/speciesSheet/descriptionMedia.html:12 -#: templates/speciesSheet/otherInformations.html:42 +#: atlas/templates/speciesSheet/charts.html:16 +msgid "data.source" +msgstr "" + +#: atlas/templates/speciesSheet/descriptionMedia.html:12 +#: atlas/templates/speciesSheet/otherInformations.html:42 msgid "author" msgstr "" -#: templates/speciesSheet/identityCard.html:97 +#: atlas/templates/speciesSheet/identityCard.html:97 msgid "check.species.sheet.inpn" msgstr "" -#: templates/speciesSheet/identityCard.html:130 +#: atlas/templates/speciesSheet/identityCard.html:130 msgid "protection" msgstr "" -#: templates/speciesSheet/map.html:20 -#: templates/speciesSheet/otherInformations.html:10 -#: templates/speciesSheet/otherInformations.html:14 +#: atlas/templates/speciesSheet/map.html:20 +#: atlas/templates/speciesSheet/otherInformations.html:10 +#: atlas/templates/speciesSheet/otherInformations.html:14 msgid "municipality" msgstr "" -#: templates/speciesSheet/map.html:29 -#: templates/speciesSheet/otherInformations.html:21 +#: atlas/templates/speciesSheet/map.html:29 +#: atlas/templates/speciesSheet/otherInformations.html:21 msgid "organisms" msgstr "" -#: templates/speciesSheet/map.html:29 -#: templates/speciesSheet/otherInformations.html:21 +#: atlas/templates/speciesSheet/map.html:29 +#: atlas/templates/speciesSheet/otherInformations.html:21 msgid "organism" msgstr "" -#: templates/speciesSheet/map.html:34 +#: atlas/templates/speciesSheet/map.html:34 msgid "first.obs" msgstr "" -#: templates/speciesSheet/otherInformations.html:41 +#: atlas/templates/speciesSheet/otherInformations.html:41 msgid "title" msgstr "" -#: templates/speciesSheet/otherInformations.html:71 +#: atlas/templates/speciesSheet/otherInformations.html:71 msgid "date" msgstr "" -#: templates/speciesSheet/otherInformations.html:139 +#: atlas/templates/speciesSheet/otherInformations.html:139 msgid "organism.participation" msgstr "" -#: templates/speciesSheet/otherInformations.html:147 +#: atlas/templates/speciesSheet/otherInformations.html:147 msgid "organism.prospection" msgstr "" -#: templates/speciesSheet/otherInformations.html:153 +#: atlas/templates/speciesSheet/otherInformations.html:153 msgid "check.organism.sheet" msgstr "" -#: templates/speciesSheet/otherInformations.html:154 +#: atlas/templates/speciesSheet/otherInformations.html:154 msgid "organism.sheet" msgstr "" -#: templates/taxoRankSheet/_main.html:47 +#: atlas/templates/taxoRankSheet/_main.html:47 msgid "species.obs.for.tax" msgstr "" diff --git a/atlas/modeles/repositories/vmCorTaxonOrganism.py b/atlas/modeles/repositories/vmCorTaxonOrganism.py new file mode 100644 index 000000000..270b29222 --- /dev/null +++ b/atlas/modeles/repositories/vmCorTaxonOrganism.py @@ -0,0 +1,17 @@ +# -*- coding:utf-8 -*- + +from sqlalchemy.sql import text + + +def getTaxonOrganism(connection, cd_ref): + sql = """ + select nom_organism, nb_observations + from atlas.vm_cor_taxon_organism + where cd_ref = :cdref + """ + result = connection.execute(text(sql), cdref=cd_ref) + + taxon_orga = {} + for elem in result: + taxon_orga.update({elem[0]: elem[1]}) + return taxon_orga diff --git a/atlas/static/chart.js b/atlas/static/chart.js index 57b546786..435d5d4a7 100644 --- a/atlas/static/chart.js +++ b/atlas/static/chart.js @@ -1,6 +1,7 @@ // ChartJS Graphs const chartMainColor = getComputedStyle(document.documentElement).getPropertyValue('--main-color'); -const chartHoverMainColor = getComputedStyle(document.documentElement).getPropertyValue('--second-color'); +const chartSecondColor = getComputedStyle(document.documentElement).getPropertyValue('--second-color'); +const chartThirdColor = getComputedStyle(document.documentElement).getPropertyValue('--third-color'); const getChartDatas = function (data, key) { let values = []; @@ -20,7 +21,7 @@ genericChart = function (element, labels, values) { label: 'observations', data: values, backgroundColor: chartMainColor, - hoverBackgroundColor: chartHoverMainColor, + hoverBackgroundColor: chartSecondColor, borderWidth: 0 }] }, @@ -48,8 +49,90 @@ genericChart = function (element, labels, values) { }); }; -var monthChartElement = document.getElementById('monthChart'); -const monthChart = genericChart(monthChartElement, months_name, getChartDatas(months_value, 'value')); +pieChartConfig = function (element, data) { + return new Chart(element, { + type: 'doughnut', + data: data, + options: { + responsive: true, + cutout: "30%", + maintainAspectRatio: false, + plugins: { + legend: { + position: 'top', + }, + title: { + display: false, + text: 'Graphique des provenances de données' + } + } + } + }) +} +function getPieEndColor(index, isLastElem) { + // To change color if last element will have the same color to first element + if (isLastElem && index % 3 === 0) { + index++ + } + + if (index % 3 === 0) { + return chartMainColor + } else if (index % 3 === 1) { + return chartSecondColor + } + return chartThirdColor +} + +function formatPieData(data) { + let labels = [] + let data_count = [] + Object.keys(data).forEach(key => { + labels.push(key) + data_count.push(data[key]) + }) + + const element = document.getElementById("organismChart"); + const context2d = element.getContext("2d"); + + return { + labels: labels, + datasets: [ + { + label: 'Dataset 1', + data: data_count, + backgroundColor: context => { + if (context.element.x && context.element.y) { + const grad = context2d.createRadialGradient( + context.element.x, + context.element.y, + context.element.innerRadius, + context.element.x, + context.element.y, + context.element.outerRadius); + const isLastElem = context.index === data_count.length - 1 + + grad.addColorStop(0, chartMainColor); + grad.addColorStop(1, getPieEndColor(context.index, isLastElem)); + return grad + } + }, + hoverOffset: 25 + } + ] + } +} + +var monthChartElement = document.getElementById('monthChart'); +if (monthChartElement) { + const monthChart = genericChart(monthChartElement, months_name, getChartDatas(months_value, 'value')); +} var altiChartElement = document.getElementById('altiChart'); -const altiChart = genericChart(altiChartElement, getChartDatas(dataset, 'altitude'), getChartDatas(dataset, 'value')); +if (altiChartElement) { + const altiChart = genericChart(altiChartElement, getChartDatas(dataset, 'altitude'), getChartDatas(dataset, 'value')); +} + +const dataSourceChartElement = document.getElementById('organismChart'); +if (dataSourceChartElement) { + const organismChart = pieChartConfig(dataSourceChartElement, formatPieData(data_source_values)); +} diff --git a/atlas/static/css/atlas.css b/atlas/static/css/atlas.css index 0513c98d0..515d12f89 100644 --- a/atlas/static/css/atlas.css +++ b/atlas/static/css/atlas.css @@ -1,6 +1,7 @@ :root { --main-color: #c3b528; --second-color: #5a7526; + --third-color: #2c410a; --map-maille-border-color: #ddd; --map-maille-lastobs-border-color: #c218d0; --map-territory-border-color: #333; diff --git a/atlas/templates/speciesSheet/_main.html b/atlas/templates/speciesSheet/_main.html index 08715e684..45fb6f4ba 100644 --- a/atlas/templates/speciesSheet/_main.html +++ b/atlas/templates/speciesSheet/_main.html @@ -41,7 +41,9 @@ var months_name = {{ configuration.AVAILABLE_LANGUAGES[g.lang_code]['months'] | tojson }}; {% else %} var months_name = {{ configuration.AVAILABLE_LANGUAGES[configuration.DEFAULT_LANGUAGE]['months'] | tojson }}; - + {% endif %} + {% if configuration.ORGANISM_MODULE and configuration.AFFICHAGE_GRAPH_PROVENANCE_DONNEE %} + var data_source_values = {{ data_source_values | tojson}}; {% endif %} var observationsPoint = []; var observationsMaille = []; @@ -92,4 +94,4 @@
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/atlas/templates/speciesSheet/charts.html b/atlas/templates/speciesSheet/charts.html index f12648a20..a20a09882 100644 --- a/atlas/templates/speciesSheet/charts.html +++ b/atlas/templates/speciesSheet/charts.html @@ -12,5 +12,11 @@

{{ _('monthly.obs') }}

{% endif %} + {% if configuration.ORGANISM_MODULE and configuration.AFFICHAGE_GRAPH_PROVENANCE_DONNEE %} +

{{ _('data.source') }}

+
+ +
+ {% endif %} {% endblock %} diff --git a/atlas/translations/en/LC_MESSAGES/messages.mo b/atlas/translations/en/LC_MESSAGES/messages.mo index 39dcdca50ea2f3751f1ae1fef0f49eb0c396cf71..936f5d462e4009716921462dfa786bb3aa7aedc1 100644 GIT binary patch delta 1705 zcmYMzTS!zv9LMny*Gpd3GOt;-r9NaSu9*)d6%j=eLXf3s53895p|X-rIw#GS=ZY z{Pyx+%)cO5z5l=RP-7zL?!ge;k1<$>5$Lo1R$NH`JZgLoCgA`k;5f$NG&=DQF5q$F z44Zqnfqq@n_?MrFDI=V1{p!V=Vk4c2C>&wAW?3ZogiFBbB+KtJ~Zw6^- z-~>_tu?6UnouimK_%KALH%i) zE>2p}E!5r*p|0PzK1Bt1jY@0^wUY0)AH>B(`q8L~GfDjh{a~VK&*M;uWui*B9#yFwsLGTehpFJCabDE86R4N=94fJ1)B*-j zTjqN}LleA3y`3|5z%Nu{4o)tNM^_9FtRqQ7!fe6Z>=Mqo}rlGcE6=q<*y6wb_C5`@qD<==)bkrr2^FF$xErtejkzJ9ll4du5J0P#jek9P4q_d+QpjYCW};Rjz8U Mr@kgI5;Gn87m#G0{Qv*} delta 1661 zcmYMzOGs2v9LMp$IjQ4geDrWCEAvq?VN9c9h1seX+A_@^v@i)J5ChAK7^IARg+-x+ zNooYS5+))Li?jl95d>vqw6QW*<))+}`u^%f!=3xN=bm%_=l?(F-nV&!dEs|yp6kZ1 zihlqSj`8#!!isD&mBZnUX4n$5jm_Sp7mEn z*Jx?a`(4Lf=RH(_N2tWcQI))O?GKnvdk!_RmqA)dKWc>ns1*vL=GlxZaVP2>I-0=x ztE17~xQMFw2Cl&YRG_EGVH2E`z$A7=u|=r<27<`5sQxA-C%b~Hum{I*7_%@;wpxk) ze-{yMsN;$2m_hCNJStNkQMH6wsFf;2txPd;*iKFwSB@H2i+X9#p%Uvx70`>?vO&~K z8Gh_Ko}n^&ftfgsO31@a?d>{LfMO&k+l^Z43RHzPsDPK89nP!HE@uzw`937EunoD6 z`^cO&j9o141Zpd)C`WsI9F@QYRE3?KRN(*y@FA|oS=0nxmP1?MM?zUPs*nOy{~k=# z_rKo_sCENRq5`+!pRWV86{DyGUZcL2_oxKtP+RdGbJ4>rx*tHTP(J414%Ec8sF(6I zdiDJ`aiM{2s0wbP0*xT=i%p~Ud=6F7yfd1tG_enrkRP>zxu`uZbe5swS0RsD1L~b< z#eK@8lMC66<#-E~@i$Zg8APKv3!o}1L46&&P=RWYp;m`_t~pW}b0R7-8Qbph1-Imd ZiZV9^x8{d71VfSf#JcFn*W`~ezX9X-kYfM< diff --git a/atlas/translations/en/LC_MESSAGES/messages.po b/atlas/translations/en/LC_MESSAGES/messages.po index 8b6ec8e66..b7a12ad7a 100644 --- a/atlas/translations/en/LC_MESSAGES/messages.po +++ b/atlas/translations/en/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2024-09-27 10:32+0200\n" +"POT-Creation-Date: 2024-12-02 12:01+0100\n" "PO-Revision-Date: 2021-07-12 12:12+0200\n" "Last-Translator: FULL NAME \n" "Language: en\n" @@ -436,6 +436,10 @@ msgstr "Observations by altitude class" msgid "monthly.obs" msgstr "Monthly observations" +#: atlas/templates/speciesSheet/charts.html:16 +msgid "data.source" +msgstr "Data provenance graph" + #: templates/speciesSheet/descriptionMedia.html:12 #: templates/speciesSheet/otherInformations.html:42 msgid "author" diff --git a/atlas/translations/fr/LC_MESSAGES/messages.mo b/atlas/translations/fr/LC_MESSAGES/messages.mo index 388a3706a2b9576a41a8702854a7fbdb5f4e583c..d1b4271a13c2835b690a2540d269162efd9c6001 100644 GIT binary patch delta 1722 zcmYM#Ye>^k7{~E5op)zunVMzG7DY1IOrb&uDik9OxR%k&4MO080Li!|j#ZjDxFL5q@!3_M1vw7TP zB+WeN#w@-lMZPnYn2yz$iM6N%2T&8Wp(f}?6*h#L_%`x34{ZDxoy4zfJc-IXg;~sR zelk#^gyfkC3Q&nwqAFdBDOip3aR+L`X6sRF#M)s!gD&nnZ{tg-Li$h(y^eXzZ^jtt z#@9$o%oM7C81gpp%&s^cvoRNSe=(|%a%2r=9ja3sQTNxP7O)Ss;#SnwwWB(D0V8<~ zt})2Ranz0PQ3vL3scc{XqP%HUiV+R*=h+U|Om!djZit11WszaMl^K8R~xHpad z>oA?LUv#13tEiO?<6^vzO7szVo6mfxfM0ml!4}aDUGF5j3hhO$v>&z7yXe6u_!PgP z7sn!$tHU>qYN3;?%P=4H;Cgi9Hq?DB)^n&%4WJ4hve(B^op^^jE5A^OHicxm--F6q z#E0gKlrvCeTT!R;2x=wAQ7brwDyY}`5Orq0q7o+3XYIKQHDMtx!c`cDJFK7&ickqlF@#m9R^CCi@CEX$`G8tk3=7f02~{2s>VL@!^kHSR zDzV9t94KxMw=~rSqa#V3&J2Hv*H_~9m#p#mi+uj*_ViEjODdZJjSc$`wFKSuL3d+Q ZxHT9Ggz6MEyX(WD(8ORcT9z4?{0}Cvq9yLKqV>;2QlMGTMhj$^ zA(T*oVNrxp_{X$h&>|!RZKP3{6eJYY_g4p!r=NS?ym#)o=ib3_-wj{jRZ93t$4?c% z)A*eqrs)4qX{2+pgzGQ@%P#~R$70k(8_f!{%G_zzVm!|^Slo;%qy;tc5uAb@7|;CfHUnDW zf~XY?A(#7L@fVy#{1cTpg{oAD7pdK4qdHW8dVd*e0VSvvZ$fR^cGN-}Q3bSNU@C(y z272%wD#3uoL#RTAk;{$Q{U3JU!vWCVCZiJPq9$HqmZIJ(N3FaXRcI4(xt19EuN9pj z(w<+i4=$P4Q3?7`g#}S7d2aE0OeG#eO&rZb>SP+KLwTqU`B3u|VFs>3ouRF<^j{w| z*^Ps!6`#c!*ojKik6i8{e^kIAwuP`oc7HcXROmj`N?TDYJ%?F%1s~&6%*PI@)!`io zFi;DJF$aI6Ud&+@FBYL5EHmp-ojQbC!7;nvh3Z5f>Z}Z+4((^u^B$5aZz6v*pBHr~ z1BDEgkJ{@;sEJQz`EfOx@+Odv diff --git a/atlas/translations/fr/LC_MESSAGES/messages.po b/atlas/translations/fr/LC_MESSAGES/messages.po index 0c0ede54e..189a1220d 100644 --- a/atlas/translations/fr/LC_MESSAGES/messages.po +++ b/atlas/translations/fr/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2024-09-27 10:32+0200\n" +"POT-Creation-Date: 2024-12-02 12:01+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: fr\n" @@ -438,6 +438,10 @@ msgstr "Observations par classes d'altitudes" msgid "monthly.obs" msgstr "Observations mensuelles" +#: templates/speciesSheet/charts.html:16 +msgid "data.source" +msgstr "Graphique de provenance des données" + #: templates/speciesSheet/descriptionMedia.html:12 #: templates/speciesSheet/otherInformations.html:42 msgid "author" diff --git a/atlas/translations/it/LC_MESSAGES/messages.mo b/atlas/translations/it/LC_MESSAGES/messages.mo index f23daef27f3210b4d76976c80ac1e55081563a52..e28585f4b1f9dd311b6d1489ce116180ed7d0cd7 100644 GIT binary patch delta 1719 zcmYM!TS(MF6vy!~uX)Q`sawt6ZoJA`OH*eG}d4o)}sP=Q5$ukHW)x9Hj3JK0=di+JAaNL%-`DidsN&2Ca}Nx z!9amRBbGNvLj~H7%CrnuVhygv!>A40tesZB^}MwgV_0|D&WBKm45JDi!BqA)Qw+55 z9numLKqatqPi1hA z!8&}3S~!miuwdtls6;|IaE2xZwJsU;ekSUSb5McHQ5)A;PoVBQiK@H{m1ut?{by{3 zc~M1UsIz~BdVj|H3Kif3DzN~nlJ9mN#GA>?V^AAsp*mTF>QDu$L)EB#4&erDjH3T~ zn9kY{`cd=SsLJkR20lgw`iNZSGcQWuCteKVh-in__Yqy|22m9bp$ZzqES$t?oWo4K zav3i#%KWtT4(fMe7FFpdRL8!e&Q^WThD2O}#nw{PPs<)_ z`Lcdf#ejQFH7bDy)Yrs?ByBu6O^Z8GXIRQ^s%#&sk|tCFExf3rZdAtxQQww_sDfUj zIz5M4_iIVcKa!a?PPb;G9=06RQ@slvSYzitYY!@c8`crjMw8ZQ+`{}N>WF@$3XLGE zt(b~&`u>+Q&>7XD7Pg~W*^O%bHO#>&`}qRuEdL+5hcHlpJ6qK@DS=HtZp z{;<}d2xo4auf4U&Jw6%U7ZO`gn3G@VC@3t>FW8n}FkTxy6YQvLbsqCH`5Z2{*Xwk& YwE8;S%^r92DJSoE94_a0a@?ixe@eNXc>n+a delta 1661 zcmYM!OGwmF6vy%7V;tYFO3lhNADLy2Q)Ef$$_g|hB1(I>(28myMv_G}3o}rL2(e9p z&;uhWC?+D32sIaj3!#^w5N*ubWNyMRr0=gTB!B;(d;fF)_nvd^otZA{FAIE1kG^UA zHSxca|IJbA{r{_rF-xGk2R&GiDcFed*y8#ZaS8oy)c8Kk!U4>{5nPIsn2fWSW)`qT z8hSC+YnF}$$Rn%3M6AM8tVK<51U0@DwLm8-us+nn_mRtf=pC|`51?O%*O4gg$_E8I-8uQoGqBdxHi}CKn2o;TKGCH$2*wB`Zh>| zQdk(3!4z`YjO+ivW%PfeCQc_R1(J)zZbhgHZA86ajY^;vm2m@V%TA&aJ&y_?h=CO} z`e|t3FlvHv*PlWK@)fyk&OKjn&to|N+S@eL#KowEcR1@%?;S>EejF8OJ91f9JoQ&b zz4Wx_cijgMozGAcyha5UMrHEB^`|kD{v2xII0mVbS*Qw?pep1;t+N$Z;ZD>UYEGd3 z`k>uCxQ5F37UtnS)I_7mWnI>JaWmP27YUcN+CAxPUp>gUawJuEudxfU~GAo=0t! zheb6{Ae)9V%R>cH%1sehIh#?x3*D#;AD~M27`3NEScLB}5*M6{sGpJu_CtD{amYuO zgai<<92)w16e7V{364NfC`|Tn=+|ERjL8?ExCkBs0UTzKGeA9 z&M{Qxpa07K&(P2z`;I!z^O%b%yrsU+xeFD*G3Oc7Lha70xQ_k})YiO2Wg5m3oOFE; zQEF>4Fq!pj3k{XB237h)Sc+FP03V_Da1c2^_6CX3-l8h@1(m>0)Oba$`BG3@w+1Pu zRiobDhpIp$9?--mXy|aY;9l%T9i~at3%^hkda0+zXJawuqb90DZNYx@VOyv^=4?c0 g!W)cE_H8TmSLBxaDmVGp`~0ES#L=iweQMDA2jrQKp8x;= diff --git a/atlas/translations/it/LC_MESSAGES/messages.po b/atlas/translations/it/LC_MESSAGES/messages.po index 9dcd3d1c7..73a9d72c9 100644 --- a/atlas/translations/it/LC_MESSAGES/messages.po +++ b/atlas/translations/it/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2024-09-27 10:32+0200\n" +"POT-Creation-Date: 2024-12-02 12:01+0100\n" "PO-Revision-Date: 2021-07-19 09:53+0200\n" "Last-Translator: FULL NAME \n" "Language: it\n" @@ -437,6 +437,10 @@ msgstr "Osservazioni per classi di altitudine" msgid "monthly.obs" msgstr "Osservazioni mensili" +#: atlas/templates/speciesSheet/charts.html:16 +msgid "data.source" +msgstr "Grafico della provenienza dei dati" + #: templates/speciesSheet/descriptionMedia.html:12 #: templates/speciesSheet/otherInformations.html:42 msgid "author" diff --git a/docs/changelog.rst b/docs/changelog.rst index ac203698d..76f42eb1f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -9,6 +9,7 @@ CHANGELOG - Ajout du lien "Données personelles" dans le pied de page (#527 @juggler31) - Suppression du support des installations sans TaxHub +- Ajout d'un graphique de provenance des données (#538) 🐛 **Corrections** From 6fabcc7dff5a2952bf4fb5e66fae50adf2564bf9 Mon Sep 17 00:00:00 2001 From: Joaquim Nallar Date: Tue, 3 Dec 2024 11:43:46 +0100 Subject: [PATCH 2/2] feat: Add data source organism on species page (#538) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Un graphique de provenance des données a été rajouté afin de visualiser la participation de chaques organismes a l'observation d'un Taxon. --- atlas/configuration/config.py.example | 29 +++++++++++++++++++++ atlas/configuration/config_schema.py | 27 +++++++++++++++++++ atlas/static/chart.js | 37 ++------------------------- atlas/static/chart_organism.js | 31 +++------------------- atlas/static/css/atlas.css | 1 - 5 files changed, 61 insertions(+), 64 deletions(-) diff --git a/atlas/configuration/config.py.example b/atlas/configuration/config.py.example index bd7da925e..515da425f 100644 --- a/atlas/configuration/config.py.example +++ b/atlas/configuration/config.py.example @@ -78,6 +78,32 @@ LANGUAGES = { } } +Couleur s'affichant dans les graphiques de type 'pie' (circulaire) +COLOR_PIE_CHARTS = [ + '#E1CE7A', + '#FBFFB9', + '#FDD692', + '#EC7357', + '#754F44', + '#FB6376', + '#B7ADCF', + '#DEE7E7', + '#F4FAFF', + '#383D3B', + '#7C7C7C', + '#B5F44A', + '#D6FF79', + '#507255', + '#381D2A', + '#BA5624', + '#FFA552', + '#F7FFE0', + '#49C6E5', + '#54DEFD', + '#0B5563', + '#54DEFD' +] + ##################### ##################### ### Configuration ### @@ -193,6 +219,9 @@ AFFICHAGE_GRAPH_ALTITUDES = True # Afficher le graphique de la phénologie. Affichage True/False AFFICHAGE_GRAPH_PHENOLOGIE = True +# Afficher le graphique de provenance des données. Affichage True/False +AFFICHAGE_GRAPH_PROVENANCE_DONNEE = False + # Rang taxonomique qui fixe jusqu'à quel taxon remonte la filiation taxonomique (hierarchie dans la fiche d'identite : Famille, Ordre etc... ) LIMIT_RANG_TAXONOMIQUE_HIERARCHIE = 13 diff --git a/atlas/configuration/config_schema.py b/atlas/configuration/config_schema.py index fe52bad08..33eeaf5a9 100644 --- a/atlas/configuration/config_schema.py +++ b/atlas/configuration/config_schema.py @@ -140,6 +140,33 @@ class Meta: AFFICHAGE_GRAPH_ALTITUDES = fields.Boolean(load_default=True) AFFICHAGE_GRAPH_PHENOLOGIE = fields.Boolean(load_default=False) AFFICHAGE_GRAPH_PROVENANCE_DONNEE = fields.Boolean(load_default=False) + COLOR_PIE_CHARTS = fields.List( + fields.String(), + load_default=[ + "#E1CE7A", + "#FBFFB9", + "#FDD692", + "#EC7357", + "#754F44", + "#FB6376", + "#B7ADCF", + "#DEE7E7", + "#F4FAFF", + "#383D3B", + "#7C7C7C", + "#B5F44A", + "#D6FF79", + "#507255", + "#381D2A", + "#BA5624", + "#FFA552", + "#F7FFE0", + "#49C6E5", + "#54DEFD", + "#0B5563", + "#54DEFD", + ], + ) RANG_STAT = fields.List( fields.Dict, diff --git a/atlas/static/chart.js b/atlas/static/chart.js index 435d5d4a7..22842d0e1 100644 --- a/atlas/static/chart.js +++ b/atlas/static/chart.js @@ -1,7 +1,6 @@ // ChartJS Graphs const chartMainColor = getComputedStyle(document.documentElement).getPropertyValue('--main-color'); const chartSecondColor = getComputedStyle(document.documentElement).getPropertyValue('--second-color'); -const chartThirdColor = getComputedStyle(document.documentElement).getPropertyValue('--third-color'); const getChartDatas = function (data, key) { let values = []; @@ -51,7 +50,7 @@ genericChart = function (element, labels, values) { pieChartConfig = function (element, data) { return new Chart(element, { - type: 'doughnut', + type: 'pie', data: data, options: { responsive: true, @@ -70,20 +69,6 @@ pieChartConfig = function (element, data) { }) } -function getPieEndColor(index, isLastElem) { - // To change color if last element will have the same color to first element - if (isLastElem && index % 3 === 0) { - index++ - } - - if (index % 3 === 0) { - return chartMainColor - } else if (index % 3 === 1) { - return chartSecondColor - } - return chartThirdColor -} - function formatPieData(data) { let labels = [] let data_count = [] @@ -92,31 +77,13 @@ function formatPieData(data) { data_count.push(data[key]) }) - const element = document.getElementById("organismChart"); - const context2d = element.getContext("2d"); - return { labels: labels, datasets: [ { label: 'Dataset 1', data: data_count, - backgroundColor: context => { - if (context.element.x && context.element.y) { - const grad = context2d.createRadialGradient( - context.element.x, - context.element.y, - context.element.innerRadius, - context.element.x, - context.element.y, - context.element.outerRadius); - const isLastElem = context.index === data_count.length - 1 - - grad.addColorStop(0, chartMainColor); - grad.addColorStop(1, getPieEndColor(context.index, isLastElem)); - return grad - } - }, + backgroundColor: configuration.COLOR_PIE_CHARTS, hoverOffset: 25 } ] diff --git a/atlas/static/chart_organism.js b/atlas/static/chart_organism.js index 35ae01e12..94ee69753 100644 --- a/atlas/static/chart_organism.js +++ b/atlas/static/chart_organism.js @@ -11,7 +11,7 @@ const getChartDatas = function (data, key) { }; //Circle graph for parts graph -circleChart = function (element, labels, values, colors) { +circleChart = function (element, labels, values) { return new Chart(element, { type: 'pie', data: { @@ -19,7 +19,7 @@ circleChart = function (element, labels, values, colors) { datasets: [{ label: 'observations', data: values, - backgroundColor: colors + backgroundColor: configuration.COLOR_PIE_CHARTS }] }, options: { @@ -33,30 +33,5 @@ circleChart = function (element, labels, values, colors) { }) }; -var color_tab = [ - '#E1CE7A', - '#FBFFB9', - '#FDD692', - '#EC7357', - '#754F44', - '#FB6376', - '#B7ADCF', - '#DEE7E7', - '#F4FAFF', - '#383D3B', - '#7C7C7C', - '#B5F44A', - '#D6FF79', - '#507255', - '#381D2A', - '#BA5624', - '#FFA552', - '#F7FFE0', - '#49C6E5', - '#54DEFD', - '#0B5563', - '#54DEFD' - ]; - var groupChartElement = document.getElementById('groupChart'); -const groupChart = circleChart(groupChartElement, getChartDatas(dataset, 'group2_inpn'), getChartDatas(dataset, 'nb_obs_group'), color_tab); +const groupChart = circleChart(groupChartElement, getChartDatas(dataset, 'group2_inpn'), getChartDatas(dataset, 'nb_obs_group')); diff --git a/atlas/static/css/atlas.css b/atlas/static/css/atlas.css index 515d12f89..0513c98d0 100644 --- a/atlas/static/css/atlas.css +++ b/atlas/static/css/atlas.css @@ -1,7 +1,6 @@ :root { --main-color: #c3b528; --second-color: #5a7526; - --third-color: #2c410a; --map-maille-border-color: #ddd; --map-maille-lastobs-border-color: #c218d0; --map-territory-border-color: #333;