Browse Source

HungarianCountyMap

- svg edited:
 - added <g> around <path>-s
 - moved class attribute from <path> to <g>
 - formatted class attribute so that BaseMap could find & color parts
 - added viewBox
- copied frenchmap.py to hungarianmap.py and edited
- exported the new class from pygal/__init__.py
pull/222/head
Fekete Krisztián 10 years ago
parent
commit
1750bac66f
  1. 1
      pygal/__init__.py
  2. 75
      pygal/graph/hungarianmap.py
  3. 203
      pygal/graph/maps/HU_counties_blank.svg

1
pygal/__init__.py

@ -27,6 +27,7 @@ from pygal.graph.bar import Bar
from pygal.graph.box import Box
from pygal.graph.dot import Dot
from pygal.graph.frenchmap import FrenchMapDepartments, FrenchMapRegions
from pygal.graph.hungarianmap import HungarianCountyMap
from pygal.graph.funnel import Funnel
from pygal.graph.gauge import Gauge
from pygal.graph.histogram import Histogram

75
pygal/graph/hungarianmap.py

@ -0,0 +1,75 @@
# -*- coding: utf-8 -*-
# This file is part of pygal
#
# A python svg graph plotting library
# Copyright © 2012-2014 Kozea
#
# This library is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with pygal. If not, see <http://www.gnu.org/licenses/>.
"""
Hungarian maps
"""
from __future__ import division
from collections import defaultdict
from pygal.graph.map import BaseMap
from pygal._compat import u
from numbers import Number
import os
# XXX: use http://hu.wikipedia.org/wiki/NUTS:HU hierarchical codes?
# Counties ~ NUTS-3:
COUNTIES = {
'nograd': u('Nógrád'),
'heves': u('Heves'),
'jnsz': u('Jász-Nagykun-Szolnok'),
'budapest': u('Budapest'),
'pest': u('Pest'),
'fejer': u('Fejér'),
'veszprem': u('Veszprém'),
'tolna': u('Tolna'),
'ke': u('Komárom-Esztergom'),
'gyms': u('Győr-Moson-Sopron'),
'vas': u('Vas'),
'zala': u('Zala'),
'somogy': u('Somogy'),
'baranya': u('Baranya'),
'bk': u('Bács-Kiskun'),
'csongrad': u('Csongrád'),
'bekes': u('Békés'),
'hb': u('Hajdú-Bihar'),
'szszb': u('Szabolcs-Szatmár-Bereg'),
'baz': u('Borsod-Abaúj-Zemplén'),
}
# TODO: NUTS-1 (country parts) and NUTS-2 (statistical regions)
with open(os.path.join(
os.path.dirname(__file__), 'maps',
'HU_counties_blank.svg')) as file:
COUNTY_MAP = file.read()
class HungarianCountyMap(BaseMap):
"""Hungarian county map"""
x_labels = list(COUNTIES.keys())
area_names = COUNTIES
area_prefix = ''
# area_prefix = 'HU'
kind = 'megye'
svg_map = COUNTY_MAP

203
pygal/graph/maps/HU_counties_blank.svg

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 157 KiB

Loading…
Cancel
Save