{"action":"created","comment":{"url":"https://api.github.com/repos/wilzbach/msa/pulls/comments/63055793","id":63055793,"diff_hunk":"@@ -14,23 +18,72 @@ const ConservationView = view.extend({\n     // we need to wait until stats gives us the ok\n     //@listenTo @model, \"reset\",@render\n     this.listenTo(this.g.stats,\"reset\", this.render);\n+    \n+    var opts = _.extend( {}, { \n+      fillColor: '#660', // [ '#660', '#ff0'],\n+      strokeColor: '#330',\n+      maxHeight: 20,\n+      rectStyler: function(rect, data) { return rect }\n+    }, this.g.conservationConfig );\n+        \n+    this.fillColor = opts.fillColor;\n+    this.strokeColor = opts.strokeColor;\n+    this.maxHeight = opts.maxHeight;\n+    this.rectStyler = opts.rectStyler;\n+    \n     return this.manageEvents();\n   },\n-\n+  \n+  // returns a function that will decide a colour \n+  // based on the conservation data it is given\n+  colorer: function(colorRange) {\n+    var colorer = function() { return \"none\" };\n+        \n+    if( typeof colorRange === 'string' ) {\n+      colorer = function() { return colorRange };\n+    }\n+    else if( Array.isArray( colorRange ) ) {\n+      if ( colorRange.length != 2 ) {\n+        console.error( \"ERROR: colorRange array should have exactly two elements\", colorRange );\n+      }\n+      \n+      if ( !d3_scale ) {","path":"src/views/header/ConservationView.js","position":null,"original_position":50,"commit_id":"266666411ac9555fb8da44b0abbb41243df1a1dc","original_commit_id":"1c5231d9e1a0b9d3b16e2155df62ecfb1329874c","user":{"login":"sillitoe","id":152954,"avatar_url":"https://avatars.githubusercontent.com/u/152954?v=3","gravatar_id":"","url":"https://api.github.com/users/sillitoe","html_url":"https://github.com/sillitoe","followers_url":"https://api.github.com/users/sillitoe/followers","following_url":"https://api.github.com/users/sillitoe/following{/other_user}","gists_url":"https://api.github.com/users/sillitoe/gists{/gist_id}","starred_url":"https://api.github.com/users/sillitoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sillitoe/subscriptions","organizations_url":"https://api.github.com/users/sillitoe/orgs","repos_url":"https://api.github.com/users/sillitoe/repos","events_url":"https://api.github.com/users/sillitoe/events{/privacy}","received_events_url":"https://api.github.com/users/sillitoe/received_events","type":"User","site_admin":false},"body":"thanks for all the comments - all very useful\n\nI've gone with your code to check whether d3 is available (ignore d3-scale)\n\n\n\n\n\nOn 12 May 2016 at 17:45, Sebastian Wilzbach <notifications@github.com>\nwrote:\n\n> In src/views/header/ConservationView.js\n> <https://github.com/wilzbach/msa/pull/130#discussion_r63054556>:\n>\n> > -\n> > +\n> > +  // returns a function that will decide a colour\n> > +  // based on the conservation data it is given\n> > +  colorer: function(colorRange) {\n> > +    var colorer = function() { return \"none\" };\n> > +\n> > +    if( typeof colorRange === 'string' ) {\n> > +      colorer = function() { return colorRange };\n> > +    }\n> > +    else if( Array.isArray( colorRange ) ) {\n> > +      if ( colorRange.length != 2 ) {\n> > +        console.error( \"ERROR: colorRange array should have exactly two elements\", colorRange );\n> > +      }\n> > +\n> > +      if ( !d3_scale ) {\n>\n> oh then it's probably better to check for typeof d3_scale == \"undefined\"\n>\n> —\n> You are receiving this because you authored the thread.\n> Reply to this email directly or view it on GitHub\n> <https://github.com/wilzbach/msa/pull/130/files/1c5231d9e1a0b9d3b16e2155df62ecfb1329874c#r63054556>\n>\n\n\n\n-- \n*Ian Sillitoe* | Senior Research Fellow\n*CATH Manager* | www.cathdb.info\n*University College London* | 627 Darwin, Gower Street, WC1E 6BT\n","created_at":"2016-05-12T16:51:12Z","updated_at":"2016-05-12T16:51:12Z","html_url":"https://github.com/wilzbach/msa/pull/130#discussion_r63055793","pull_request_url":"https://api.github.com/repos/wilzbach/msa/pulls/130","_links":{"self":{"href":"https://api.github.com/repos/wilzbach/msa/pulls/comments/63055793"},"html":{"href":"https://github.com/wilzbach/msa/pull/130#discussion_r63055793"},"pull_request":{"href":"https://api.github.com/repos/wilzbach/msa/pulls/130"}}},"pull_request":{"url":"https://api.github.com/repos/wilzbach/msa/pulls/130","id":69865674,"html_url":"https://github.com/wilzbach/msa/pull/130","diff_url":"https://github.com/wilzbach/msa/pull/130.diff","patch_url":"https://github.com/wilzbach/msa/pull/130.patch","issue_url":"https://api.github.com/repos/wilzbach/msa/issues/130","number":130,"state":"open","locked":false,"title":"Add conservation display options","user":{"login":"sillitoe","id":152954,"avatar_url":"https://avatars.githubusercontent.com/u/152954?v=3","gravatar_id":"","url":"https://api.github.com/users/sillitoe","html_url":"https://github.com/sillitoe","followers_url":"https://api.github.com/users/sillitoe/followers","following_url":"https://api.github.com/users/sillitoe/following{/other_user}","gists_url":"https://api.github.com/users/sillitoe/gists{/gist_id}","starred_url":"https://api.github.com/users/sillitoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sillitoe/subscriptions","organizations_url":"https://api.github.com/users/sillitoe/orgs","repos_url":"https://api.github.com/users/sillitoe/repos","events_url":"https://api.github.com/users/sillitoe/events{/privacy}","received_events_url":"https://api.github.com/users/sillitoe/received_events","type":"User","site_admin":false},"body":"Provides a few options to the msa config to customise how the conservation score track should be displayed (note: this is a tidied up version of #120)\r\n\r\n```\r\nconserv: {\r\n\r\n  // specify height (px)\r\n  maxHeight: 200,\r\n\r\n  // default fill colour (name or hex)\r\n  fillColor: 'blue',   \r\n\r\n  // default outline colour (name or hex)\r\n  strokeColor: '#000',   \r\n\r\n  // control how each data point is rendered\r\n  rectStyler: function(rect, data) {  \r\n    if ( data.colPos < 10 ) {\r\n      rect.style.fill = '#900';\r\n    }\r\n    return rect;\r\n  }\r\n}\r\n```\r\n","created_at":"2016-05-12T16:18:13Z","updated_at":"2016-05-12T16:51:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1d16b9cc4e5a19c65617422884276943c1b50d5b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wilzbach/msa/pulls/130/commits","review_comments_url":"https://api.github.com/repos/wilzbach/msa/pulls/130/comments","review_comment_url":"https://api.github.com/repos/wilzbach/msa/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wilzbach/msa/issues/130/comments","statuses_url":"https://api.github.com/repos/wilzbach/msa/statuses/266666411ac9555fb8da44b0abbb41243df1a1dc","head":{"label":"sillitoe:add-conservation-display-options","ref":"add-conservation-display-options","sha":"266666411ac9555fb8da44b0abbb41243df1a1dc","user":{"login":"sillitoe","id":152954,"avatar_url":"https://avatars.githubusercontent.com/u/152954?v=3","gravatar_id":"","url":"https://api.github.com/users/sillitoe","html_url":"https://github.com/sillitoe","followers_url":"https://api.github.com/users/sillitoe/followers","following_url":"https://api.github.com/users/sillitoe/following{/other_user}","gists_url":"https://api.github.com/users/sillitoe/gists{/gist_id}","starred_url":"https://api.github.com/users/sillitoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sillitoe/subscriptions","organizations_url":"https://api.github.com/users/sillitoe/orgs","repos_url":"https://api.github.com/users/sillitoe/repos","events_url":"https://api.github.com/users/sillitoe/events{/privacy}","received_events_url":"https://api.github.com/users/sillitoe/received_events","type":"User","site_admin":false},"repo":{"id":30694392,"name":"biojs-vis-msa","full_name":"sillitoe/biojs-vis-msa","owner":{"login":"sillitoe","id":152954,"avatar_url":"https://avatars.githubusercontent.com/u/152954?v=3","gravatar_id":"","url":"https://api.github.com/users/sillitoe","html_url":"https://github.com/sillitoe","followers_url":"https://api.github.com/users/sillitoe/followers","following_url":"https://api.github.com/users/sillitoe/following{/other_user}","gists_url":"https://api.github.com/users/sillitoe/gists{/gist_id}","starred_url":"https://api.github.com/users/sillitoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sillitoe/subscriptions","organizations_url":"https://api.github.com/users/sillitoe/orgs","repos_url":"https://api.github.com/users/sillitoe/repos","events_url":"https://api.github.com/users/sillitoe/events{/privacy}","received_events_url":"https://api.github.com/users/sillitoe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sillitoe/biojs-vis-msa","description":"Modular BioJS compoment for a multiple sequence alignment","fork":true,"url":"https://api.github.com/repos/sillitoe/biojs-vis-msa","forks_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/forks","keys_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/teams","hooks_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/hooks","issue_events_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/issues/events{/number}","events_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/events","assignees_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/assignees{/user}","branches_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/branches{/branch}","tags_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/tags","blobs_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/git/refs{/sha}","trees_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/statuses/{sha}","languages_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/languages","stargazers_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/stargazers","contributors_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/contributors","subscribers_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/subscribers","subscription_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/subscription","commits_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/commits{/sha}","git_commits_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/git/commits{/sha}","comments_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/comments{/number}","issue_comment_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/issues/comments{/number}","contents_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/contents/{+path}","compare_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/merges","archive_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/downloads","issues_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/issues{/number}","pulls_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/pulls{/number}","milestones_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/milestones{/number}","notifications_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/labels{/name}","releases_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/releases{/id}","deployments_url":"https://api.github.com/repos/sillitoe/biojs-vis-msa/deployments","created_at":"2015-02-12T09:06:42Z","updated_at":"2016-05-12T15:15:44Z","pushed_at":"2016-05-12T16:49:38Z","git_url":"git://github.com/sillitoe/biojs-vis-msa.git","ssh_url":"git@github.com:sillitoe/biojs-vis-msa.git","clone_url":"https://github.com/sillitoe/biojs-vis-msa.git","svn_url":"https://github.com/sillitoe/biojs-vis-msa","homepage":"biojs-msa.org","size":29448,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"wilzbach:master","ref":"master","sha":"c7ac58779f89eea7a4bf46c3abd993823ae1958c","user":{"login":"wilzbach","id":4370550,"avatar_url":"https://avatars.githubusercontent.com/u/4370550?v=3","gravatar_id":"","url":"https://api.github.com/users/wilzbach","html_url":"https://github.com/wilzbach","followers_url":"https://api.github.com/users/wilzbach/followers","following_url":"https://api.github.com/users/wilzbach/following{/other_user}","gists_url":"https://api.github.com/users/wilzbach/gists{/gist_id}","starred_url":"https://api.github.com/users/wilzbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilzbach/subscriptions","organizations_url":"https://api.github.com/users/wilzbach/orgs","repos_url":"https://api.github.com/users/wilzbach/repos","events_url":"https://api.github.com/users/wilzbach/events{/privacy}","received_events_url":"https://api.github.com/users/wilzbach/received_events","type":"User","site_admin":false},"repo":{"id":20128188,"name":"msa","full_name":"wilzbach/msa","owner":{"login":"wilzbach","id":4370550,"avatar_url":"https://avatars.githubusercontent.com/u/4370550?v=3","gravatar_id":"","url":"https://api.github.com/users/wilzbach","html_url":"https://github.com/wilzbach","followers_url":"https://api.github.com/users/wilzbach/followers","following_url":"https://api.github.com/users/wilzbach/following{/other_user}","gists_url":"https://api.github.com/users/wilzbach/gists{/gist_id}","starred_url":"https://api.github.com/users/wilzbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilzbach/subscriptions","organizations_url":"https://api.github.com/users/wilzbach/orgs","repos_url":"https://api.github.com/users/wilzbach/repos","events_url":"https://api.github.com/users/wilzbach/events{/privacy}","received_events_url":"https://api.github.com/users/wilzbach/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wilzbach/msa","description":"Modular BioJS compoment for a multiple sequence alignment","fork":false,"url":"https://api.github.com/repos/wilzbach/msa","forks_url":"https://api.github.com/repos/wilzbach/msa/forks","keys_url":"https://api.github.com/repos/wilzbach/msa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wilzbach/msa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wilzbach/msa/teams","hooks_url":"https://api.github.com/repos/wilzbach/msa/hooks","issue_events_url":"https://api.github.com/repos/wilzbach/msa/issues/events{/number}","events_url":"https://api.github.com/repos/wilzbach/msa/events","assignees_url":"https://api.github.com/repos/wilzbach/msa/assignees{/user}","branches_url":"https://api.github.com/repos/wilzbach/msa/branches{/branch}","tags_url":"https://api.github.com/repos/wilzbach/msa/tags","blobs_url":"https://api.github.com/repos/wilzbach/msa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wilzbach/msa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wilzbach/msa/git/refs{/sha}","trees_url":"https://api.github.com/repos/wilzbach/msa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wilzbach/msa/statuses/{sha}","languages_url":"https://api.github.com/repos/wilzbach/msa/languages","stargazers_url":"https://api.github.com/repos/wilzbach/msa/stargazers","contributors_url":"https://api.github.com/repos/wilzbach/msa/contributors","subscribers_url":"https://api.github.com/repos/wilzbach/msa/subscribers","subscription_url":"https://api.github.com/repos/wilzbach/msa/subscription","commits_url":"https://api.github.com/repos/wilzbach/msa/commits{/sha}","git_commits_url":"https://api.github.com/repos/wilzbach/msa/git/commits{/sha}","comments_url":"https://api.github.com/repos/wilzbach/msa/comments{/number}","issue_comment_url":"https://api.github.com/repos/wilzbach/msa/issues/comments{/number}","contents_url":"https://api.github.com/repos/wilzbach/msa/contents/{+path}","compare_url":"https://api.github.com/repos/wilzbach/msa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wilzbach/msa/merges","archive_url":"https://api.github.com/repos/wilzbach/msa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wilzbach/msa/downloads","issues_url":"https://api.github.com/repos/wilzbach/msa/issues{/number}","pulls_url":"https://api.github.com/repos/wilzbach/msa/pulls{/number}","milestones_url":"https://api.github.com/repos/wilzbach/msa/milestones{/number}","notifications_url":"https://api.github.com/repos/wilzbach/msa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wilzbach/msa/labels{/name}","releases_url":"https://api.github.com/repos/wilzbach/msa/releases{/id}","deployments_url":"https://api.github.com/repos/wilzbach/msa/deployments","created_at":"2014-05-24T11:38:06Z","updated_at":"2016-04-28T15:59:05Z","pushed_at":"2016-05-12T16:49:39Z","git_url":"git://github.com/wilzbach/msa.git","ssh_url":"git@github.com:wilzbach/msa.git","clone_url":"https://github.com/wilzbach/msa.git","svn_url":"https://github.com/wilzbach/msa","homepage":"http://msa.biojs.net","size":29401,"stargazers_count":33,"watchers_count":33,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":10,"mirror_url":null,"open_issues_count":48,"forks":10,"open_issues":48,"watchers":33,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wilzbach/msa/pulls/130"},"html":{"href":"https://github.com/wilzbach/msa/pull/130"},"issue":{"href":"https://api.github.com/repos/wilzbach/msa/issues/130"},"comments":{"href":"https://api.github.com/repos/wilzbach/msa/issues/130/comments"},"review_comments":{"href":"https://api.github.com/repos/wilzbach/msa/pulls/130/comments"},"review_comment":{"href":"https://api.github.com/repos/wilzbach/msa/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wilzbach/msa/pulls/130/commits"},"statuses":{"href":"https://api.github.com/repos/wilzbach/msa/statuses/266666411ac9555fb8da44b0abbb41243df1a1dc"}}}}