{"action":"closed","number":63,"pull_request":{"url":"https://api.github.com/repos/nvd3-community/nvd3/pulls/63","id":29132138,"html_url":"https://github.com/nvd3-community/nvd3/pull/63","diff_url":"https://github.com/nvd3-community/nvd3/pull/63.diff","patch_url":"https://github.com/nvd3-community/nvd3/pull/63.patch","issue_url":"https://api.github.com/repos/nvd3-community/nvd3/issues/63","number":63,"state":"closed","locked":false,"title":"Clear chart on no data #2","user":{"login":"jamesgarfield","id":1718770,"avatar_url":"https://avatars.githubusercontent.com/u/1718770?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesgarfield","html_url":"https://github.com/jamesgarfield","followers_url":"https://api.github.com/users/jamesgarfield/followers","following_url":"https://api.github.com/users/jamesgarfield/following{/other_user}","gists_url":"https://api.github.com/users/jamesgarfield/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesgarfield/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesgarfield/subscriptions","organizations_url":"https://api.github.com/users/jamesgarfield/orgs","repos_url":"https://api.github.com/users/jamesgarfield/repos","events_url":"https://api.github.com/users/jamesgarfield/events{/privacy}","received_events_url":"https://api.github.com/users/jamesgarfield/received_events","type":"User","site_admin":false},"body":"Refs #2\r\n\r\nCurrently, when charts are rendered with no data, the 'noData' text is applied, but any previously rendered chart components (legend, controls, any data elements) are left in the SVG.\r\n\r\nThis patch alter the 'no data' rendering so that the chart structure matches what it would be if it was initially rendered without any data: no legend, no controls, no anything.\r\n\r\nThe fix largely relies on the fact that nvd3 puts all chart components in in `<g>` elements, such that when the 'no data' state is encountered, removing all created elements should be as simple as finding all `<g>` elements within the container and removing them.\r\n\r\nEdit: I was sorely tempted to do some refactoring/extraction of the 'no data' logic from the charts, since it seems that is the same everywhere with the exception of a little variance in the test for 'no data'. Wasn't sure what the policy on this was, or where would be the best place to put the extracted utility (nv.utils perhaps?)","created_at":"2015-02-11T21:53:21Z","updated_at":"2015-02-11T22:22:45Z","closed_at":"2015-02-11T22:22:45Z","merged_at":"2015-02-11T22:22:45Z","merge_commit_sha":"fdc345a2cbaceb2d36df94d82dc6cfbd749f73d9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nvd3-community/nvd3/pulls/63/commits","review_comments_url":"https://api.github.com/repos/nvd3-community/nvd3/pulls/63/comments","review_comment_url":"https://api.github.com/repos/nvd3-community/nvd3/pulls/comments/{number}","comments_url":"https://api.github.com/repos/nvd3-community/nvd3/issues/63/comments","statuses_url":"https://api.github.com/repos/nvd3-community/nvd3/statuses/5f0f6b4daf44ec9283e53f7c0a58111305feb001","head":{"label":"jamesgarfield:ClearOnNoData","ref":"ClearOnNoData","sha":"5f0f6b4daf44ec9283e53f7c0a58111305feb001","user":{"login":"jamesgarfield","id":1718770,"avatar_url":"https://avatars.githubusercontent.com/u/1718770?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesgarfield","html_url":"https://github.com/jamesgarfield","followers_url":"https://api.github.com/users/jamesgarfield/followers","following_url":"https://api.github.com/users/jamesgarfield/following{/other_user}","gists_url":"https://api.github.com/users/jamesgarfield/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesgarfield/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesgarfield/subscriptions","organizations_url":"https://api.github.com/users/jamesgarfield/orgs","repos_url":"https://api.github.com/users/jamesgarfield/repos","events_url":"https://api.github.com/users/jamesgarfield/events{/privacy}","received_events_url":"https://api.github.com/users/jamesgarfield/received_events","type":"User","site_admin":false},"repo":{"id":30556716,"name":"nvd3","full_name":"jamesgarfield/nvd3","owner":{"login":"jamesgarfield","id":1718770,"avatar_url":"https://avatars.githubusercontent.com/u/1718770?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesgarfield","html_url":"https://github.com/jamesgarfield","followers_url":"https://api.github.com/users/jamesgarfield/followers","following_url":"https://api.github.com/users/jamesgarfield/following{/other_user}","gists_url":"https://api.github.com/users/jamesgarfield/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesgarfield/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesgarfield/subscriptions","organizations_url":"https://api.github.com/users/jamesgarfield/orgs","repos_url":"https://api.github.com/users/jamesgarfield/repos","events_url":"https://api.github.com/users/jamesgarfield/events{/privacy}","received_events_url":"https://api.github.com/users/jamesgarfield/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jamesgarfield/nvd3","description":"A reusable chart library for d3.js","fork":true,"url":"https://api.github.com/repos/jamesgarfield/nvd3","forks_url":"https://api.github.com/repos/jamesgarfield/nvd3/forks","keys_url":"https://api.github.com/repos/jamesgarfield/nvd3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jamesgarfield/nvd3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jamesgarfield/nvd3/teams","hooks_url":"https://api.github.com/repos/jamesgarfield/nvd3/hooks","issue_events_url":"https://api.github.com/repos/jamesgarfield/nvd3/issues/events{/number}","events_url":"https://api.github.com/repos/jamesgarfield/nvd3/events","assignees_url":"https://api.github.com/repos/jamesgarfield/nvd3/assignees{/user}","branches_url":"https://api.github.com/repos/jamesgarfield/nvd3/branches{/branch}","tags_url":"https://api.github.com/repos/jamesgarfield/nvd3/tags","blobs_url":"https://api.github.com/repos/jamesgarfield/nvd3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jamesgarfield/nvd3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jamesgarfield/nvd3/git/refs{/sha}","trees_url":"https://api.github.com/repos/jamesgarfield/nvd3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jamesgarfield/nvd3/statuses/{sha}","languages_url":"https://api.github.com/repos/jamesgarfield/nvd3/languages","stargazers_url":"https://api.github.com/repos/jamesgarfield/nvd3/stargazers","contributors_url":"https://api.github.com/repos/jamesgarfield/nvd3/contributors","subscribers_url":"https://api.github.com/repos/jamesgarfield/nvd3/subscribers","subscription_url":"https://api.github.com/repos/jamesgarfield/nvd3/subscription","commits_url":"https://api.github.com/repos/jamesgarfield/nvd3/commits{/sha}","git_commits_url":"https://api.github.com/repos/jamesgarfield/nvd3/git/commits{/sha}","comments_url":"https://api.github.com/repos/jamesgarfield/nvd3/comments{/number}","issue_comment_url":"https://api.github.com/repos/jamesgarfield/nvd3/issues/comments/{number}","contents_url":"https://api.github.com/repos/jamesgarfield/nvd3/contents/{+path}","compare_url":"https://api.github.com/repos/jamesgarfield/nvd3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jamesgarfield/nvd3/merges","archive_url":"https://api.github.com/repos/jamesgarfield/nvd3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jamesgarfield/nvd3/downloads","issues_url":"https://api.github.com/repos/jamesgarfield/nvd3/issues{/number}","pulls_url":"https://api.github.com/repos/jamesgarfield/nvd3/pulls{/number}","milestones_url":"https://api.github.com/repos/jamesgarfield/nvd3/milestones{/number}","notifications_url":"https://api.github.com/repos/jamesgarfield/nvd3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jamesgarfield/nvd3/labels{/name}","releases_url":"https://api.github.com/repos/jamesgarfield/nvd3/releases{/id}","created_at":"2015-02-09T20:25:02Z","updated_at":"2015-02-09T21:07:13Z","pushed_at":"2015-02-11T21:46:22Z","git_url":"git://github.com/jamesgarfield/nvd3.git","ssh_url":"git@github.com:jamesgarfield/nvd3.git","clone_url":"https://github.com/jamesgarfield/nvd3.git","svn_url":"https://github.com/jamesgarfield/nvd3","homepage":"http://nvd3-community.github.io/nvd3/","size":9523,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nvd3-community:development","ref":"development","sha":"8bf7c0b583957c86e451efd117f0e47a6558086b","user":{"login":"nvd3-community","id":10244924,"avatar_url":"https://avatars.githubusercontent.com/u/10244924?v=3","gravatar_id":"","url":"https://api.github.com/users/nvd3-community","html_url":"https://github.com/nvd3-community","followers_url":"https://api.github.com/users/nvd3-community/followers","following_url":"https://api.github.com/users/nvd3-community/following{/other_user}","gists_url":"https://api.github.com/users/nvd3-community/gists{/gist_id}","starred_url":"https://api.github.com/users/nvd3-community/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nvd3-community/subscriptions","organizations_url":"https://api.github.com/users/nvd3-community/orgs","repos_url":"https://api.github.com/users/nvd3-community/repos","events_url":"https://api.github.com/users/nvd3-community/events{/privacy}","received_events_url":"https://api.github.com/users/nvd3-community/received_events","type":"Organization","site_admin":false},"repo":{"id":28253327,"name":"nvd3","full_name":"nvd3-community/nvd3","owner":{"login":"nvd3-community","id":10244924,"avatar_url":"https://avatars.githubusercontent.com/u/10244924?v=3","gravatar_id":"","url":"https://api.github.com/users/nvd3-community","html_url":"https://github.com/nvd3-community","followers_url":"https://api.github.com/users/nvd3-community/followers","following_url":"https://api.github.com/users/nvd3-community/following{/other_user}","gists_url":"https://api.github.com/users/nvd3-community/gists{/gist_id}","starred_url":"https://api.github.com/users/nvd3-community/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nvd3-community/subscriptions","organizations_url":"https://api.github.com/users/nvd3-community/orgs","repos_url":"https://api.github.com/users/nvd3-community/repos","events_url":"https://api.github.com/users/nvd3-community/events{/privacy}","received_events_url":"https://api.github.com/users/nvd3-community/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nvd3-community/nvd3","description":"A reusable chart library for d3.js","fork":true,"url":"https://api.github.com/repos/nvd3-community/nvd3","forks_url":"https://api.github.com/repos/nvd3-community/nvd3/forks","keys_url":"https://api.github.com/repos/nvd3-community/nvd3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nvd3-community/nvd3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nvd3-community/nvd3/teams","hooks_url":"https://api.github.com/repos/nvd3-community/nvd3/hooks","issue_events_url":"https://api.github.com/repos/nvd3-community/nvd3/issues/events{/number}","events_url":"https://api.github.com/repos/nvd3-community/nvd3/events","assignees_url":"https://api.github.com/repos/nvd3-community/nvd3/assignees{/user}","branches_url":"https://api.github.com/repos/nvd3-community/nvd3/branches{/branch}","tags_url":"https://api.github.com/repos/nvd3-community/nvd3/tags","blobs_url":"https://api.github.com/repos/nvd3-community/nvd3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nvd3-community/nvd3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nvd3-community/nvd3/git/refs{/sha}","trees_url":"https://api.github.com/repos/nvd3-community/nvd3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nvd3-community/nvd3/statuses/{sha}","languages_url":"https://api.github.com/repos/nvd3-community/nvd3/languages","stargazers_url":"https://api.github.com/repos/nvd3-community/nvd3/stargazers","contributors_url":"https://api.github.com/repos/nvd3-community/nvd3/contributors","subscribers_url":"https://api.github.com/repos/nvd3-community/nvd3/subscribers","subscription_url":"https://api.github.com/repos/nvd3-community/nvd3/subscription","commits_url":"https://api.github.com/repos/nvd3-community/nvd3/commits{/sha}","git_commits_url":"https://api.github.com/repos/nvd3-community/nvd3/git/commits{/sha}","comments_url":"https://api.github.com/repos/nvd3-community/nvd3/comments{/number}","issue_comment_url":"https://api.github.com/repos/nvd3-community/nvd3/issues/comments/{number}","contents_url":"https://api.github.com/repos/nvd3-community/nvd3/contents/{+path}","compare_url":"https://api.github.com/repos/nvd3-community/nvd3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nvd3-community/nvd3/merges","archive_url":"https://api.github.com/repos/nvd3-community/nvd3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nvd3-community/nvd3/downloads","issues_url":"https://api.github.com/repos/nvd3-community/nvd3/issues{/number}","pulls_url":"https://api.github.com/repos/nvd3-community/nvd3/pulls{/number}","milestones_url":"https://api.github.com/repos/nvd3-community/nvd3/milestones{/number}","notifications_url":"https://api.github.com/repos/nvd3-community/nvd3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nvd3-community/nvd3/labels{/name}","releases_url":"https://api.github.com/repos/nvd3-community/nvd3/releases{/id}","created_at":"2014-12-20T01:46:41Z","updated_at":"2015-02-11T09:20:02Z","pushed_at":"2015-02-11T22:22:45Z","git_url":"git://github.com/nvd3-community/nvd3.git","ssh_url":"git@github.com:nvd3-community/nvd3.git","clone_url":"https://github.com/nvd3-community/nvd3.git","svn_url":"https://github.com/nvd3-community/nvd3","homepage":"http://nvd3-community.github.io/nvd3/","size":10032,"stargazers_count":133,"watchers_count":133,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":27,"mirror_url":null,"open_issues_count":23,"forks":27,"open_issues":23,"watchers":133,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nvd3-community/nvd3/pulls/63"},"html":{"href":"https://github.com/nvd3-community/nvd3/pull/63"},"issue":{"href":"https://api.github.com/repos/nvd3-community/nvd3/issues/63"},"comments":{"href":"https://api.github.com/repos/nvd3-community/nvd3/issues/63/comments"},"review_comments":{"href":"https://api.github.com/repos/nvd3-community/nvd3/pulls/63/comments"},"review_comment":{"href":"https://api.github.com/repos/nvd3-community/nvd3/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/nvd3-community/nvd3/pulls/63/commits"},"statuses":{"href":"https://api.github.com/repos/nvd3-community/nvd3/statuses/5f0f6b4daf44ec9283e53f7c0a58111305feb001"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"liquidpele","id":1065913,"avatar_url":"https://avatars.githubusercontent.com/u/1065913?v=3","gravatar_id":"","url":"https://api.github.com/users/liquidpele","html_url":"https://github.com/liquidpele","followers_url":"https://api.github.com/users/liquidpele/followers","following_url":"https://api.github.com/users/liquidpele/following{/other_user}","gists_url":"https://api.github.com/users/liquidpele/gists{/gist_id}","starred_url":"https://api.github.com/users/liquidpele/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liquidpele/subscriptions","organizations_url":"https://api.github.com/users/liquidpele/orgs","repos_url":"https://api.github.com/users/liquidpele/repos","events_url":"https://api.github.com/users/liquidpele/events{/privacy}","received_events_url":"https://api.github.com/users/liquidpele/received_events","type":"User","site_admin":false},"comments":3,"review_comments":0,"commits":3,"additions":154,"deletions":0,"changed_files":26}}