{"action":"created","comment":{"url":"https://api.github.com/repos/palantir/plottable/pulls/comments/25985882","id":25985882,"diff_hunk":"@@ -0,0 +1,65 @@\n+///<reference path=\"../reference.ts\" />\n+\n+module Plottable {\n+\n+  /**\n+   * A SymbolGenerator is a function that takes in a datum and the index of the datum to\n+   * produce an svg path string analogous to the datum/index pair.\n+   *\n+   * Note that SymbolGenerators used in Plottable will be assumed to work within a 100x100 square\n+   * to be scaled appropriately for use within Plottable\n+   */\n+  export type SymbolGenerator = (datum: any, index: number) => string;\n+\n+  export module SymbolGenerators {\n+\n+    /**\n+     * The radius that symbol generators will be assumed to have for their symbols.\n+     */\n+    export var SYMBOL_GENERATOR_RADIUS = 50;\n+\n+    export type StringAccessor = ((datum: any, index: number) => string);\n+\n+    /**\n+     * A wrapper for D3's symbol generator as documented here:\n+     * https://github.com/mbostock/d3/wiki/SVG-Shapes#symbol\n+     *\n+     * Note that since D3 symbols compute the path strings by knowing how much area it can take up instead of\n+     * knowing its dimensions, the total area expected may be off by some constant factor.\n+     *\n+     * @param {string | ((datum: any, index: number) => string)} symbolType Accessor for the d3 symbol type\n+     * @returns {SymbolGenerator} the symbol generator for a D3 symbol\n+     */\n+    export function d3Symbol(symbolType: string | StringAccessor) {\n+      var typeToSize = (symbolTypeString: string) => {\n+        var sizeFactor: number;\n+        switch(symbolTypeString) {\n+          case \"circle\":\n+            sizeFactor = Math.PI;\n+            break;\n+          case \"square\":\n+            sizeFactor = 4;\n+            break;\n+          case \"cross\":\n+            sizeFactor = 20/9;\n+            break;\n+          case \"diamond\":\n+            sizeFactor = 2 * Math.tan(Math.PI / 6);\n+            break;\n+          case \"triangle-up\":\n+          case \"triangle-down\":\n+            sizeFactor = Math.sqrt(3);","path":"src/utils/symbolGenerators.ts","position":53,"original_position":51,"commit_id":"f8e4f7d73f65bfa740513eaa2bd1f481c00333cd","original_commit_id":"0de5fd9e1419a5ea072dd4795fbd2cceeb92c93f","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 shouldn't need to go away.  Now that these numbers have been calculated, we shouldn't have any bounding issues from D3","created_at":"2015-03-06T23:02:47Z","updated_at":"2015-03-06T23:02:47Z","html_url":"https://github.com/palantir/plottable/pull/1708#discussion_r25985882","pull_request_url":"https://api.github.com/repos/palantir/plottable/pulls/1708","_links":{"self":{"href":"https://api.github.com/repos/palantir/plottable/pulls/comments/25985882"},"html":{"href":"https://github.com/palantir/plottable/pull/1708#discussion_r25985882"},"pull_request":{"href":"https://api.github.com/repos/palantir/plottable/pulls/1708"}}},"pull_request":{"url":"https://api.github.com/repos/palantir/plottable/pulls/1708","id":30351408,"html_url":"https://github.com/palantir/plottable/pull/1708","diff_url":"https://github.com/palantir/plottable/pull/1708.diff","patch_url":"https://github.com/palantir/plottable/pull/1708.patch","issue_url":"https://api.github.com/repos/palantir/plottable/issues/1708","number":1708,"state":"open","locked":false,"title":"[ScatterPlot] - Symbol Support + Symbol Generators","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":"The shapes used in Scatter Plots are now symbols, where symbols are path elements that should be generated using a symbol generator of some sort.  As a result, d3's symbol generator has been leveraged to provide a default way to generate symbols.  Users are free to generate their own SymbolGenerator.\r\n\r\nA SymbolGenerator is defined as a function that takes in the radius of the total space for the symbol and returns a string which is the SVG Path string that defines the symbol.\r\n\r\nSymbolGenerators can be inserted into a ScatterPlot like so:\r\n\r\n```typescript\r\nscatterPlot.project(\"symbol\", symbolGenerator());\r\n```\r\n\r\nTo ease the use of these symbols, d3's symbol generator has been used and wrapped into a Plottable Util for ease of use.  Its usage can be seen below:\r\n\r\n```typescript\r\nscatterPlot.project(\"symbol\", Plottable.SymbolGenerators.d3Symbol(\"triangle-up\"));\r\n```\r\n\r\nAPI-Breaks: Default animators on scatter plots \"circles\" and \"circles-reset\" have been renamed to \"symbols\" and \"symbols-reset\" respectively.\r\n\r\nFixes #1674 ","created_at":"2015-03-03T07:15:49Z","updated_at":"2015-03-06T23:02:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"98ba4a92969dcdd3afb33c4fa19ee1aa0d5112d1","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":null,"commits_url":"https://api.github.com/repos/palantir/plottable/pulls/1708/commits","review_comments_url":"https://api.github.com/repos/palantir/plottable/pulls/1708/comments","review_comment_url":"https://api.github.com/repos/palantir/plottable/pulls/comments{/number}","comments_url":"https://api.github.com/repos/palantir/plottable/issues/1708/comments","statuses_url":"https://api.github.com/repos/palantir/plottable/statuses/f8e4f7d73f65bfa740513eaa2bd1f481c00333cd","head":{"label":"palantir:1674-FR","ref":"1674-FR","sha":"f8e4f7d73f65bfa740513eaa2bd1f481c00333cd","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-03-06T23:01:01Z","pushed_at":"2015-03-06T23:01:59Z","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":60117,"stargazers_count":411,"watchers_count":411,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":32,"mirror_url":null,"open_issues_count":138,"forks":32,"open_issues":138,"watchers":411,"default_branch":"develop"}},"base":{"label":"palantir:develop","ref":"develop","sha":"7ab6766a920f274844a4b2c0c74b633a94f2c946","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-03-06T23:01:01Z","pushed_at":"2015-03-06T23:01:59Z","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":60117,"stargazers_count":411,"watchers_count":411,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":32,"mirror_url":null,"open_issues_count":138,"forks":32,"open_issues":138,"watchers":411,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/palantir/plottable/pulls/1708"},"html":{"href":"https://github.com/palantir/plottable/pull/1708"},"issue":{"href":"https://api.github.com/repos/palantir/plottable/issues/1708"},"comments":{"href":"https://api.github.com/repos/palantir/plottable/issues/1708/comments"},"review_comments":{"href":"https://api.github.com/repos/palantir/plottable/pulls/1708/comments"},"review_comment":{"href":"https://api.github.com/repos/palantir/plottable/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/palantir/plottable/pulls/1708/commits"},"statuses":{"href":"https://api.github.com/repos/palantir/plottable/statuses/f8e4f7d73f65bfa740513eaa2bd1f481c00333cd"}}}}