{"action":"created","comment":{"url":"https://api.github.com/repos/palantir/plottable/pulls/comments/23739326","id":23739326,"diff_hunk":"@@ -0,0 +1,249 @@\n+///<reference path=\"../reference.ts\" />\n+\n+module Plottable {\n+export module Component {\n+  export class InterpolatedColorLegend extends AbstractComponent {\n+    private _measurer: SVGTypewriter.Measurers.Measurer;\n+    private _wrapper: SVGTypewriter.Wrappers.Wrapper;\n+    private _writer: SVGTypewriter.Writers.Writer;\n+    private _scale: Scale.InterpolatedColor;\n+    private _orientation: String ;\n+    private _padding = 5;\n+    private _formatter: Formatter;\n+\n+    private _swatchContainer: D3.Selection;\n+    private _lowerLabel: D3.Selection;\n+    private _upperLabel: D3.Selection;\n+\n+    /**\n+     * The css class applied to the legend labels.\n+     */\n+    public static LEGEND_LABEL_CLASS = \"legend-label\";\n+\n+    /**\n+     * Creates an InterpolatedColorLegend.\n+     *\n+     * The InterpolatedColorLegend consists of a sequence of swatches, showing the\n+     * associated Scale.InterpolatedColor sampled at various points. Two labels\n+     * show the maximum and minimum values of the Scale.InterpolatedColor.\n+     *\n+     * @constructor\n+     * @param {Scale.InterpolatedColor} interpolatedColorScale\n+     * @param {string} orientation (horizontal/left/right).\n+     * @param {Formatter} The labels are formatted using this function.\n+     */\n+    constructor(interpolatedColorScale: Scale.InterpolatedColor, orientation = \"horizontal\", formatter = Formatters.general()) {\n+      super();\n+      if (interpolatedColorScale == null ) {\n+        throw new Error(\"InterpolatedColorLegend requires a interpolatedColorScale\");\n+      }\n+      this._scale = interpolatedColorScale;\n+      this._formatter = formatter;\n+      this._orientation = InterpolatedColorLegend.validateOrientation(orientation);\n+\n+      this._fixedWidthFlag = true;\n+      this._fixedHeightFlag = true;\n+    }\n+\n+    /**\n+     * Gets the current formatter on the InterpolatedColorLegend.\n+     *\n+     * @returns {Formatter} The current Formatter.\n+     */\n+    public formatter(): Formatter;\n+    /**\n+     * Sets the current formatter on the InterpolatedColorLegend.\n+     *\n+     * @param {Formatter} formatter If provided, data will be passed though `formatter(data)`.\n+     * @returns {InterpolatedColorLegend} The calling InterpolatedColorLegend.\n+     */\n+    public formatter(formatter: Formatter): InterpolatedColorLegend;\n+    public formatter(formatter?: Formatter): any {\n+      if (formatter === undefined) {\n+        return this._formatter;\n+      }\n+      this._formatter = formatter;\n+      this._invalidateLayout();\n+      return this;\n+    }\n+\n+    private static validateOrientation(orientation: string) {\n+      orientation = orientation.toLowerCase();\n+      if (orientation === \"horizontal\" || orientation === \"left\" || orientation === \"right\") {\n+        return orientation;\n+      } else {\n+        throw new Error(\"\\\"\" + orientation + \"\\\" is not a valid orientation for InterpolatedColorLegend\");\n+      }\n+    }\n+\n+    /**\n+     * Gets the orientation of the InterpolatedColorLegend.\n+     *\n+     * @returns {string} The current orientation.\n+     */\n+    public orient(): string;\n+    /**\n+     * Sets the orientation of the InterpolatedColorLegend.\n+     *\n+     * @param {string} newOrientation The desired orientation (horizontal/left/right).\n+     *\n+     * @returns {InterpolatedColorLegend} The calling InterpolatedColorLegend.\n+     */\n+    public orient(newOrientation: string): InterpolatedColorLegend;\n+    public orient(newOrientation?: string): any {\n+      if (newOrientation == null) {\n+        return this._orientation;\n+      } else {\n+        this._orientation = InterpolatedColorLegend.validateOrientation(newOrientation);\n+        this._invalidateLayout();\n+        return this;\n+      }\n+    }\n+\n+    protected _setup() {\n+      super._setup();\n+      this.classed(\"legend\", true).classed(\"interpolated-color-legend\", true);","path":"src/components/interpolatedColorLegend.ts","position":117,"original_position":105,"commit_id":"0af16b369c2c7f945a2cc78e0197b12abe696e1d","original_commit_id":"c76164d275f50a904d2be370068c3caa1593da1d","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":"They can only remove it after the render step though.","created_at":"2015-01-29T01:01:08Z","updated_at":"2015-01-29T01:01:08Z","html_url":"https://github.com/palantir/plottable/pull/1557#discussion_r23739326","pull_request_url":"https://api.github.com/repos/palantir/plottable/pulls/1557","_links":{"self":{"href":"https://api.github.com/repos/palantir/plottable/pulls/comments/23739326"},"html":{"href":"https://github.com/palantir/plottable/pull/1557#discussion_r23739326"},"pull_request":{"href":"https://api.github.com/repos/palantir/plottable/pulls/1557"}}},"pull_request":{"url":"https://api.github.com/repos/palantir/plottable/pulls/1557","id":28236429,"html_url":"https://github.com/palantir/plottable/pull/1557","diff_url":"https://github.com/palantir/plottable/pull/1557.diff","patch_url":"https://github.com/palantir/plottable/pull/1557.patch","issue_url":"https://api.github.com/repos/palantir/plottable/issues/1557","number":1557,"state":"open","locked":false,"title":"Add in InterpolatedColorLegend.","user":{"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},"body":"Modified Scale.InterpolatedColor to allow sampling the backing D3 scale (using ticks()).\r\n\r\nTests to come shortly.\r\n\r\nClose #1528.\r\n\r\nLooks like this: (bounding box shown for clarity)\r\n![screen shot 2015-01-28 at 3 53 53 pm](https://cloud.githubusercontent.com/assets/1440449/5949737/ebbeb2e2-a705-11e4-8164-3ac18c197525.png)\r\n![screen shot 2015-01-28 at 3 57 18 pm](https://cloud.githubusercontent.com/assets/1440449/5949778/5c712b50-a706-11e4-838d-779d399e7eab.png)\r\n\r\n","created_at":"2015-01-28T22:35:49Z","updated_at":"2015-01-29T01:01:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0f6a6a6f22e153e637f182fdff07e10803bd0eaf","assignee":{"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},"milestone":{"url":"https://api.github.com/repos/palantir/plottable/milestones/30","labels_url":"https://api.github.com/repos/palantir/plottable/milestones/30/labels","id":937550,"number":30,"title":"v0.42.0","description":"","creator":{"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},"open_issues":7,"closed_issues":3,"state":"open","created_at":"2015-01-15T22:41:04Z","updated_at":"2015-01-28T22:55:03Z","due_on":"2015-01-30T08:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/palantir/plottable/pulls/1557/commits","review_comments_url":"https://api.github.com/repos/palantir/plottable/pulls/1557/comments","review_comment_url":"https://api.github.com/repos/palantir/plottable/pulls/comments/{number}","comments_url":"https://api.github.com/repos/palantir/plottable/issues/1557/comments","statuses_url":"https://api.github.com/repos/palantir/plottable/statuses/0af16b369c2c7f945a2cc78e0197b12abe696e1d","head":{"label":"palantir:1528-FR","ref":"1528-FR","sha":"0af16b369c2c7f945a2cc78e0197b12abe696e1d","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-01-28T14:16:49Z","pushed_at":"2015-01-29T00:41:45Z","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":50845,"stargazers_count":368,"watchers_count":368,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":135,"forks":30,"open_issues":135,"watchers":368,"default_branch":"develop"}},"base":{"label":"palantir:develop","ref":"develop","sha":"db6d1ed2323d611a8c18936d27b2c107709765ef","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-01-28T14:16:49Z","pushed_at":"2015-01-29T00:41:45Z","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":50845,"stargazers_count":368,"watchers_count":368,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":135,"forks":30,"open_issues":135,"watchers":368,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/palantir/plottable/pulls/1557"},"html":{"href":"https://github.com/palantir/plottable/pull/1557"},"issue":{"href":"https://api.github.com/repos/palantir/plottable/issues/1557"},"comments":{"href":"https://api.github.com/repos/palantir/plottable/issues/1557/comments"},"review_comments":{"href":"https://api.github.com/repos/palantir/plottable/pulls/1557/comments"},"review_comment":{"href":"https://api.github.com/repos/palantir/plottable/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/palantir/plottable/pulls/1557/commits"},"statuses":{"href":"https://api.github.com/repos/palantir/plottable/statuses/0af16b369c2c7f945a2cc78e0197b12abe696e1d"}}}}