diff --git a/pygal/css/style.css b/pygal/css/style.css index e5740ed..bc8f31e 100644 --- a/pygal/css/style.css +++ b/pygal/css/style.css @@ -115,7 +115,7 @@ {{ id }}.map-element { fill: {{ style.foreground }}; - stroke: {{ style.plot_background }} !important; + stroke: {{ style.foreground_dark }} !important; opacity: .9; stroke-width: 3; -webkit-transition: 250ms; diff --git a/pygal/graph/frenchmap.py b/pygal/graph/frenchmap.py index dc610af..cfa3be5 100644 --- a/pygal/graph/frenchmap.py +++ b/pygal/graph/frenchmap.py @@ -22,6 +22,7 @@ Worldmap chart """ from __future__ import division +from collections import defaultdict from pygal.ghost import ChartCollection from pygal.util import cut, cached_property, decorate from pygal.graph.graph import Graph @@ -268,3 +269,116 @@ class FrenchMapRegions(FrenchMapDepartments): class FrenchMap(ChartCollection): Regions = FrenchMapRegions Departments = FrenchMapDepartments + + +DEPARTMENTS_REGIONS = { + "01": "82", + "02": "22", + "03": "83", + "04": "93", + "05": "93", + "06": "93", + "07": "82", + "08": "21", + "09": "73", + "10": "21", + "11": "91", + "12": "73", + "13": "93", + "14": "25", + "15": "83", + "16": "54", + "17": "54", + "18": "24", + "19": "74", + "21": "26", + "22": "53", + "23": "74", + "24": "72", + "25": "43", + "26": "82", + "27": "23", + "28": "24", + "29": "53", + "2A": "94", + "2B": "94", + "30": "91", + "31": "73", + "32": "73", + "33": "72", + "34": "91", + "35": "53", + "36": "24", + "37": "24", + "38": "82", + "39": "43", + "40": "72", + "41": "24", + "42": "82", + "43": "83", + "44": "52", + "45": "24", + "46": "73", + "47": "72", + "48": "91", + "49": "52", + "50": "25", + "51": "21", + "52": "21", + "53": "52", + "54": "41", + "55": "41", + "56": "53", + "57": "41", + "58": "26", + "59": "31", + "60": "22", + "61": "25", + "62": "31", + "63": "83", + "64": "72", + "65": "73", + "66": "91", + "67": "42", + "68": "42", + "69": "82", + "70": "43", + "71": "26", + "72": "52", + "73": "82", + "74": "82", + "75": "11", + "76": "23", + "77": "11", + "78": "11", + "79": "54", + "80": "22", + "81": "73", + "82": "73", + "83": "93", + "84": "93", + "85": "52", + "86": "54", + "87": "74", + "88": "41", + "89": "26", + "90": "43", + "91": "11", + "92": "11", + "93": "11", + "94": "11", + "95": "11", + "971": "01", + "972": "02", + "973": "03", + "974": "04", + "975": "05", + "976": "06" +} + + +def aggregate_regions(values): + regions = defaultdict(int) + for department, value in values: + regions[DEPARTMENTS_REGIONS[department]] += value + return list(regions.items())