{"action":"created","comment":{"url":"https://api.github.com/repos/vega/vega-lite/pulls/comments/72733088","id":72733088,"diff_hunk":"@@ -319,9 +319,31 @@ export function alwaysNoOcclusion(spec: ExtendedUnitSpec): boolean {\n   return vlEncoding.isAggregate(spec.encoding);\n }\n \n+function hasFieldDef(fieldDefs: FieldDef[], fieldDef: FieldDef): boolean {\n+  for (let i = 0; i < fieldDefs.length; i++) {\n+    if (identical(fieldDefs[i], fieldDef)) {\n+      return true;\n+    }\n+  }\n+  return false;\n+}\n+\n export function fieldDefs(spec: ExtendedUnitSpec | LayerSpec): FieldDef[] {","path":"src/spec.ts","position":null,"original_position":22,"commit_id":"991f45d91ed0a9a0f86ac406763934b931ce5659","original_commit_id":"991f45d91ed0a9a0f86ac406763934b931ce5659","user":{"login":"ZeningQu","id":822034,"avatar_url":"https://avatars.githubusercontent.com/u/822034?v=3","gravatar_id":"","url":"https://api.github.com/users/ZeningQu","html_url":"https://github.com/ZeningQu","followers_url":"https://api.github.com/users/ZeningQu/followers","following_url":"https://api.github.com/users/ZeningQu/following{/other_user}","gists_url":"https://api.github.com/users/ZeningQu/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeningQu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeningQu/subscriptions","organizations_url":"https://api.github.com/users/ZeningQu/orgs","repos_url":"https://api.github.com/users/ZeningQu/repos","events_url":"https://api.github.com/users/ZeningQu/events{/privacy}","received_events_url":"https://api.github.com/users/ZeningQu/received_events","type":"User","site_admin":false},"body":"Should I add `ExtendedFacetSpec` too?","created_at":"2016-07-29T02:03:09Z","updated_at":"2016-07-29T02:03:09Z","html_url":"https://github.com/vega/vega-lite/pull/1481#discussion_r72733088","pull_request_url":"https://api.github.com/repos/vega/vega-lite/pulls/1481","_links":{"self":{"href":"https://api.github.com/repos/vega/vega-lite/pulls/comments/72733088"},"html":{"href":"https://github.com/vega/vega-lite/pull/1481#discussion_r72733088"},"pull_request":{"href":"https://api.github.com/repos/vega/vega-lite/pulls/1481"}}},"pull_request":{"url":"https://api.github.com/repos/vega/vega-lite/pulls/1481","id":79219764,"html_url":"https://github.com/vega/vega-lite/pull/1481","diff_url":"https://github.com/vega/vega-lite/pull/1481.diff","patch_url":"https://github.com/vega/vega-lite/pull/1481.patch","issue_url":"https://api.github.com/repos/vega/vega-lite/issues/1481","number":1481,"state":"open","locked":false,"title":"[WIP] Get fieldDefs for layered charts","user":{"login":"ZeningQu","id":822034,"avatar_url":"https://avatars.githubusercontent.com/u/822034?v=3","gravatar_id":"","url":"https://api.github.com/users/ZeningQu","html_url":"https://github.com/ZeningQu","followers_url":"https://api.github.com/users/ZeningQu/followers","following_url":"https://api.github.com/users/ZeningQu/following{/other_user}","gists_url":"https://api.github.com/users/ZeningQu/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeningQu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeningQu/subscriptions","organizations_url":"https://api.github.com/users/ZeningQu/orgs","repos_url":"https://api.github.com/users/ZeningQu/repos","events_url":"https://api.github.com/users/ZeningQu/events{/privacy}","received_events_url":"https://api.github.com/users/ZeningQu/received_events","type":"User","site_admin":false},"body":"This PR gets `fieldDefs` from layered chart specs (Fix https://github.com/vega/vega-lite/issues/1476)\r\n\r\nRight now I'm only getting `fieldDefs` from the first layer in `spec.layers` because this unblocks https://github.com/vega/vega-tooltip/issues/47\r\n\r\n`vl.spec.fieldDefs` now returns non-duplicate `fieldDef` for all layers. By \"non-duplicate\" I mean there must be at least one difference between two `fieldDef` objects (`field`, `type`, `value`, `timeUnit`, `bin`, `aggregate`, `title`).\r\n\r\nIf a `spec` has\r\n``` js\r\nlayers: [\r\n  {\r\n    mark: line,\r\n    encoding: {\r\n      x: {field: A, type: quantitative},\r\n      y: {field: B, type: quantitative}\r\n    }\r\n  },\r\n  {\r\n    mark: point,\r\n    encoding: {\r\n      x: {field: A, type: quantitative},\r\n      y: {field: B, type: quantitative},\r\n      color: {field: A, type: quantitative, bin: true}\r\n    }\r\n  }\r\n]\r\n```\r\n`vl.spec.fieldDefs(spec)` will return `[{field: A, type: quantitative}, {field: B, type: quantitative}, {field: A, type: quantitative, bin: true}]`","created_at":"2016-07-28T15:44:06Z","updated_at":"2016-07-29T02:03:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"06368a79fc20d9369b0ab5c2beb748989de6e20e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/vega/vega-lite/pulls/1481/commits","review_comments_url":"https://api.github.com/repos/vega/vega-lite/pulls/1481/comments","review_comment_url":"https://api.github.com/repos/vega/vega-lite/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vega/vega-lite/issues/1481/comments","statuses_url":"https://api.github.com/repos/vega/vega-lite/statuses/991f45d91ed0a9a0f86ac406763934b931ce5659","head":{"label":"vega:zqu/get-layers-fieldDefs","ref":"zqu/get-layers-fieldDefs","sha":"991f45d91ed0a9a0f86ac406763934b931ce5659","user":{"login":"vega","id":11796929,"avatar_url":"https://avatars.githubusercontent.com/u/11796929?v=3","gravatar_id":"","url":"https://api.github.com/users/vega","html_url":"https://github.com/vega","followers_url":"https://api.github.com/users/vega/followers","following_url":"https://api.github.com/users/vega/following{/other_user}","gists_url":"https://api.github.com/users/vega/gists{/gist_id}","starred_url":"https://api.github.com/users/vega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vega/subscriptions","organizations_url":"https://api.github.com/users/vega/orgs","repos_url":"https://api.github.com/users/vega/repos","events_url":"https://api.github.com/users/vega/events{/privacy}","received_events_url":"https://api.github.com/users/vega/received_events","type":"Organization","site_admin":false},"repo":{"id":26931359,"name":"vega-lite","full_name":"vega/vega-lite","owner":{"login":"vega","id":11796929,"avatar_url":"https://avatars.githubusercontent.com/u/11796929?v=3","gravatar_id":"","url":"https://api.github.com/users/vega","html_url":"https://github.com/vega","followers_url":"https://api.github.com/users/vega/followers","following_url":"https://api.github.com/users/vega/following{/other_user}","gists_url":"https://api.github.com/users/vega/gists{/gist_id}","starred_url":"https://api.github.com/users/vega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vega/subscriptions","organizations_url":"https://api.github.com/users/vega/orgs","repos_url":"https://api.github.com/users/vega/repos","events_url":"https://api.github.com/users/vega/events{/privacy}","received_events_url":"https://api.github.com/users/vega/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vega/vega-lite","description":"A high-level grammar for visual analysis, built on top of Vega.","fork":false,"url":"https://api.github.com/repos/vega/vega-lite","forks_url":"https://api.github.com/repos/vega/vega-lite/forks","keys_url":"https://api.github.com/repos/vega/vega-lite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vega/vega-lite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vega/vega-lite/teams","hooks_url":"https://api.github.com/repos/vega/vega-lite/hooks","issue_events_url":"https://api.github.com/repos/vega/vega-lite/issues/events{/number}","events_url":"https://api.github.com/repos/vega/vega-lite/events","assignees_url":"https://api.github.com/repos/vega/vega-lite/assignees{/user}","branches_url":"https://api.github.com/repos/vega/vega-lite/branches{/branch}","tags_url":"https://api.github.com/repos/vega/vega-lite/tags","blobs_url":"https://api.github.com/repos/vega/vega-lite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vega/vega-lite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vega/vega-lite/git/refs{/sha}","trees_url":"https://api.github.com/repos/vega/vega-lite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vega/vega-lite/statuses/{sha}","languages_url":"https://api.github.com/repos/vega/vega-lite/languages","stargazers_url":"https://api.github.com/repos/vega/vega-lite/stargazers","contributors_url":"https://api.github.com/repos/vega/vega-lite/contributors","subscribers_url":"https://api.github.com/repos/vega/vega-lite/subscribers","subscription_url":"https://api.github.com/repos/vega/vega-lite/subscription","commits_url":"https://api.github.com/repos/vega/vega-lite/commits{/sha}","git_commits_url":"https://api.github.com/repos/vega/vega-lite/git/commits{/sha}","comments_url":"https://api.github.com/repos/vega/vega-lite/comments{/number}","issue_comment_url":"https://api.github.com/repos/vega/vega-lite/issues/comments{/number}","contents_url":"https://api.github.com/repos/vega/vega-lite/contents/{+path}","compare_url":"https://api.github.com/repos/vega/vega-lite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vega/vega-lite/merges","archive_url":"https://api.github.com/repos/vega/vega-lite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vega/vega-lite/downloads","issues_url":"https://api.github.com/repos/vega/vega-lite/issues{/number}","pulls_url":"https://api.github.com/repos/vega/vega-lite/pulls{/number}","milestones_url":"https://api.github.com/repos/vega/vega-lite/milestones{/number}","notifications_url":"https://api.github.com/repos/vega/vega-lite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vega/vega-lite/labels{/name}","releases_url":"https://api.github.com/repos/vega/vega-lite/releases{/id}","deployments_url":"https://api.github.com/repos/vega/vega-lite/deployments","created_at":"2014-11-20T20:52:04Z","updated_at":"2016-07-27T16:17:18Z","pushed_at":"2016-07-29T00:25:37Z","git_url":"git://github.com/vega/vega-lite.git","ssh_url":"git@github.com:vega/vega-lite.git","clone_url":"https://github.com/vega/vega-lite.git","svn_url":"https://github.com/vega/vega-lite","homepage":"https://vega.github.io/vega-lite/","size":27377,"stargazers_count":396,"watchers_count":396,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":45,"mirror_url":null,"open_issues_count":156,"forks":45,"open_issues":156,"watchers":396,"default_branch":"master"}},"base":{"label":"vega:master","ref":"master","sha":"c1ead2bbdd93a4d53092cd5ca64bb32486ac8faa","user":{"login":"vega","id":11796929,"avatar_url":"https://avatars.githubusercontent.com/u/11796929?v=3","gravatar_id":"","url":"https://api.github.com/users/vega","html_url":"https://github.com/vega","followers_url":"https://api.github.com/users/vega/followers","following_url":"https://api.github.com/users/vega/following{/other_user}","gists_url":"https://api.github.com/users/vega/gists{/gist_id}","starred_url":"https://api.github.com/users/vega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vega/subscriptions","organizations_url":"https://api.github.com/users/vega/orgs","repos_url":"https://api.github.com/users/vega/repos","events_url":"https://api.github.com/users/vega/events{/privacy}","received_events_url":"https://api.github.com/users/vega/received_events","type":"Organization","site_admin":false},"repo":{"id":26931359,"name":"vega-lite","full_name":"vega/vega-lite","owner":{"login":"vega","id":11796929,"avatar_url":"https://avatars.githubusercontent.com/u/11796929?v=3","gravatar_id":"","url":"https://api.github.com/users/vega","html_url":"https://github.com/vega","followers_url":"https://api.github.com/users/vega/followers","following_url":"https://api.github.com/users/vega/following{/other_user}","gists_url":"https://api.github.com/users/vega/gists{/gist_id}","starred_url":"https://api.github.com/users/vega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vega/subscriptions","organizations_url":"https://api.github.com/users/vega/orgs","repos_url":"https://api.github.com/users/vega/repos","events_url":"https://api.github.com/users/vega/events{/privacy}","received_events_url":"https://api.github.com/users/vega/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vega/vega-lite","description":"A high-level grammar for visual analysis, built on top of Vega.","fork":false,"url":"https://api.github.com/repos/vega/vega-lite","forks_url":"https://api.github.com/repos/vega/vega-lite/forks","keys_url":"https://api.github.com/repos/vega/vega-lite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vega/vega-lite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vega/vega-lite/teams","hooks_url":"https://api.github.com/repos/vega/vega-lite/hooks","issue_events_url":"https://api.github.com/repos/vega/vega-lite/issues/events{/number}","events_url":"https://api.github.com/repos/vega/vega-lite/events","assignees_url":"https://api.github.com/repos/vega/vega-lite/assignees{/user}","branches_url":"https://api.github.com/repos/vega/vega-lite/branches{/branch}","tags_url":"https://api.github.com/repos/vega/vega-lite/tags","blobs_url":"https://api.github.com/repos/vega/vega-lite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vega/vega-lite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vega/vega-lite/git/refs{/sha}","trees_url":"https://api.github.com/repos/vega/vega-lite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vega/vega-lite/statuses/{sha}","languages_url":"https://api.github.com/repos/vega/vega-lite/languages","stargazers_url":"https://api.github.com/repos/vega/vega-lite/stargazers","contributors_url":"https://api.github.com/repos/vega/vega-lite/contributors","subscribers_url":"https://api.github.com/repos/vega/vega-lite/subscribers","subscription_url":"https://api.github.com/repos/vega/vega-lite/subscription","commits_url":"https://api.github.com/repos/vega/vega-lite/commits{/sha}","git_commits_url":"https://api.github.com/repos/vega/vega-lite/git/commits{/sha}","comments_url":"https://api.github.com/repos/vega/vega-lite/comments{/number}","issue_comment_url":"https://api.github.com/repos/vega/vega-lite/issues/comments{/number}","contents_url":"https://api.github.com/repos/vega/vega-lite/contents/{+path}","compare_url":"https://api.github.com/repos/vega/vega-lite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vega/vega-lite/merges","archive_url":"https://api.github.com/repos/vega/vega-lite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vega/vega-lite/downloads","issues_url":"https://api.github.com/repos/vega/vega-lite/issues{/number}","pulls_url":"https://api.github.com/repos/vega/vega-lite/pulls{/number}","milestones_url":"https://api.github.com/repos/vega/vega-lite/milestones{/number}","notifications_url":"https://api.github.com/repos/vega/vega-lite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vega/vega-lite/labels{/name}","releases_url":"https://api.github.com/repos/vega/vega-lite/releases{/id}","deployments_url":"https://api.github.com/repos/vega/vega-lite/deployments","created_at":"2014-11-20T20:52:04Z","updated_at":"2016-07-27T16:17:18Z","pushed_at":"2016-07-29T00:25:37Z","git_url":"git://github.com/vega/vega-lite.git","ssh_url":"git@github.com:vega/vega-lite.git","clone_url":"https://github.com/vega/vega-lite.git","svn_url":"https://github.com/vega/vega-lite","homepage":"https://vega.github.io/vega-lite/","size":27377,"stargazers_count":396,"watchers_count":396,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":45,"mirror_url":null,"open_issues_count":156,"forks":45,"open_issues":156,"watchers":396,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vega/vega-lite/pulls/1481"},"html":{"href":"https://github.com/vega/vega-lite/pull/1481"},"issue":{"href":"https://api.github.com/repos/vega/vega-lite/issues/1481"},"comments":{"href":"https://api.github.com/repos/vega/vega-lite/issues/1481/comments"},"review_comments":{"href":"https://api.github.com/repos/vega/vega-lite/pulls/1481/comments"},"review_comment":{"href":"https://api.github.com/repos/vega/vega-lite/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vega/vega-lite/pulls/1481/commits"},"statuses":{"href":"https://api.github.com/repos/vega/vega-lite/statuses/991f45d91ed0a9a0f86ac406763934b931ce5659"}}}}
{"actor":{"display_login":"ZeningQu"}}