{"action":"created","comment":{"url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/pulls/comments/175375602","pull_request_review_id":104888136,"id":175375602,"diff_hunk":"@@ -178,36 +192,42 @@ func RenderHorizontalKey(request *models.RenderRequest) string {\n \tsvg.AppendFeatureCollection(geoJSON)\n \tsvgWidth, _, _ := getWidthAndHeight(request, svg)\n \n-\tbreaks, referencePos := getSortedBreakInfo(request)\n+\tkeyInfo := getHorizontalKeyInfo(svgWidth, request)\n \n-\tkeyWidth := svgWidth * 0.9\n \tcontent := bytes.NewBufferString(\"\")\n \tticks := bytes.NewBufferString(\"\")\n-\tfmt.Fprintf(content, `<svg id=\"%s-legend-horizontal\" class=\"map_key_horizontal\" width=\"%g\" height=\"90\" viewBox=\"0 0 %g 90\">`, request.Filename, svgWidth, svgWidth)\n+\tsvgAttributes := fmt.Sprintf(`id=\"%s-legend-horizontal\" class=\"map_key_horizontal\" width=\"%.f\" height=\"90\" viewBox=\"0 0 %.f 90\"`, request.Filename, svgWidth, svgWidth)\n+\n \tfmt.Fprintf(content, `%s<g id=\"%s-legend-horizontal-container\">`, \"\\n\", request.Filename)\n-\tfmt.Fprintf(content, `%s<text x=\"%f\" y=\"6\" dy=\".5em\" style=\"text-anchor: middle;\" class=\"keyText\">%s %s</text>`, \"\\n\", keyWidth/2.0, request.Choropleth.ValuePrefix, request.Choropleth.ValueSuffix)\n-\tfmt.Fprintf(content, `%s<g id=\"%s-legend-horizontal-key\" transform=\"translate(%f, 20)\">`, \"\\n\", request.Filename, svgWidth*0.05)\n+\twriteHorizontalKeyTitle(request, svgWidth, content)","path":"renderer/svg.go","position":69,"original_position":69,"commit_id":"5d1c5f29a583d2579e837c6671afbaa9823231bb","original_commit_id":"5d1c5f29a583d2579e837c6671afbaa9823231bb","user":{"login":"daiLlew","id":14196957,"avatar_url":"https://avatars3.githubusercontent.com/u/14196957?v=4","gravatar_id":"","url":"https://api.github.com/users/daiLlew","html_url":"https://github.com/daiLlew","followers_url":"https://api.github.com/users/daiLlew/followers","following_url":"https://api.github.com/users/daiLlew/following{/other_user}","gists_url":"https://api.github.com/users/daiLlew/gists{/gist_id}","starred_url":"https://api.github.com/users/daiLlew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daiLlew/subscriptions","organizations_url":"https://api.github.com/users/daiLlew/orgs","repos_url":"https://api.github.com/users/daiLlew/repos","events_url":"https://api.github.com/users/daiLlew/events{/privacy}","received_events_url":"https://api.github.com/users/daiLlew/received_events","type":"User","site_admin":false},"body":"should these printF's be replaced with a log statement?","created_at":"2018-03-19T09:48:03Z","updated_at":"2018-03-19T09:50:47Z","html_url":"https://github.com/ONSdigital/dp-map-renderer/pull/3#discussion_r175375602","pull_request_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/pulls/3","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/ONSdigital/dp-map-renderer/pulls/comments/175375602"},"html":{"href":"https://github.com/ONSdigital/dp-map-renderer/pull/3#discussion_r175375602"},"pull_request":{"href":"https://api.github.com/repos/ONSdigital/dp-map-renderer/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/pulls/3","id":175500984,"html_url":"https://github.com/ONSdigital/dp-map-renderer/pull/3","diff_url":"https://github.com/ONSdigital/dp-map-renderer/pull/3.diff","patch_url":"https://github.com/ONSdigital/dp-map-renderer/pull/3.patch","issue_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/issues/3","number":3,"state":"open","locked":false,"title":"Added a png version, ensured map key text remains within the bounds of the svg","user":{"login":"YetAnotherMatt","id":3502456,"avatar_url":"https://avatars3.githubusercontent.com/u/3502456?v=4","gravatar_id":"","url":"https://api.github.com/users/YetAnotherMatt","html_url":"https://github.com/YetAnotherMatt","followers_url":"https://api.github.com/users/YetAnotherMatt/followers","following_url":"https://api.github.com/users/YetAnotherMatt/following{/other_user}","gists_url":"https://api.github.com/users/YetAnotherMatt/gists{/gist_id}","starred_url":"https://api.github.com/users/YetAnotherMatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YetAnotherMatt/subscriptions","organizations_url":"https://api.github.com/users/YetAnotherMatt/orgs","repos_url":"https://api.github.com/users/YetAnotherMatt/repos","events_url":"https://api.github.com/users/YetAnotherMatt/events{/privacy}","received_events_url":"https://api.github.com/users/YetAnotherMatt/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-03-16T11:00:49Z","updated_at":"2018-03-19T09:50:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"571d3544e2e7546f6cbd5dd1e53114fb90170939","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/pulls/3/commits","review_comments_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/pulls/3/comments","review_comment_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/issues/3/comments","statuses_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/statuses/5d1c5f29a583d2579e837c6671afbaa9823231bb","head":{"label":"ONSdigital:feature/legend","ref":"feature/legend","sha":"5d1c5f29a583d2579e837c6671afbaa9823231bb","user":{"login":"ONSdigital","id":6865137,"avatar_url":"https://avatars0.githubusercontent.com/u/6865137?v=4","gravatar_id":"","url":"https://api.github.com/users/ONSdigital","html_url":"https://github.com/ONSdigital","followers_url":"https://api.github.com/users/ONSdigital/followers","following_url":"https://api.github.com/users/ONSdigital/following{/other_user}","gists_url":"https://api.github.com/users/ONSdigital/gists{/gist_id}","starred_url":"https://api.github.com/users/ONSdigital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ONSdigital/subscriptions","organizations_url":"https://api.github.com/users/ONSdigital/orgs","repos_url":"https://api.github.com/users/ONSdigital/repos","events_url":"https://api.github.com/users/ONSdigital/events{/privacy}","received_events_url":"https://api.github.com/users/ONSdigital/received_events","type":"Organization","site_admin":false},"repo":{"id":122977451,"name":"dp-map-renderer","full_name":"ONSdigital/dp-map-renderer","owner":{"login":"ONSdigital","id":6865137,"avatar_url":"https://avatars0.githubusercontent.com/u/6865137?v=4","gravatar_id":"","url":"https://api.github.com/users/ONSdigital","html_url":"https://github.com/ONSdigital","followers_url":"https://api.github.com/users/ONSdigital/followers","following_url":"https://api.github.com/users/ONSdigital/following{/other_user}","gists_url":"https://api.github.com/users/ONSdigital/gists{/gist_id}","starred_url":"https://api.github.com/users/ONSdigital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ONSdigital/subscriptions","organizations_url":"https://api.github.com/users/ONSdigital/orgs","repos_url":"https://api.github.com/users/ONSdigital/repos","events_url":"https://api.github.com/users/ONSdigital/events{/privacy}","received_events_url":"https://api.github.com/users/ONSdigital/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ONSdigital/dp-map-renderer","description":"Renders an SVG representation of a map given a topojson file.","fork":false,"url":"https://api.github.com/repos/ONSdigital/dp-map-renderer","forks_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/forks","keys_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/teams","hooks_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/hooks","issue_events_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/issues/events{/number}","events_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/events","assignees_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/assignees{/user}","branches_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/branches{/branch}","tags_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/tags","blobs_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/git/refs{/sha}","trees_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/statuses/{sha}","languages_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/languages","stargazers_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/stargazers","contributors_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/contributors","subscribers_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/subscribers","subscription_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/subscription","commits_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/commits{/sha}","git_commits_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/git/commits{/sha}","comments_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/comments{/number}","issue_comment_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/issues/comments{/number}","contents_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/contents/{+path}","compare_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/merges","archive_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/downloads","issues_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/issues{/number}","pulls_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/pulls{/number}","milestones_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/milestones{/number}","notifications_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/labels{/name}","releases_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/releases{/id}","deployments_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/deployments","created_at":"2018-02-26T13:58:07Z","updated_at":"2018-03-12T13:04:30Z","pushed_at":"2018-03-16T16:16:58Z","git_url":"git://github.com/ONSdigital/dp-map-renderer.git","ssh_url":"git@github.com:ONSdigital/dp-map-renderer.git","clone_url":"https://github.com/ONSdigital/dp-map-renderer.git","svn_url":"https://github.com/ONSdigital/dp-map-renderer","homepage":null,"size":3597,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"ONSdigital:develop","ref":"develop","sha":"73b7d87e274aa23adae4e8719c851b99ba0cdba9","user":{"login":"ONSdigital","id":6865137,"avatar_url":"https://avatars0.githubusercontent.com/u/6865137?v=4","gravatar_id":"","url":"https://api.github.com/users/ONSdigital","html_url":"https://github.com/ONSdigital","followers_url":"https://api.github.com/users/ONSdigital/followers","following_url":"https://api.github.com/users/ONSdigital/following{/other_user}","gists_url":"https://api.github.com/users/ONSdigital/gists{/gist_id}","starred_url":"https://api.github.com/users/ONSdigital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ONSdigital/subscriptions","organizations_url":"https://api.github.com/users/ONSdigital/orgs","repos_url":"https://api.github.com/users/ONSdigital/repos","events_url":"https://api.github.com/users/ONSdigital/events{/privacy}","received_events_url":"https://api.github.com/users/ONSdigital/received_events","type":"Organization","site_admin":false},"repo":{"id":122977451,"name":"dp-map-renderer","full_name":"ONSdigital/dp-map-renderer","owner":{"login":"ONSdigital","id":6865137,"avatar_url":"https://avatars0.githubusercontent.com/u/6865137?v=4","gravatar_id":"","url":"https://api.github.com/users/ONSdigital","html_url":"https://github.com/ONSdigital","followers_url":"https://api.github.com/users/ONSdigital/followers","following_url":"https://api.github.com/users/ONSdigital/following{/other_user}","gists_url":"https://api.github.com/users/ONSdigital/gists{/gist_id}","starred_url":"https://api.github.com/users/ONSdigital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ONSdigital/subscriptions","organizations_url":"https://api.github.com/users/ONSdigital/orgs","repos_url":"https://api.github.com/users/ONSdigital/repos","events_url":"https://api.github.com/users/ONSdigital/events{/privacy}","received_events_url":"https://api.github.com/users/ONSdigital/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ONSdigital/dp-map-renderer","description":"Renders an SVG representation of a map given a topojson file.","fork":false,"url":"https://api.github.com/repos/ONSdigital/dp-map-renderer","forks_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/forks","keys_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/teams","hooks_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/hooks","issue_events_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/issues/events{/number}","events_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/events","assignees_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/assignees{/user}","branches_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/branches{/branch}","tags_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/tags","blobs_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/git/refs{/sha}","trees_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/statuses/{sha}","languages_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/languages","stargazers_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/stargazers","contributors_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/contributors","subscribers_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/subscribers","subscription_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/subscription","commits_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/commits{/sha}","git_commits_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/git/commits{/sha}","comments_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/comments{/number}","issue_comment_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/issues/comments{/number}","contents_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/contents/{+path}","compare_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/merges","archive_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/downloads","issues_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/issues{/number}","pulls_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/pulls{/number}","milestones_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/milestones{/number}","notifications_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/labels{/name}","releases_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/releases{/id}","deployments_url":"https://api.github.com/repos/ONSdigital/dp-map-renderer/deployments","created_at":"2018-02-26T13:58:07Z","updated_at":"2018-03-12T13:04:30Z","pushed_at":"2018-03-16T16:16:58Z","git_url":"git://github.com/ONSdigital/dp-map-renderer.git","ssh_url":"git@github.com:ONSdigital/dp-map-renderer.git","clone_url":"https://github.com/ONSdigital/dp-map-renderer.git","svn_url":"https://github.com/ONSdigital/dp-map-renderer","homepage":null,"size":3597,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ONSdigital/dp-map-renderer/pulls/3"},"html":{"href":"https://github.com/ONSdigital/dp-map-renderer/pull/3"},"issue":{"href":"https://api.github.com/repos/ONSdigital/dp-map-renderer/issues/3"},"comments":{"href":"https://api.github.com/repos/ONSdigital/dp-map-renderer/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/ONSdigital/dp-map-renderer/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/ONSdigital/dp-map-renderer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ONSdigital/dp-map-renderer/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/ONSdigital/dp-map-renderer/statuses/5d1c5f29a583d2579e837c6671afbaa9823231bb"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"daiLlew"}}