{"action":"opened","number":222,"pull_request":{"url":"https://api.github.com/repos/Kozea/pygal/pulls/222","id":37480740,"html_url":"https://github.com/Kozea/pygal/pull/222","diff_url":"https://github.com/Kozea/pygal/pull/222.diff","patch_url":"https://github.com/Kozea/pygal/pull/222.patch","issue_url":"https://api.github.com/repos/Kozea/pygal/issues/222","number":222,"state":"open","locked":false,"title":"Hungarian county map","user":{"login":"krisztianfekete","id":1246751,"avatar_url":"https://avatars.githubusercontent.com/u/1246751?v=3","gravatar_id":"","url":"https://api.github.com/users/krisztianfekete","html_url":"https://github.com/krisztianfekete","followers_url":"https://api.github.com/users/krisztianfekete/followers","following_url":"https://api.github.com/users/krisztianfekete/following{/other_user}","gists_url":"https://api.github.com/users/krisztianfekete/gists{/gist_id}","starred_url":"https://api.github.com/users/krisztianfekete/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krisztianfekete/subscriptions","organizations_url":"https://api.github.com/users/krisztianfekete/orgs","repos_url":"https://api.github.com/users/krisztianfekete/repos","events_url":"https://api.github.com/users/krisztianfekete/events{/privacy}","received_events_url":"https://api.github.com/users/krisztianfekete/received_events","type":"User","site_admin":false},"body":"This is a county map (~NUTS-3) implementation for Hungary.\r\nIt would be fantastic if you could integrate it into pygal.\r\n\r\nThe svg map is from wikimedia (exact location is in the commit message), its license says \"public domain\", it is there since 2007, I have hand-adjusted it to work with pygal.\r\nThe support code is copy-paste-edit derived from `frenchmap.py`.\r\n\r\nI can do some adjustments still if needed.\r\n\r\n----\r\n\r\nThe following are things I wanted/planned to do, but could not (mostly time constraint).\r\n\r\nUsing [NUTS](http://en.wikipedia.org/wiki/Nomenclature_of_Territorial_Units_for_Statistics) based area addressing (http://en.wikipedia.org/wiki/NUTS_of_Hungary) instead of county names.\r\n\r\nWrite tests.  It is a bigger effort: I felt copying `test_frenchmap.py` would not add real value.\r\n\r\nThe pygal map implementation has some strict assumptions about the .svg used for displaying the map, so when expectations are changed, the country map might no longer work until updated.  My feeling is that svg files should be checked against the assumptions in a test.\r\n\r\nCurrent assumptions such a test could check for (I have run into these specific problems):\r\n- elements with class `map-elements` being iterable (e.g. `<g>` elements, not `<path>`-s)\r\n- class property being formatted as expected (\"{area_prefix}{area_code} {kind} map-element\").\r\n\r\nDemo code/documentation: have not found the place to put.  Please find below the code I wanted to add (edit it as you please).\r\n\r\n----\r\n\r\n```python\r\n# coding: utf-8\r\nfrom __future__ import unicode_literals\r\n\r\n# the above 2 lines are needed for accents in county names!\r\n\r\nfrom pygal import HungarianCountyMap\r\nfrom pygal.style import Style\r\n\r\n# it looks like this is the way to set the color when creating a heatmap\r\n# all colors under a single entry are differring only in fill-opacity\r\nstyle = Style(colors=('#208060', '#ff8040'))\r\n\r\nhu_map = HungarianCountyMap(style=style, show_legend=False)\r\nhu_map.title = 'Values from dictionary'\r\nhu_map.add('Speciál', dict(tolna=9.3))\r\nhu_map.add(\r\n    'Árnyalat',\r\n    dict(\r\n        (name, n)\r\n        for (n, name) in enumerate(hu_map.area_names)))\r\n\r\n# render_in_browser renders the svg in a file ending in .html\r\n# which is displayed inproperly for me: accented text shows as raw utf-8 bytes\r\nhu_map.render_in_browser()\r\n```\r\n\r\n\r\n```python\r\n# coding: utf-8\r\nfrom __future__ import unicode_literals\r\n\r\n# the above 2 lines are needed for accents in county names!\r\n\r\nfrom pygal import HungarianCountyMap\r\nfrom pygal.style import CleanStyle\r\n\r\nhu_map = HungarianCountyMap(style=CleanStyle, width=400, height=200)\r\nhu_map.title = '3 regions (NUTS-2)'\r\n# see http://en.wikipedia.org/wiki/NUTS_of_Hungary\r\nhu_map.add('Közép-Magyarország', ['pest', 'budapest'])\r\nhu_map.add('Dél-Dunántúl', ['baranya', 'somogy', 'tolna'])\r\nhu_map.add('Nyugat-Dunántúl', ['zala', 'vas', 'gyms'])\r\n\r\n# render_in_browser renders the svg in a file ending in .html\r\n# which is displayed inproperly for me: accented text shows as raw utf-8 bytes\r\nhu_map.render_to_file('hungary-test-output.svg')\r\n# open the generated file manually in a web-browser to see output\r\n```\r\n","created_at":"2015-06-11T16:10:58Z","updated_at":"2015-06-11T16:10:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Kozea/pygal/pulls/222/commits","review_comments_url":"https://api.github.com/repos/Kozea/pygal/pulls/222/comments","review_comment_url":"https://api.github.com/repos/Kozea/pygal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Kozea/pygal/issues/222/comments","statuses_url":"https://api.github.com/repos/Kozea/pygal/statuses/ac45c30123a645a63e8a3839841150697e64f7e2","head":{"label":"krisztianfekete:hungarian-map","ref":"hungarian-map","sha":"ac45c30123a645a63e8a3839841150697e64f7e2","user":{"login":"krisztianfekete","id":1246751,"avatar_url":"https://avatars.githubusercontent.com/u/1246751?v=3","gravatar_id":"","url":"https://api.github.com/users/krisztianfekete","html_url":"https://github.com/krisztianfekete","followers_url":"https://api.github.com/users/krisztianfekete/followers","following_url":"https://api.github.com/users/krisztianfekete/following{/other_user}","gists_url":"https://api.github.com/users/krisztianfekete/gists{/gist_id}","starred_url":"https://api.github.com/users/krisztianfekete/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krisztianfekete/subscriptions","organizations_url":"https://api.github.com/users/krisztianfekete/orgs","repos_url":"https://api.github.com/users/krisztianfekete/repos","events_url":"https://api.github.com/users/krisztianfekete/events{/privacy}","received_events_url":"https://api.github.com/users/krisztianfekete/received_events","type":"User","site_admin":false},"repo":{"id":36934799,"name":"pygal","full_name":"krisztianfekete/pygal","owner":{"login":"krisztianfekete","id":1246751,"avatar_url":"https://avatars.githubusercontent.com/u/1246751?v=3","gravatar_id":"","url":"https://api.github.com/users/krisztianfekete","html_url":"https://github.com/krisztianfekete","followers_url":"https://api.github.com/users/krisztianfekete/followers","following_url":"https://api.github.com/users/krisztianfekete/following{/other_user}","gists_url":"https://api.github.com/users/krisztianfekete/gists{/gist_id}","starred_url":"https://api.github.com/users/krisztianfekete/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krisztianfekete/subscriptions","organizations_url":"https://api.github.com/users/krisztianfekete/orgs","repos_url":"https://api.github.com/users/krisztianfekete/repos","events_url":"https://api.github.com/users/krisztianfekete/events{/privacy}","received_events_url":"https://api.github.com/users/krisztianfekete/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/krisztianfekete/pygal","description":"PYthon svg GrAph plotting Library","fork":true,"url":"https://api.github.com/repos/krisztianfekete/pygal","forks_url":"https://api.github.com/repos/krisztianfekete/pygal/forks","keys_url":"https://api.github.com/repos/krisztianfekete/pygal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/krisztianfekete/pygal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/krisztianfekete/pygal/teams","hooks_url":"https://api.github.com/repos/krisztianfekete/pygal/hooks","issue_events_url":"https://api.github.com/repos/krisztianfekete/pygal/issues/events{/number}","events_url":"https://api.github.com/repos/krisztianfekete/pygal/events","assignees_url":"https://api.github.com/repos/krisztianfekete/pygal/assignees{/user}","branches_url":"https://api.github.com/repos/krisztianfekete/pygal/branches{/branch}","tags_url":"https://api.github.com/repos/krisztianfekete/pygal/tags","blobs_url":"https://api.github.com/repos/krisztianfekete/pygal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/krisztianfekete/pygal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/krisztianfekete/pygal/git/refs{/sha}","trees_url":"https://api.github.com/repos/krisztianfekete/pygal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/krisztianfekete/pygal/statuses/{sha}","languages_url":"https://api.github.com/repos/krisztianfekete/pygal/languages","stargazers_url":"https://api.github.com/repos/krisztianfekete/pygal/stargazers","contributors_url":"https://api.github.com/repos/krisztianfekete/pygal/contributors","subscribers_url":"https://api.github.com/repos/krisztianfekete/pygal/subscribers","subscription_url":"https://api.github.com/repos/krisztianfekete/pygal/subscription","commits_url":"https://api.github.com/repos/krisztianfekete/pygal/commits{/sha}","git_commits_url":"https://api.github.com/repos/krisztianfekete/pygal/git/commits{/sha}","comments_url":"https://api.github.com/repos/krisztianfekete/pygal/comments{/number}","issue_comment_url":"https://api.github.com/repos/krisztianfekete/pygal/issues/comments{/number}","contents_url":"https://api.github.com/repos/krisztianfekete/pygal/contents/{+path}","compare_url":"https://api.github.com/repos/krisztianfekete/pygal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/krisztianfekete/pygal/merges","archive_url":"https://api.github.com/repos/krisztianfekete/pygal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/krisztianfekete/pygal/downloads","issues_url":"https://api.github.com/repos/krisztianfekete/pygal/issues{/number}","pulls_url":"https://api.github.com/repos/krisztianfekete/pygal/pulls{/number}","milestones_url":"https://api.github.com/repos/krisztianfekete/pygal/milestones{/number}","notifications_url":"https://api.github.com/repos/krisztianfekete/pygal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/krisztianfekete/pygal/labels{/name}","releases_url":"https://api.github.com/repos/krisztianfekete/pygal/releases{/id}","created_at":"2015-06-05T13:42:25Z","updated_at":"2015-06-05T13:42:25Z","pushed_at":"2015-06-11T15:39:11Z","git_url":"git://github.com/krisztianfekete/pygal.git","ssh_url":"git@github.com:krisztianfekete/pygal.git","clone_url":"https://github.com/krisztianfekete/pygal.git","svn_url":"https://github.com/krisztianfekete/pygal","homepage":"http://pygal.org","size":4151,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Kozea:master","ref":"master","sha":"efbf6638e9d5daa567df1366893d1e4f17f4f10d","user":{"login":"Kozea","id":870325,"avatar_url":"https://avatars.githubusercontent.com/u/870325?v=3","gravatar_id":"","url":"https://api.github.com/users/Kozea","html_url":"https://github.com/Kozea","followers_url":"https://api.github.com/users/Kozea/followers","following_url":"https://api.github.com/users/Kozea/following{/other_user}","gists_url":"https://api.github.com/users/Kozea/gists{/gist_id}","starred_url":"https://api.github.com/users/Kozea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kozea/subscriptions","organizations_url":"https://api.github.com/users/Kozea/orgs","repos_url":"https://api.github.com/users/Kozea/repos","events_url":"https://api.github.com/users/Kozea/events{/privacy}","received_events_url":"https://api.github.com/users/Kozea/received_events","type":"Organization","site_admin":false},"repo":{"id":2443236,"name":"pygal","full_name":"Kozea/pygal","owner":{"login":"Kozea","id":870325,"avatar_url":"https://avatars.githubusercontent.com/u/870325?v=3","gravatar_id":"","url":"https://api.github.com/users/Kozea","html_url":"https://github.com/Kozea","followers_url":"https://api.github.com/users/Kozea/followers","following_url":"https://api.github.com/users/Kozea/following{/other_user}","gists_url":"https://api.github.com/users/Kozea/gists{/gist_id}","starred_url":"https://api.github.com/users/Kozea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kozea/subscriptions","organizations_url":"https://api.github.com/users/Kozea/orgs","repos_url":"https://api.github.com/users/Kozea/repos","events_url":"https://api.github.com/users/Kozea/events{/privacy}","received_events_url":"https://api.github.com/users/Kozea/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Kozea/pygal","description":"PYthon svg GrAph plotting Library","fork":false,"url":"https://api.github.com/repos/Kozea/pygal","forks_url":"https://api.github.com/repos/Kozea/pygal/forks","keys_url":"https://api.github.com/repos/Kozea/pygal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kozea/pygal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kozea/pygal/teams","hooks_url":"https://api.github.com/repos/Kozea/pygal/hooks","issue_events_url":"https://api.github.com/repos/Kozea/pygal/issues/events{/number}","events_url":"https://api.github.com/repos/Kozea/pygal/events","assignees_url":"https://api.github.com/repos/Kozea/pygal/assignees{/user}","branches_url":"https://api.github.com/repos/Kozea/pygal/branches{/branch}","tags_url":"https://api.github.com/repos/Kozea/pygal/tags","blobs_url":"https://api.github.com/repos/Kozea/pygal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kozea/pygal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kozea/pygal/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kozea/pygal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kozea/pygal/statuses/{sha}","languages_url":"https://api.github.com/repos/Kozea/pygal/languages","stargazers_url":"https://api.github.com/repos/Kozea/pygal/stargazers","contributors_url":"https://api.github.com/repos/Kozea/pygal/contributors","subscribers_url":"https://api.github.com/repos/Kozea/pygal/subscribers","subscription_url":"https://api.github.com/repos/Kozea/pygal/subscription","commits_url":"https://api.github.com/repos/Kozea/pygal/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kozea/pygal/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kozea/pygal/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kozea/pygal/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kozea/pygal/contents/{+path}","compare_url":"https://api.github.com/repos/Kozea/pygal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kozea/pygal/merges","archive_url":"https://api.github.com/repos/Kozea/pygal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kozea/pygal/downloads","issues_url":"https://api.github.com/repos/Kozea/pygal/issues{/number}","pulls_url":"https://api.github.com/repos/Kozea/pygal/pulls{/number}","milestones_url":"https://api.github.com/repos/Kozea/pygal/milestones{/number}","notifications_url":"https://api.github.com/repos/Kozea/pygal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kozea/pygal/labels{/name}","releases_url":"https://api.github.com/repos/Kozea/pygal/releases{/id}","created_at":"2011-09-23T10:17:50Z","updated_at":"2015-06-11T15:33:33Z","pushed_at":"2015-06-07T15:15:51Z","git_url":"git://github.com/Kozea/pygal.git","ssh_url":"git@github.com:Kozea/pygal.git","clone_url":"https://github.com/Kozea/pygal.git","svn_url":"https://github.com/Kozea/pygal","homepage":"http://pygal.org","size":5358,"stargazers_count":1058,"watchers_count":1058,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":229,"mirror_url":null,"open_issues_count":68,"forks":229,"open_issues":68,"watchers":1058,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Kozea/pygal/pulls/222"},"html":{"href":"https://github.com/Kozea/pygal/pull/222"},"issue":{"href":"https://api.github.com/repos/Kozea/pygal/issues/222"},"comments":{"href":"https://api.github.com/repos/Kozea/pygal/issues/222/comments"},"review_comments":{"href":"https://api.github.com/repos/Kozea/pygal/pulls/222/comments"},"review_comment":{"href":"https://api.github.com/repos/Kozea/pygal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Kozea/pygal/pulls/222/commits"},"statuses":{"href":"https://api.github.com/repos/Kozea/pygal/statuses/ac45c30123a645a63e8a3839841150697e64f7e2"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":3,"additions":226,"deletions":0,"changed_files":3}}