{"action":"created","comment":{"url":"https://api.github.com/repos/palantir/plottable/pulls/comments/29807531","id":29807531,"diff_hunk":"@@ -67,6 +79,82 @@ export module Plots {\n \n       return allPlotData;\n     }\n+\n+    public sectorValue(): AccessorScaleBinding<D, number>;\n+    public sectorValue(sectorValue: number | _Accessor): Plots.Pie<D>;\n+    public sectorValue(sectorValue: D | _Accessor, sectorValueScale: Scale<D, number>): Plots.Pie<D>;\n+    public sectorValue(sectorValue?: number | _Accessor | D, sectorValueScale?: Scale<D, number>): any {\n+      if (sectorValue == null) {\n+        return Pie._constructBinding(this._sectorValue, this._sectorValueScale);\n+      }\n+      this._sectorValue = d3.functor(sectorValue);\n+      Pie._replaceScaleBinding(this._sectorValueScale, sectorValueScale, this._renderCallback);\n+      this._sectorValueScale = sectorValueScale;\n+      this._render();\n+      return this;\n+    }\n+\n+    public innerRadius(): AccessorScaleBinding<D, number>;\n+    public innerRadius(innerRadius: number | _Accessor): Plots.Pie<D>;\n+    public innerRadius(innerRadius: D | _Accessor, innerRadiusScale: Scale<D, number>): Plots.Pie<D>;\n+    public innerRadius(innerRadius?: number | _Accessor | D, innerRadiusScale?: Scale<D, number>): any {\n+      if (innerRadius == null) {\n+        return Pie._constructBinding(this._innerRadius, this._innerRadiusScale);\n+      }\n+      this._innerRadius = d3.functor(innerRadius);\n+      Pie._replaceScaleBinding(this._innerRadiusScale, innerRadiusScale, this._renderCallback);\n+      this._innerRadiusScale = innerRadiusScale;\n+      this._render();\n+      return this;\n+    }\n+\n+    public outerRadius(): AccessorScaleBinding<D, number>;\n+    public outerRadius(outerRadius: number | _Accessor): Plots.Pie<D>;\n+    public outerRadius(outerRadius: D | _Accessor, outerRadiusScale: Scale<D, number>): Plots.Pie<D>;\n+    public outerRadius(outerRadius?: number | _Accessor | D, outerRadiusScale?: Scale<D, number>): any {\n+      if (outerRadius == null) {\n+        return Pie._constructBinding(this._outerRadius, this._outerRadiusScale);\n+      }\n+      this._outerRadius = d3.functor(outerRadius);\n+      Pie._replaceScaleBinding(this._outerRadiusScale, outerRadiusScale, this._renderCallback);\n+      this._outerRadiusScale = outerRadiusScale;\n+      this._render();\n+      return this;\n+    }\n+\n+    public scaledInnerRadiusAccessor(): _Accessor {\n+      return Pie._scaledValueAccessor(this._innerRadius, this._innerRadiusScale);\n+    }\n+\n+    public scaledOuterRadiusAccessor(): _Accessor {\n+      return Pie._scaledValueAccessor(this._outerRadius, this._outerRadiusScale);\n+    }\n+\n+    public scaledSectorValueAccessor(): _Accessor {\n+      return Pie._scaledValueAccessor(this._sectorValue, this._sectorValueScale);\n+    }\n+\n+    private static _scaledValueAccessor<V, SD, SR>(value: _Accessor, scale: Scale<SD, SR>): _Accessor {\n+      return scale == null ?\n+               value :\n+               (d: any, i: number, u: any, m: Plots.PlotMetadata) => scale.scale(value(d, i, u, m));\n+    }\n+\n+    private static _constructBinding<V, D, R>(value: V | _Accessor, scale: Scale<D, number>) {\n+      return scale == null ? { accessor: value } : { accessor: value, scale: scale };","path":"src/components/plots/piePlot.ts","position":125,"original_position":125,"commit_id":"927730d4baaebf8aac59afb5e632a71d07998ede","original_commit_id":"927730d4baaebf8aac59afb5e632a71d07998ede","user":{"login":"bluong","id":1448299,"avatar_url":"https://avatars.githubusercontent.com/u/1448299?v=3","gravatar_id":"","url":"https://api.github.com/users/bluong","html_url":"https://github.com/bluong","followers_url":"https://api.github.com/users/bluong/followers","following_url":"https://api.github.com/users/bluong/following{/other_user}","gists_url":"https://api.github.com/users/bluong/gists{/gist_id}","starred_url":"https://api.github.com/users/bluong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluong/subscriptions","organizations_url":"https://api.github.com/users/bluong/orgs","repos_url":"https://api.github.com/users/bluong/repos","events_url":"https://api.github.com/users/bluong/events{/privacy}","received_events_url":"https://api.github.com/users/bluong/received_events","type":"User","site_admin":false},"body":"Oh I was nervous on sending scale through.  I'll adjust accordingly","created_at":"2015-05-06T22:07:18Z","updated_at":"2015-05-06T22:07:18Z","html_url":"https://github.com/palantir/plottable/pull/1966#discussion_r29807531","pull_request_url":"https://api.github.com/repos/palantir/plottable/pulls/1966","_links":{"self":{"href":"https://api.github.com/repos/palantir/plottable/pulls/comments/29807531"},"html":{"href":"https://github.com/palantir/plottable/pull/1966#discussion_r29807531"},"pull_request":{"href":"https://api.github.com/repos/palantir/plottable/pulls/1966"}}},"pull_request":{"url":"https://api.github.com/repos/palantir/plottable/pulls/1966","id":34704542,"html_url":"https://github.com/palantir/plottable/pull/1966","diff_url":"https://github.com/palantir/plottable/pull/1966.diff","patch_url":"https://github.com/palantir/plottable/pull/1966.patch","issue_url":"https://api.github.com/repos/palantir/plottable/issues/1966","number":1966,"state":"open","locked":false,"title":"[Plots.Pie] - Replacing project calls with separate accessor API","user":{"login":"bluong","id":1448299,"avatar_url":"https://avatars.githubusercontent.com/u/1448299?v=3","gravatar_id":"","url":"https://api.github.com/users/bluong","html_url":"https://github.com/bluong","followers_url":"https://api.github.com/users/bluong/followers","following_url":"https://api.github.com/users/bluong/following{/other_user}","gists_url":"https://api.github.com/users/bluong/gists{/gist_id}","starred_url":"https://api.github.com/users/bluong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluong/subscriptions","organizations_url":"https://api.github.com/users/bluong/orgs","repos_url":"https://api.github.com/users/bluong/repos","events_url":"https://api.github.com/users/bluong/events{/privacy}","received_events_url":"https://api.github.com/users/bluong/received_events","type":"User","site_admin":false},"body":"Before the usage to set the value accessor, inner radius accessor, and the outer radius accessor was, respectively:\r\n\r\n```typescript\r\npiePlot.project(\"value\", \"dataKey\");\r\npiePlot.project(\"inner-radius\", 10);\r\npiePlot.project(\"outer-radius\", 20);\r\n```\r\n\r\nThis should really be split out into accessors like the following..\r\n\r\n```typescript\r\npiePlot.sectorValue((d) => d.value);\r\npiePlot.innerRadius(10);\r\npiePlot.outerRadius(20);\r\n```\r\n\r\nIn accordance, plots should have the ideas of scales as that is what drives Plottable.  In accordance, there could be this usage:\r\n\r\n```typescript\r\nvar linearScale = new Plottable.Scales.Linear();\r\npiePlot.outerRadius((d) => d.value, linearScale);\r\n```\r\n\r\nBecause of the above setter endpoints, the getters are currently of this form\r\n\r\n```typescript\r\n// Returns an object where\r\n// the `accessor` attribute returns the accessor of the innerRadius\r\n// and where `scale` returns the scale that the value is backing\r\n// (this parameter is optional for when the value isn't backing a scale)\r\npiePlot.innerRadius();\r\n```\r\n\r\nNote 1: The names of the API are up for debate.  I personally am probably more in line of something like\r\n```typescript\r\npiePlot.sectorValue((d) => d.value);\r\n```\r\nSee that the word accessor has been removed.  This also semantically allows for something like...\r\n```typescript\r\npiePlot.innerRadius(0);\r\n```\r\n\r\nEDIT: We should go with the simpler idea of removing the accessor suffix.\r\n\r\nNote 2: For reviewers, note that basically the corresponding Drawer has gotten a tiny bit more messy but at the same time a lot of responsibility has been lifted from it.  I am unsure of the architecture of Drawers as of the moment but I am hopefully removing pieces from it as I grunge it up a bit to get our API into a steady state.","created_at":"2015-05-05T08:35:26Z","updated_at":"2015-05-06T22:07:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4d85a8414017f50ded1f42bed382ce5f478ac9d8","assignee":{"login":"jtlan","id":1440449,"avatar_url":"https://avatars.githubusercontent.com/u/1440449?v=3","gravatar_id":"","url":"https://api.github.com/users/jtlan","html_url":"https://github.com/jtlan","followers_url":"https://api.github.com/users/jtlan/followers","following_url":"https://api.github.com/users/jtlan/following{/other_user}","gists_url":"https://api.github.com/users/jtlan/gists{/gist_id}","starred_url":"https://api.github.com/users/jtlan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtlan/subscriptions","organizations_url":"https://api.github.com/users/jtlan/orgs","repos_url":"https://api.github.com/users/jtlan/repos","events_url":"https://api.github.com/users/jtlan/events{/privacy}","received_events_url":"https://api.github.com/users/jtlan/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/palantir/plottable/pulls/1966/commits","review_comments_url":"https://api.github.com/repos/palantir/plottable/pulls/1966/comments","review_comment_url":"https://api.github.com/repos/palantir/plottable/pulls/comments{/number}","comments_url":"https://api.github.com/repos/palantir/plottable/issues/1966/comments","statuses_url":"https://api.github.com/repos/palantir/plottable/statuses/927730d4baaebf8aac59afb5e632a71d07998ede","head":{"label":"palantir:piePlot","ref":"piePlot","sha":"927730d4baaebf8aac59afb5e632a71d07998ede","user":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":16149854,"name":"plottable","full_name":"palantir/plottable","owner":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/palantir/plottable","description":"A library of modular chart components, built on D3","fork":false,"url":"https://api.github.com/repos/palantir/plottable","forks_url":"https://api.github.com/repos/palantir/plottable/forks","keys_url":"https://api.github.com/repos/palantir/plottable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/plottable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/plottable/teams","hooks_url":"https://api.github.com/repos/palantir/plottable/hooks","issue_events_url":"https://api.github.com/repos/palantir/plottable/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/plottable/events","assignees_url":"https://api.github.com/repos/palantir/plottable/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/plottable/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/plottable/tags","blobs_url":"https://api.github.com/repos/palantir/plottable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/plottable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/plottable/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/plottable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/plottable/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/plottable/languages","stargazers_url":"https://api.github.com/repos/palantir/plottable/stargazers","contributors_url":"https://api.github.com/repos/palantir/plottable/contributors","subscribers_url":"https://api.github.com/repos/palantir/plottable/subscribers","subscription_url":"https://api.github.com/repos/palantir/plottable/subscription","commits_url":"https://api.github.com/repos/palantir/plottable/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/plottable/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/plottable/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/plottable/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/plottable/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/plottable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/plottable/merges","archive_url":"https://api.github.com/repos/palantir/plottable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/plottable/downloads","issues_url":"https://api.github.com/repos/palantir/plottable/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/plottable/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/plottable/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/plottable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/plottable/labels{/name}","releases_url":"https://api.github.com/repos/palantir/plottable/releases{/id}","created_at":"2014-01-22T19:29:19Z","updated_at":"2015-05-06T17:05:45Z","pushed_at":"2015-05-06T22:07:11Z","git_url":"git://github.com/palantir/plottable.git","ssh_url":"git@github.com:palantir/plottable.git","clone_url":"https://github.com/palantir/plottable.git","svn_url":"https://github.com/palantir/plottable","homepage":"plottablejs.org","size":77768,"stargazers_count":460,"watchers_count":460,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":149,"forks":40,"open_issues":149,"watchers":460,"default_branch":"develop"}},"base":{"label":"palantir:splitDataProject","ref":"splitDataProject","sha":"4e143e5102004a47ab5aa08a46ea35b8cdd6db67","user":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":16149854,"name":"plottable","full_name":"palantir/plottable","owner":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/palantir/plottable","description":"A library of modular chart components, built on D3","fork":false,"url":"https://api.github.com/repos/palantir/plottable","forks_url":"https://api.github.com/repos/palantir/plottable/forks","keys_url":"https://api.github.com/repos/palantir/plottable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/plottable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/plottable/teams","hooks_url":"https://api.github.com/repos/palantir/plottable/hooks","issue_events_url":"https://api.github.com/repos/palantir/plottable/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/plottable/events","assignees_url":"https://api.github.com/repos/palantir/plottable/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/plottable/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/plottable/tags","blobs_url":"https://api.github.com/repos/palantir/plottable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/plottable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/plottable/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/plottable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/plottable/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/plottable/languages","stargazers_url":"https://api.github.com/repos/palantir/plottable/stargazers","contributors_url":"https://api.github.com/repos/palantir/plottable/contributors","subscribers_url":"https://api.github.com/repos/palantir/plottable/subscribers","subscription_url":"https://api.github.com/repos/palantir/plottable/subscription","commits_url":"https://api.github.com/repos/palantir/plottable/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/plottable/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/plottable/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/plottable/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/plottable/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/plottable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/plottable/merges","archive_url":"https://api.github.com/repos/palantir/plottable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/plottable/downloads","issues_url":"https://api.github.com/repos/palantir/plottable/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/plottable/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/plottable/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/plottable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/plottable/labels{/name}","releases_url":"https://api.github.com/repos/palantir/plottable/releases{/id}","created_at":"2014-01-22T19:29:19Z","updated_at":"2015-05-06T17:05:45Z","pushed_at":"2015-05-06T22:07:11Z","git_url":"git://github.com/palantir/plottable.git","ssh_url":"git@github.com:palantir/plottable.git","clone_url":"https://github.com/palantir/plottable.git","svn_url":"https://github.com/palantir/plottable","homepage":"plottablejs.org","size":77768,"stargazers_count":460,"watchers_count":460,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":149,"forks":40,"open_issues":149,"watchers":460,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/palantir/plottable/pulls/1966"},"html":{"href":"https://github.com/palantir/plottable/pull/1966"},"issue":{"href":"https://api.github.com/repos/palantir/plottable/issues/1966"},"comments":{"href":"https://api.github.com/repos/palantir/plottable/issues/1966/comments"},"review_comments":{"href":"https://api.github.com/repos/palantir/plottable/pulls/1966/comments"},"review_comment":{"href":"https://api.github.com/repos/palantir/plottable/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/palantir/plottable/pulls/1966/commits"},"statuses":{"href":"https://api.github.com/repos/palantir/plottable/statuses/927730d4baaebf8aac59afb5e632a71d07998ede"}}}}